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./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
libboost_regex.so.1.35.0 => /cvos/shared/apps/boost/
And without the environment vars set, it links against the one in /usr/
libboost_regex.so.2 => /usr/lib64/libboost_regex.so.2
However when I do exactly the same with gcc 4.2 and gcc 4.3, it always
links against the libboost_regex.so.2 on in /usr/lib64 and not against
the libboost_regex.so.1.35.0 in /cvos/shared/apps/boost/gcc-4./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