You are not logged in.

#1 2010-02-19 08:46:38

snack
Member
From: Italy
Registered: 2009-01-13
Posts: 876

ld and standard directories

Hi, I have a strange problem with ld, I think it's an issue of standard paths. I have boost 1.41 on my Arch laptop, but at work I mount some NFS disks and write code in a network environment where boost 1.42 is installed. I link my code passing the boost 1.42 lib directory to the linker using the -L option; in particular, I use the options -L<boost 1.42 lib dir> -lboost_filesystem. It seems that the linker correctly finds libboost_filesystem.so 1.42, but then when it searches for libboost_system.so it finds version 1.41 (the one installed on my /usr/lib), since I get this error:

/usr/bin/ld: warning: libboost_system.so.1.42.0, needed by /wizard/04/mori/software/boost/lib/libboost_filesystem.so, not found (try using -rpath or -rpath-link)

It seems to me that the -L linker option just works for the library which is included in the linker invocation with -l, while other libraries are searched only in standard directories (in fact, if I add boost 1.42 lib to my LD_LIBRARY_PATH, the error vanishes). Am I right? If so, don't you think that it will be more logical and useful if ld would search all the libraries starting from the dirs specified by -L?
Many thanks

Offline

#2 2010-02-19 09:47:46

grey
Member
From: Europe
Registered: 2007-08-23
Posts: 679

Re: ld and standard directories

From the gcc manual:

-Ldir
    Add directory dir to the list of directories to be searched for -l.

means you are right.
I don't know of an alternative to LD_LIBRARY_PATH that is using gcc flags.


Good ideas do not need lots of lies told about them in order to gain public acceptance.

Offline

Board footer

Powered by FluxBB