--as-needed problem

Thiago Macieira thiago.macieira at kdemail.net
Thu Nov 18 14:05:52 GMT 2004


David Faure wrote:
[from the command-line:]
> -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

Notice that your command-line contains the reference 
to /usr/lib/libkdecore.so, instead of -lkdecore, which would have found 
it in -L order. I'm not sure, though, if -L overrides the system defaults 
(i.e., precedence over /usr/lib).

In any case, I've learnt from experience that building a new KDE with the 
same prefix as one that is already installed is not a good thing.

Now, having said that, --as-needed does have some side-effects, especially 
when you're doing exactly that: building to the same prefix. In those 
circumstances, the build system will add -L${prefix}/lib, which will make 
the linker find the wrong libraries. Why? Because the search order will 
be different. Also affected will be the lt-* programs, such as meinproc 
when building kdelibs.

As far as I can tell, it should not influence in the linking of libraries, 
unless paths are used in -L but not in RPATH.

But mostly I have found that libtool is to blame if the wrong libraries 
get picked up. It will sometimes store wrong library names in its .la 
files -- as well as absolute pathnames instead of -lsomething.

-- 
  Thiago Macieira  -  Registered Linux user #65028
   thiago (AT) macieira (DOT) info
    ICQ UIN: 1967141   PGP/GPG: 0x6EF45358; fingerprint:
    E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20041118/6bfe75be/attachment.sig>


More information about the kde-core-devel mailing list