--as-needed problem

David Faure faure at kde.org
Thu Nov 18 10:51:41 GMT 2004


On Wednesday 10 November 2004 19:58, Stephan Kulow wrote:
> The situation with as-needed is a bit different: it can actually break 
> something, but we're not sure yet what. 

I'm not sure if it's due to as-needed, but I have a strong suspicion that it is.
I can't compile kdebase anymore, because when linking something in kicker it
finds /usr/lib/kdecore.so and /usr/lib/qt3/lib/libqt-mt.so instead of the ones
it should use ($KDEDIR/lib/kdecore.so and $QTDIR/lib/libqt-mt.so), which always
worked. The symptom was simply some undefined kdecore and qt symbols (because
the system kdecore is older and because my own qt is BIC on purpose), but
using -Q -v -Wl,-t in the link line showed that it was picking up the wrong libs
(in addition to the right ones further down).


g++ -shared -nostdlib  -Wl,--no-undefined -Wl,--allow-shlib-undefined -Wl,-t  -Wnon-virtual-dtor -Wno-long-long -Wundef -ansi -D_XOPEN_SOURCE=500-D_BSD_SOURCE -Wcast-align -Wconversion -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -g -O2 -Wformat-security -Wmissing-format-attribute -fno-exceptions -fno-check-new -fno-common -DQT_CLEAN_NAMESPACE -DQT_NO_ASCII_CAST -DQT_NO_STL -DQT_NO_COMPAT -DQT_NO_TRANSLATION -D_GNU_SOURCE -Q -v /usr/lib/gcc-lib/i586-mandrake-linux-gnu/3.3.2/../../../crti.o /usr/lib/gcc-lib/i586-mandrake-linux-gnu/3.3.2/crtbeginS.o  ../kicker/.libs/dummy.o -Wl,--whole-archive ../kicker/core/.libs/libkicker_core.a ../kicker/buttons/.libs/libkicker_buttons.a ../kicker/ui/.libs/libkicker_ui.a-Wl,--no-whole-archive  -Wl,--rpath -Wl,/mnt/devel/kde/kdedir/lib -Wl,--rpath -Wl,/usr/lib/qt3/lib -Wl,--rpath -Wl,/usr/X11R6/lib -Wl,--rpath -Wl,/mnt/devel/kde/kdecvs/qt-copy/lib -L/mnt/devel/kde/kdedir/lib -L/mnt/devel/kde/kdecvs/qt-copy/lib -L/usr/X11R6/lib -L/usr/lib -lXtst /mnt/devel/kde/kdecvs/build/kdebase/libkonq/.libs/libkonq.so /mnt/devel/kde/kdedir/lib/libkparts.so -L/usr/lib/qt3/lib /usr/lib/libkdecore.so /usr/lib/libDCOP.so /usr/lib/libkdefx.so /usr/lib/qt3/lib/libqt-mt.so -laudio -lXt /usr/lib/libmng.so /usr/X11R6/lib/libGL.so -lXi -lXmu -lXinerama ../kicker/share/.libs/libkickermain.so /mnt/devel/kde/kdedir/lib/libkio.so /mnt/devel/kde/kdedir/lib/libkdeui.so /mnt/devel/kde/kdedir/lib/libkdesu.so /mnt/devel/kde/kdedir/lib/libkwalletclient.so /mnt/devel/kde/kdedir/lib/libkdecore.so /mnt/devel/kde/kdedir/lib/libDCOP.so -lresolv -lutil /usr/lib/libart_lgpl_2.so /mnt/devel/kde/kdedir/lib/libkdefx.so /mnt/devel/kde/kdecvs/qt-copy/lib/libqt-mt.so /usr/lib/libmysqlclient.so -lcrypt -lnsl /usr/lib/libjpeg.so -lXrandr -lXcursor -lXft /usr/lib/libfontconfig.so /usr/lib/libfreetype.so /usr/lib/libexpat.so -ldl -lpng -lXext -lX11 -lSM -lICE -lpthread -lXrender -lz /usr/lib/libfam.so -L/usr/lib/gcc-lib/i586-mandrake-linux-gnu/3.3.2 -L/usr/lib/gcc-lib/i586-mandrake-linux-gnu/3.3.2/../../.. -lstdc++ -lm -lc -lgcc_s /usr/lib/gcc-lib/i586-mandrake-linux-gnu/3.3.2/crtendS.o /usr/lib/gcc-lib/i586-mandrake-linux-gnu/3.3.2/../../../crtn.o -Wl,-soname -Wl,libkdeinit_kicker.so -o ../kicker/.libs/libkdeinit_kicker.so
Reading specs from /usr/lib/gcc-lib/i586-mandrake-linux-gnu/3.3.2/specs
Configured with: ../configure --prefix=/usr --libdir=/usr/lib --with-slibdir=/lib --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --enable-long-long --enable-__cxa_atexit --enable-clocale=gnu --enable-languages=c,c++,ada,f77,objc,java,pascal --host=i586-mandrake-linux-gnu --with-system-zlib
Thread model: posix
gcc version 3.3.2 (Mandrake Linux 10.0 3.3.2-6mdk)
 /usr/lib/gcc-lib/i586-mandrake-linux-gnu/3.3.2/collect2 --eh-frame-hdr -m elf_i386 -shared -o ../kicker/.libs/libkdeinit_kicker.so -L/mnt/devel/kde/kdedir/lib -L/mnt/devel/kde/kdecvs/qt-copy/lib -L/usr/X11R6/lib -L/usr/lib -L/usr/lib/qt3/lib -L/usr/lib/gcc-lib/i586-mandrake-linux-gnu/3.3.2-L/usr/lib/gcc-lib/i586-mandrake-linux-gnu/3.3.2/../../.. -L/usr/lib/gcc-lib/i586-mandrake-linux-gnu/3.3.2 -L/usr/lib/gcc-lib/i586-mandrake-linux-gnu/3.3.2/../../.. --no-undefined --allow-shlib-undefined -t /usr/lib/gcc-lib/i586-mandrake-linux-gnu/3.3.2/../../../crti.o /usr/lib/gcc-lib/i586-mandrake-linux-gnu/3.3.2/crtbeginS.o ../kicker/.libs/dummy.o --whole-archive ../kicker/core/.libs/libkicker_core.a ../kicker/buttons/.libs/libkicker_buttons.a ../kicker/ui/.libs/libkicker_ui.a --no-whole-archive --rpath /mnt/devel/kde/kdedir/lib --rpath /usr/lib/qt3/lib --rpath /usr/X11R6/lib --rpath /mnt/devel/kde/kdecvs/qt-copy/lib -lXtst /mnt/devel/kde/kdecvs/build/kdebase/libkonq/.libs/libkonq.so /mnt/devel/kde/kdedir/lib/libkparts.so /usr/lib/libkdecore.so /usr/lib/libDCOP.so /usr/lib/libkdefx.so /usr/lib/qt3/lib/libqt-mt.so -laudio -lXt /usr/lib/libmng.so /usr/X11R6/lib/libGL.so -lXi -lXmu -lXinerama ../kicker/share/.libs/libkickermain.so /mnt/devel/kde/kdedir/lib/libkio.so /mnt/devel/kde/kdedir/lib/libkdeui.so /mnt/devel/kde/kdedir/lib/libkdesu.so /mnt/devel/kde/kdedir/lib/libkwalletclient.so /mnt/devel/kde/kdedir/lib/libkdecore.so /mnt/devel/kde/kdedir/lib/libDCOP.so -lresolv -lutil /usr/lib/libart_lgpl_2.so /mnt/devel/kde/kdedir/lib/libkdefx.so /mnt/devel/kde/kdecvs/qt-copy/lib/libqt-mt.so /usr/lib/libmysqlclient.so -lcrypt -lnsl /usr/lib/libjpeg.so -lXrandr -lXcursor -lXft /usr/lib/libfontconfig.so /usr/lib/libfreetype.so /usr/lib/libexpat.so -ldl -lpng -lXext -lX11 -lSM -lICE -lpthread -lXrender -lz /usr/lib/libfam.so -lstdc++ -lm -lc -lgcc_s /usr/lib/gcc-lib/i586-mandrake-linux-gnu/3.3.2/crtendS.o /usr/lib/gcc-lib/i586-mandrake-linux-gnu/3.3.2/../../../crtn.o -soname libkdeinit_kicker.so
/usr/bin/ld: mode elf_i386
/usr/lib/gcc-lib/i586-mandrake-linux-gnu/3.3.2/../../../crti.o
/usr/lib/gcc-lib/i586-mandrake-linux-gnu/3.3.2/crtbeginS.o
../kicker/.libs/dummy.o
(../kicker/core/.libs/libkicker_core.a)main.o
[... more kicker object files...]
(../kicker/ui/.libs/libkicker_ui.a)dmctl.o
-lXtst (/usr/X11R6/lib/libXtst.so)
/mnt/devel/kde/kdecvs/build/kdebase/libkonq/.libs/libkonq.so
/mnt/devel/kde/kdedir/lib/libkparts.so
/usr/lib/libkdecore.so         <<<<<<< WRONG
/usr/lib/libDCOP.so
/usr/lib/libkdefx.so
/usr/lib/qt3/lib/libqt-mt.so      <<<<<<<< WRONG
-laudio (/usr/X11R6/lib/libaudio.so)
-lXt (/usr/X11R6/lib/libXt.so)
/usr/lib/libmng.so
/usr/X11R6/lib/libGL.so
-lXi (/usr/X11R6/lib/libXi.so)
-lXmu (/usr/X11R6/lib/libXmu.so)
-lXinerama (/usr/X11R6/lib/libXinerama.so)
../kicker/share/.libs/libkickermain.so
/mnt/devel/kde/kdedir/lib/libkio.so     <<<<<<<<<<< RIGHT
/mnt/devel/kde/kdedir/lib/libkdeui.so
/mnt/devel/kde/kdedir/lib/libkdesu.so
/mnt/devel/kde/kdedir/lib/libkwalletclient.so
/mnt/devel/kde/kdedir/lib/libkdecore.so       <<<<<<<<<<< RIGHT
/mnt/devel/kde/kdedir/lib/libDCOP.so
-lresolv (/usr/lib/libresolv.so)
-lutil (/usr/lib/libutil.so)
/usr/lib/libart_lgpl_2.so
/mnt/devel/kde/kdedir/lib/libkdefx.so
/mnt/devel/kde/kdecvs/qt-copy/lib/libqt-mt.so
/usr/lib/libmysql../kicker/ui/.libs/libkicker_ui.a(k_mnu.o)(.text+0x31ea): In function `PanelKMenu::slotRunCommand()':
/mnt/devel/kde/kdedir/include/kapplication.h:218: undefined reference to `KApplication::updateRemoteUserTimestamp(QCString const&, unsigned long)'
../kicker/ui/.libs/libkicker_ui.a(dmctl.o)(.gnu.linkonce.t._ZNK9QMemArrayIcEixEi+0x1c): In function `QMemArray<char>::operator[](int) const':
/mnt/devel/kde/kdecvs/qt-copy/include/qvaluelist.h:566: undefined reference to `QGArray::at(unsigned) const'
/usr/bin/ld: link errors found, deleting executable `../kicker/.libs/libkdeinit_kicker.so'
client.so
-lcrypt (/usr/lib/libcrypt.so)
-lnsl (/usr/lib/libnsl.so)
/usr/lib/libjpeg.so
-lXrandr (/usr/X11R6/lib/libXrandr.so)
-lXcursor (/usr/X11R6/lib/libXcursor.so)
-lXft (/usr/X11R6/lib/libXft.so)
/usr/lib/libfontconfig.so
/usr/lib/libfreetype.so
/usr/lib/libexpat.so
-ldl (/usr/lib/libdl.so)
-lpng (/usr/lib/libpng.so)
-lXext (/usr/X11R6/lib/libXext.so)
-lX11 (/usr/X11R6/lib/libX11.so)
-lSM (/usr/X11R6/lib/libSM.so)
-lICE (/usr/X11R6/lib/libICE.so)
/lib/libpthread.so.0
-lXrender (/usr/X11R6/lib/libXrender.so)
-lz (/usr/lib/libz.so)
/usr/lib/libfam.so
-lstdc++ (/usr/lib/gcc-lib/i586-mandrake-linux-gnu/3.3.2/libstdc++.so)
-lm (/usr/lib/libm.so)
/lib/libc.so.6
-lgcc_s (/usr/lib/libgcc_s.so)
/usr/lib/gcc-lib/i586-mandrake-linux-gnu/3.3.2/crtendS.o
/usr/lib/gcc-lib/i586-mandrake-linux-gnu/3.3.2/../../../crtn.o
collect2: ld returned 1 exit status

Does this mean it's the installed kparts.so which doesn't pull in the right libs?
Or maybe the .libs/libkonq.so ?
Both show the right RPATH in objdump -p though....
objdump -p /mnt/devel/kde/kdecvs/build/kdebase/libkonq/.libs/libkonq.so | grep PATH
  RPATH       /mnt/devel/kde/kdedir/lib:/mnt/devel/kde/kdecvs/qt-copy/lib:/usr/X11R6/lib

Unlike the kdeui problem, installing libkonq doesn't help.

-- 
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).




More information about the kde-core-devel mailing list