[CMake] Re: FIND_PATH / FIND_LIBRARY order

Bill Hoffman bill.hoffman at kitware.com
Wed Jun 13 17:31:55 EDT 2007


Matthew Woehlke wrote:
> Bill Hoffman wrote:
>> I guess my take is that most system tools like ld and such don't even 
>> know about /usr/local/lib, so
>> why should cmake search there first?
>
> I guess that's true if "most" is measured by number of OS's, counting 
> e.g. Linux, Solaris, etc as one each. If "most" means Linux, then this 
> is just plain wrong.
>
> With LD_LIBRARY_PATH unset, ldd on my Linux system reports (as an 
> example):
> libfontconfig.so.1 => /usr/local/lib/libfontconfig.so.1
> ...which overrides /usr/lib/libfontconfig.so.1
>
> On Linux, /usr/local takes precedence over /usr unless LD_LIBRARY_PATH 
> is used to *prevent* that behavior.
>
What linux is that?

On this one:
Linux Turbine 2.6.15-26-amd64-k8 #1 SMP PREEMPT Thu Aug 3 03:11:38 UTC 
2006 x86_64 GNU/Linux

If I copy a .so to /usr/local/lib
cp /lib/libc.so.6 /usr/local/lib/

ldd still finds it in /lib
angel at Turbine:~/BullseyeCoverage-7.7.11$ ldd /usr/bin/zsoelim
        libc.so.6 => /lib/libc.so.6 (0x00002aaaaabc2000)
        /lib64/ld-linux-x86-64.so.2 (0x00002aaaaaaab000)
Now I set LD_LIBRARY_PATH
angel at Turbine:~/BullseyeCoverage-7.7.11$ export 
LD_LIBRARY_PATH=/usr/local/lib
Now it finds the copy:
angel at Turbine:~/BullseyeCoverage-7.7.11$ ldd /usr/bin/zsoelim
        libc.so.6 => /usr/local/lib/libc.so.6 (0x00002aaaaabc2000)
        /lib64/ld-linux-x86-64.so.2 (0x00002aaaaaaab000)
angel at Turbine:~/BullseyeCoverage-7.7.11$

This is a stock ubuntu Linux box.  I think you have added /usr/local/lib 
to ld.conf on your system.

-Bill




More information about the CMake mailing list