Opened 11 years ago

Closed 11 years ago

#18841 closed defect (fixed)

zlib does not build universal / Tiger-ppc

Reported by: jeremyhu (Jeremy Huddleston Sequoia) Owned by: ryandesign (Ryan Schmidt)
Priority: Normal Milestone:
Component: ports Version: 1.7.0
Keywords: muniversal universal Cc: MarcusCalhoun-Lopez (Marcus Calhoun-Lopez), pgregory@…
Port: zlib

Description

On Tiger ppc, zlib doesn't build i386 support for the dylib. Configure spits out:

--->  Configuring zlib for architecture i386
Checking for shared library support...
No shared library support; try without defining CC and CFLAGS
Building static library libz.a version 1.2.3 with /usr/bin/gcc-4.0 -arch i386.
Checking for unistd.h... Yes.
Checking whether to use vs[n]printf() or s[n]printf()... using vs[n]printf()
Checking for vsnprintf() in stdio.h... Yes.
Checking for return value of vsnprintf()... Yes.
Checking for errno.h... Yes.
Checking for mmap support... Yes.

Putting some debugging into the configure script, it's failing due to:

Checking for shared library support...
/usr/bin/gcc-4.0 -arch i386 -c -O2 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 ztest5532.c
/usr/bin/gcc-4.0 -arch i386 -dynamiclib -install_name ${exec_prefix}/lib/libz.1.dylib -compatibility_version 1 -current_version 1.2.3 -o ztest5532.dylib ztest5532.o
ld: Undefined symbols:
_getchar
/usr/libexec/gcc/i686-apple-darwin8/4.0.1/libtool: internal link edit command failed
No shared library support; try without defining CC and CFLAGS

The problem is with CC:

~/src/macports-trunk/dports/archivers/zlib/work/i386 $ sudo ./configure --shared
Checking for shared library support...
/usr/bin/gcc-4.0 -arch i386 -c -O2 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 ztest6042.c
/usr/bin/gcc-4.0 -arch i386 -dynamiclib -install_name ${exec_prefix}/lib/libz.1.dylib -compatibility_version 1 -current_version 1.2.3 -o ztest6042.dylib ztest6042.o
ld: Undefined symbols:
_getchar
/usr/libexec/gcc/i686-apple-darwin8/4.0.1/libtool: internal link edit command failed
No shared library support; try without defining CC and CFLAGS
Building static library libz.a version 1.2.3 with /usr/bin/gcc-4.0 -arch i386.
Checking for unistd.h... Yes.
Checking whether to use vs[n]printf() or s[n]printf()... using vs[n]printf()
Checking for vsnprintf() in stdio.h... Yes.
Checking for return value of vsnprintf()... Yes.
Checking for errno.h... Yes.
Checking for mmap support... Yes.

(01:44:55 Sun Mar 15 2009 jeremy@redxiii Power Macintosh)
~/src/macports-trunk/dports/archivers/zlib/work/i386 $ export CC="/usr/bin/gcc-4.0"

(01:45:02 Sun Mar 15 2009 jeremy@redxiii Power Macintosh)
~/src/macports-trunk/dports/archivers/zlib/work/i386 $ sudo ./configure --shared
Checking for shared library support...
/usr/bin/gcc-4.0 -c -O2 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 ztest6125.c
/usr/bin/gcc-4.0 -dynamiclib -install_name ${exec_prefix}/lib/libz.1.dylib -compatibility_version 1 -current_version 1.2.3 -o ztest6125.dylib ztest6125.o
Building shared library libz.1.2.3.dylib with /usr/bin/gcc-4.0.
Checking for unistd.h... Yes.
Checking whether to use vs[n]printf() or s[n]printf()... using vs[n]printf()
Checking for vsnprintf() in stdio.h... Yes.
Checking for return value of vsnprintf()... Yes.
Checking for errno.h... Yes.
Checking for mmap support... Yes.

Change History (15)

comment:1 Changed 11 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Or actually, it's probably because '-isysroot /Developer/SDKs/MacOSX10.4u.sdk' is missing during linking...

comment:2 Changed 11 years ago by jmroot (Joshua Root)

Cc: mcalhoun@… added

Given that there wasn't a real reason to start using muniversal here, it should be reverted (unless the portgroup is going to be fixed VERY soon).

comment:3 Changed 11 years ago by ryandesign (Ryan Schmidt)

Well, wait, why is '-isysroot /Developer/SDKs/MacOSX10.4u.sdk' missing diring linking? Could we add the right flags to configure.ldflags to fix this? My Power Mac is not on the network at the moment or I'd test this myself.

comment:4 Changed 11 years ago by ryandesign (Ryan Schmidt)

Port: muniversal removed

comment:5 Changed 11 years ago by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)

I am not sure this problem has anything to do with the muniversal PortGroup.
In portconfigure.tcl, the function configure_get_universal_ldflags only adds the following:

    if {${os.arch} == "powerpc"} {
        set flags "-Wl,-syslibroot,${configure.universal_sysroot} ${flags}"
    }
    if {${os.major} == "9"} {
        set flags "${flags} -mmacosx-version-min=${configure.universal_target}"
    }
}

-isysroot only gets added in configure_get_universal_cflags and configure_get_universal_cppflags.
muniversal simply duplicates this behavior.

isysroot is not well documented, but I though it had to do with looking for include directories.
Why should it help with linking?

comment:6 Changed 11 years ago by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)

Resolution: fixed
Status: newclosed

This should be fixed in r50198.
"-Wl,-syslibroot,${configure.universal_sysroot} ${flags}" will not be used when linking.
Hopefully, this will solve the problem.

comment:7 Changed 11 years ago by (none)

Milestone: Port Bugs

Milestone Port Bugs deleted

comment:8 Changed 11 years ago by Chris.Barker@…

This doesn't appear to have done it for me:

(but I don't have permission to re-open)

OS-X 10.4.11 PPC

macports from SVN today: Revision: 50573

$ sudo port install zlib +universal
Password:
--->  Fetching zlib
--->  Verifying checksum(s) for zlib
--->  Extracting zlib
--->  Applying patches to zlib
--->  Configuring zlib
--->  Configuring zlib for architecture ppc
--->  Configuring zlib for architecture i386
--->  Building zlib
--->  Building zlib for architecture ppc
--->  Building zlib for architecture i386
--->  Staging zlib into destroot
--->  Staging zlib into destroot for architecture ppc
--->  Staging zlib into destroot for architecture i386
--->  Installing zlib @1.2.3_2+universal
--->  Activating zlib @1.2.3_2+universal
--->  Cleaning zlib

which all looks right, but:

$ file /opt/local/lib/libz.1.2.3.dylib 
/opt/local/lib/libz.1.2.3.dylib: Mach-O dynamically linked shared library ppc

I'm not getting a universal lib. However the static lib is universal:

$ file /opt/local/lib/libz.a 
/opt/local/lib/libz.a: Mach-O universal binary with 2 architectures
/opt/local/lib/libz.a (for architecture ppc):   current ar archive
/opt/local/lib/libz.a (for architecture i386):  current ar archive random library

The end result for me is that I can't build libtiff universal:

...
--->  Configuring tiff for architecture i386
Error: Target org.macports.configure returned: configure failure: shell command " cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_svn.macports.org_trunk_dports_graphics_tiff/work/tiff-3.8.2-i386" && ./configure --prefix=/opt/local --mandir=/opt/local/share/man --with-docdir=/opt/local/share/doc/tiff-3.8.2 --with-jpeg-include-dir=/opt/local/include --with-jpeg-lib-dir=/opt/local/lib --with-zlib-include-dir=/opt/local/include --with-zlib-lib-dir=/opt/local/lib --disable-dependency-tracking --host=i386-apple-darwin8.11.0 --with-apple-opengl-framework " returned error 1

...

checking for inflateEnd in -lz... no
configure: error: Zlib library not found at /opt/local/lib

comment:9 Changed 11 years ago by ryandesign (Ryan Schmidt)

Resolution: fixed
Status: closedreopened

comment:10 in reply to:  8 Changed 11 years ago by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)

Replying to Chris.Barker@…:

$ file /opt/local/lib/libz.1.2.3.dylib 
/opt/local/lib/libz.1.2.3.dylib: Mach-O dynamically linked shared library ppc

I'm not getting a universal lib. However the static lib is universal:

$ file /opt/local/lib/libz.a 
/opt/local/lib/libz.a: Mach-O universal binary with 2 architectures
/opt/local/lib/libz.a (for architecture ppc):   current ar archive
/opt/local/lib/libz.a (for architecture i386):  current ar archive random library

At least it is a new error.
My initial guess is that the configure script encounters an error when trying to cross-compile the shared library and therefore does not build it for i386.

Could you please attach the config.log for i386?
Perhaps that will offer some insight.

comment:11 Changed 11 years ago by jmroot (Joshua Root)

It doesn't appear to produce a config.log.

comment:12 Changed 11 years ago by ryandesign (Ryan Schmidt)

Right, zlib does not use an autoconf configure script. After configure, the file zconf.h is changed and the file Makefile is created from Makefile.in.

I was sure zlib used to build universal on Tiger PPC... :(

comment:13 Changed 11 years ago by pgregory@…

Cc: pgregory@… added

Cc Me!

comment:14 Changed 11 years ago by tobypeterson

Try now (as of r52192)

comment:15 Changed 11 years ago by jmroot (Joshua Root)

Resolution: fixed
Status: reopenedclosed

Tested on PPC Tiger, confirmed that a universal .dylib is now built.

Note: See TracTickets for help on using tickets.