Re: [VCDImager Bugs/Devel] vcdimager 0.7.20 build problem under Mac OS X

Sebastian Hagedorn <[email protected]> Sun, 07 Mar 2004 21:30:59 +0100
Newsgroups gmane.comp.gnu.vcdimager.bugs
Message-ID <2147483647.1078695057@[192.168.1.11]>
Hi,

-- "R. Bernstein" <[email protected]> is rumored to have mumbled on Mittwoch, =

3. M=E4rz 2004 8:40 Uhr -0500 regarding Re: [VCDImager Bugs/Devel] =
vcdimager=20
0.7.20 build problem under Mac OS X:

> Sebastian Hagedorn writes:
>  > strange, I haven't had this problem with libcdio 0.66. Or have you
> added   > versioning support in 0.67?
>
> Looking at NEWS for libcdio 0.66, I see the versioning was in
> 0.66. 0.67 added --without-versioned-libs.
>
>  > I'll try to find out what's the best route to take.
>
> Thanks.

I've examined this some more. Versioning works fine under OS X with libcdio =

0.67. I believe the reason for that to be a different version of libtool:

libcdio-0.67/libtool --version
ltmain.sh (GNU libtool) 1.4.3 (1.922.2.111 2002/10/23 02:54:36)

vcdimager-0.7.20] hgd% ./libtool --version
ltmain.sh (GNU libtool) 1.5.2 (1.1220.2.60 2004/01/25 12:25:08) Debian: 192 =

$

When libcdio calls libtool, the following happens:

/bin/sh ../libtool --mode=3Dlink gcc  -g -O2 -Wall -Wchar-subscripts=20
-Wmissing-prototypes -Wmissing-declarations -Wunused -Wpointer-arith=20
-Wwrite-strings -Wnested-externs -Wno-sign-compare  -L/sw/lib -o=20
libiso9660.la -rpath /sw/lib -version-info 1:0:1=20
-Wl,--version-script=3Dlibiso9660.la.ver iso9660.lo iso9660_fs.lo xa.lo=20
libcdio.la -lm

Note that "-Wl,--version-script=3Dlibiso9660.la.ver" is part of that =
command.=20
It results in this:

gcc -r -keep_private_externs -nostdlib -o=20
.libs/libiso9660.0.1.0.dylib-master.o  iso9660.lo iso9660_fs.lo xa.lo &&=20
gcc -dynamiclib -flat_namespace -undefined suppress -o=20
.libs/libiso9660.0.1.0.dylib .libs/libiso9660.0.1.0.dylib-master.o=20
-L/sw/lib -L./.libs -lcdio -lm -lc --version-script=3Dlibiso9660.la.ver=20
-install_name /sw/lib/libiso9660.0.dylib -compatibility_version 2=20
-current_version 2.0

For whatever reason the second call of gcc includes only=20
"--version-script=3Dlibiso9660.la.ver", which gcc ignores (note the absence =

of -Wl, in front of it). The versioning OS X uses works because of the=20
"-version-info 1:0:1" flag.

When vcdimager calls libtool, it looks like this:

/bin/sh ../libtool --mode=3Dlink gcc  -g -O2  -Wall -Wchar-subscripts=20
-Wmissing-prototypes -Wmissing-declarations -Wunused -Wpointer-arith=20
-Wwrite-strings -Wnested-externs -Wno-sign-compare  -L/sw/lib -o=20
libvcdinfo.la -rpath /sw/lib -version-info 0:1:0=20
-Wl,--version-script=3Dlibvcdinfo.la.ver info.lo inf.lo info_private.lo=20
vcd_read.lo -L/sw/lib -lcdio   -L/sw/lib -liso9660 -lcdio=20
../lib/libvcd.la -lm

This is basically the same as with libcdio. But the newer libtool behaves=20
differently:

gcc -dynamiclib -undefined dynamic_lookup -o .libs/libvcdinfo.0.0.1.dylib=20
.libs/info.o .libs/inf.o .libs/info_private.o .libs/vcd_read.o -all_load=20
../lib/.libs/libvcd.a  -L/sw/lib /sw/lib/libiso9660.dylib=20
/sw/lib/libcdio.dylib -lm -Wl,--version-script=3Dlibvcdinfo.la.ver=20
-install_name  /sw/lib/libvcdinfo.0.dylib -compatibility_version 1=20
-current_version 1.1

It does only one call to gcc, which contains the original=20
"-Wl,--version-script=3Dlibvcdinfo.la.ver" part. Thus the flag=20
"--version-script=3Dlibvcdinfo.la.ver" isn't dropped by gcc but rather =
passed=20
to the loader. The loader (or rather Apple's own libtool) doesn't know it=20
and barfs:

/usr/bin/libtool: unknown option character `-' in:=20
--version-script=3Dlibvcdinfo.la.ver

I suppose that libcdio working is just coincidence. If my analysis is=20
correct, the configure script should determine whether GNU ld is being used =

or not. In fact, it does so already. What needs to be done is for=20
"-Wl,--version-script=3Dlibvcdinfo.la.ver" to be passed to libtool *only* =
if=20
GNU ld is being used ... versioning should *still* work, because libtool=20
does the right thing in translating the "-version-info" flag to the=20
appropriate " -compatibility_version" and  "-current_version" flags that=20
are used by OS X.
--
Sebastian Hagedorn
Ehrenfeldg=FCrtel 156, 50823 K=F6ln, Germany
http://www.spinfo.uni-koeln.de/~hgd/

"Being just contaminates the void" - Robyn Hitchcock