libtool
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: why does libtool reorder -Wl, arguments to the end making -Wl, --as


From: Petteri Räty
Subject: Re: why does libtool reorder -Wl, arguments to the end making -Wl, --as-needed unusable
Date: Mon, 03 Mar 2008 16:20:38 +0200
User-agent: Thunderbird 2.0.0.9 (X11/20080301)

Peter O'Gorman kirjoitti:
Petteri Räty wrote:
Albert Chin kirjoitti:
On Thu, Feb 28, 2008 at 03:17:54PM +0200, Petteri Räty wrote:
address@hidden /mnt/checkouts/classpath/native/jni/qt-peer $ make
make  all-am
make[1]: Entering directory
`/mnt/checkouts/classpath/native/jni/qt-peer'
/bin/sh ../../../libtool --tag=CXX   --mode=link g++ -DQT_SHARED
-I/usr/include/qt4 -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui
-g -O2 -module -version-info 0:0:0 -no-undefined -avoid-version
-Wl,--as-needed -o libqtpeer.la -rpath
/usr/local/classpath/lib/classpath ... [snip snip]

--as-needed needs to come before the object files and libs to be
effective but libtool moves it to the end. This happens with both
1.5.26 and cvs head.
The fact that libtool reorders _any_ of the command-line is a bug. I
think Ralf has a fix for this but I don't think it'll happen until 2.1
or 2.2.

Still there in libtool 2.2

As a workaround until we get this fixed, if an automake based project
try 'make CXXLD='g++ -Wl,--as-needed' CCLD='gcc -Wl,--as-needed'.

I'll look into this.

Peter

that does not help:
address@hidden ~/cpp/libtooltest $ grep CXXLD *
Makefile:CXXLD = $(CXX)
Makefile: --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
Makefile.in:CXXLD = $(CXX)
Makefile.in: --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \

But with CXX set to CXX='g++ -Wl,--as-needed' it does work. I don't know if that will break anything but we shall see.

I also wonder why libtool brings all these dependency libraries with -lpulse:
address@hidden ~/cpp/libtooltest $ ldd .libs/libfoobar.so
        linux-gate.so.1 =>  (0xb7f82000)
        libpulse.so.0 => /usr/lib/libpulse.so.0 (0xb7f23000)
        libSM.so.6 => /usr/lib/libSM.so.6 (0xb7f1a000)
        libICE.so.6 => /usr/lib/libICE.so.6 (0xb7f02000)
        libX11.so.6 => /usr/lib/libX11.so.6 (0xb7e1b000)
        libXau.so.6 => /usr/lib/libXau.so.6 (0xb7e17000)
        libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0xb7e12000)
        libcap.so.1 => /lib/libcap.so.1 (0xb7e0e000)
        librt.so.1 => /lib/librt.so.1 (0xb7e05000)
        libdl.so.2 => /lib/libdl.so.2 (0xb7e01000)
libstdc++.so.6 => /usr/lib/gcc/i686-pc-linux-gnu/4.2.3/libstdc++.so.6 (0xb7d14000)
        libm.so.6 => /lib/libm.so.6 (0xb7cee000)
        libc.so.6 => /lib/libc.so.6 (0xb7bb9000)
libgcc_s.so.1 => /usr/lib/gcc/i686-pc-linux-gnu/4.2.3/libgcc_s.so.1 (0xb7bad000)
        libpthread.so.0 => /lib/libpthread.so.0 (0xb7b95000)
        /lib/ld-linux.so.2 (0x80000000)

After -Wl,--as-needed:
address@hidden ~/cpp/libtooltest $ ldd .libs/libfoobar.so
        linux-gate.so.1 =>  (0xb7ffa000)
libstdc++.so.6 => /usr/lib/gcc/i686-pc-linux-gnu/4.2.3/libstdc++.so.6 (0xb7eec000)
        libc.so.6 => /lib/libc.so.6 (0xb7db7000)
        libm.so.6 => /lib/libm.so.6 (0xb7d92000)
libgcc_s.so.1 => /usr/lib/gcc/i686-pc-linux-gnu/4.2.3/libgcc_s.so.1 (0xb7d86000)
        /lib/ld-linux.so.2 (0x80000000)

Regards,
Petteri





reply via email to

[Prev in Thread] Current Thread [Next in Thread]