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

Re: -L not working properly?



On Sat, 2002-06-15 at 20:06, Jason E. Stewart wrote:
> 
> I'm running an up-to-date sid on my pismo, and in the last month I've
> started getting strange behavior when compiling code that uses dynamic
> libraries that I have multiple copies of (devo versions and stable
> versions).
> 
> I've got link lines like:
> 
> g++ -DLINUX -fpic  -L/usr/lib -L/usr/local/lib \
>  [bunch of .o files]
>  /home/jasons/work/xml-xerces/c/bin/DOMPrint
>  -L/home/jasons/work/xml-xerces/c/lib -lxerces-c -lc 
> 
> but I get a bunch of link errors because the linker is actually using
> the libxerces-c.so in /usr/lib and not the one in
> /home/jasons/work/xml-xerces/c/lib
> 
> by hard-coding the exact path to the library it worked fine.
> 
> This also happened to a CPAN module I downloaded and compiled, which
> required a completely different library.
> 
> I thought the order of -L flags was 'last seen, first used'? What
> would make the linker not use that order?

>From info ld:

       -Lsearchdir
       --library-path=searchdir
           Add path searchdir to the list of paths that  ld  will
           search  for  archive libraries and ld control scripts.
           You may use this option  any  number  of  times.   The
           directories  are  searched  in the order in which they
           are specified on the command line.  Directories speci­
           fied  on  the  command  line  are  searched before the
           default directories. [...]

So it seems -L/usr/lib is not only redundant but harmful here.


-- 
Earthling Michel Dänzer (MrCooper)/ Debian GNU/Linux (powerpc) developer
XFree86 and DRI project member   /  CS student, Free Software enthusiast


--
To UNSUBSCRIBE, email to debian-powerpc-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org



Reply to: