--as-needed problem

Szombathelyi György gyurco at freemail.hu
Tue Nov 9 17:17:26 GMT 2004

2004. november 9. 13.52 dátummal Lubos Lunak ezt írta:
>  Hello,
>  there seems to be a problem with --enable-as-needed. I updated kdelibs,
> and I get the following error when building it:
> ./kdoctools/meinproc --srcdir=/home/llunak/build/src/kdelibs/kdoctools
> --check --cache ./doc/kspell/index.cache.bz2
> /home/llunak/build/src/kdelibs/doc/kspell/index.docbook
> /home/llunak/build/suse/kdelibs/kdoctools/.libs/lt-meinproc: symbol lookup
> error: /home/llunak/build/suse/kdelibs/kio/.libs/libkio.so.4: undefined
> symbol: _ZN9KIconView8takeItemEP13QIconViewItem
> Error creating ./doc/kspell/index.cache.bz2. Exit status 127.
>  That's a clean checkout and clean build, from today about 12:00 CET. Using
> --disable-as-needed with configure and relinking avoids the problem.
>  The undefined symbol above is from KIconView, i.e. libkdeui. Using ldd on
> lt-meinproc shows that e.g. libkio is used from builddir, but libkdeui is
> used from $KDEDIR/lib . Since it's been a couple of days since my last
> update, the installed libkdeui doesn't have the symbol yet.
>  Can somebody fix it please?

The problem is that libtool puts all paths to direct and indirect dependencies 
into the RPATH section of lt-meinproc, but since libkdeui is not a direct 
dependency, it's not listed in the NEEDED section.

$ objdump -p lt-meinproc (only relevant parts):

  NEEDED      libkio.so.4
  NEEDED      libkdecore.so.4
  NEEDED      libqt-mt.so.3
  NEEDED      libbz2.so.1
  NEEDED      libxslt.so.1
  NEEDED      libxml2.so.2
  NEEDED      libstdc++.so.5
  NEEDED      libc.so.6
  RPATH       /home/gyuri/cvs/kdelibs/kio/.libs:/home/gyuri/cvs/kdelibs/kdeui/.libs:/home/gyuri/cvs/kdelibs/kdesu/.libs:/home/gyuri/cvs/kdelibs/kwallet/client/.libs:/home/gyuri/cvs/kdelibs/kdecore/.libs:/home/gyuri/cvs/kdelibs/dcop/.libs:/home/gyuri/cvs/kdelibs/kdefx/.libs:/opt/kde3/lib:/usr/lib/qt-3.3/lib:/usr/X11R6/lib:/usr/lib

$ objdump -p lt-meinproc:

  NEEDED      libkdeui.so.4
  NEEDED      libkdesu.so.4
  NEEDED      libkwalletclient.so.1
  NEEDED      libkdecore.so.4
  NEEDED      libDCOP.so.4
  NEEDED      libqt-mt.so.3
  NEEDED      libX11.so.6
  NEEDED      libpthread.so.0
  NEEDED      libz.so.1
  NEEDED      libfam.so.0
  NEEDED      libstdc++.so.5
  NEEDED      libc.so.6
  NEEDED      libgcc_s.so.1
  SONAME      libkio.so.4
  RPATH       /opt/kde3/lib:/usr/lib/qt-3.3/lib:/usr/X11R6/lib

So the library path for libkdeui is picked from libkio (libkio is depend 
directly on libkdeui), which has the RPATH set to $KDEDIR/lib. But if you 
remove $KDEDIR/lib/libkio.so.4, the dynamic linker falls back to the RPATH in 
lt-meinproc, and everything will work again.
I hope this small(?) inconvenience will not end in removing the --as-needed 
patch (if you're a developer, and disturbed by this behavior you can always 
compile with --disable-as-needed), it's _very_ useful for making KDE 

Thanks for listening,

Miert fizetsz az internetert? Korlatlan, ingyenes internet hozzaferes a FreeStarttol.
Probald ki most! http://www.freestart.hu

More information about the kde-core-devel mailing list