LIBRARY_PATH not used before /usr/lib anymore in gcc 4.2 and later?

Wed Jun 11 12:30:00 GMT 2008

I've got different versions of the boost libraries installed on my 
system: one is installed system wide in /usr/lib64, while other versions 
are installed in /cvos/shared/apps/boost/gcc-4.[123]/1.35.0, compiled 
with the respective different versions of gcc.

When I want to use one of the custom built libraries, I set the CPATH, 
LIBRARY_PATH and LD_LIBRARY_PATH variables to the respective include 
files and libraries.

For the gcc 4.1 one, this works correctly:
$ g++ -o test test.cpp -lboost_regex
$ ldd test | grep boost => /cvos/shared/apps/boost/
gcc-4.1/1.35.0/lib/ (0x00007f2352ad1000)

And without the environment vars set, it links against the one in /usr/
lib64: => /usr/lib64/ 

However when I do exactly the same with gcc 4.2 and gcc 4.3, it always 
links against the on in /usr/lib64 and not against 
the in /cvos/shared/apps/boost/gcc-4.[23]/1.35.0/
lib, even though the LIBRARY_PATH and LD_LIBRARY_PATH variables have this 
directory set as first.

The versions used are gcc 4.1.2 20070626 (Red Hat 4.1.2-14), stock gcc 
4.2.4 and stock gcc 4.3.1.

Has this behaviour changed in gcc 4.2, or is it something RH specific 
which makes that it works with my gcc 4.1?


More information about the Gcc-help mailing list