Frederik wrote: > On Wed, 11 Jun 2008 14:55:54 +0100, Andrew Haley wrote: > >> Frederik wrote: >>> On Wed, 11 Jun 2008 13:46:45 +0100, Andrew Haley wrote: >>> >>>> What does readelf -d test say? >>> $ echo $LIBRARY_PATH >>> /cvos/shared/apps/gcc/gcc-4.2.4//lib:/cvos/shared/apps/boost/gcc-4.2/1.35.0/lib >> I'm not sure this will have any effect. > > Isn't the above necessary so that it searches for the libboost_regex.so > link in that directory, which would make it build at compile time against > libboost.so.1.35.0 in my case? (Well, that's what I expected, but it > clearly does not do that here when using gcc 4.2 or 4.3) I don't think that it will have any effect at all. >>> $ echo $LD_LIBRARY_PATH >>> /cvos/shared/apps/gcc/gcc-4.2.4//lib:/cvos/shared/apps/boost/ > gcc-4.2/1.35.0/lib:/cvos/shared/apps/sge/6.1/lib/lx26-amd64 > >> This should work, though. > >>> $ g++ -o test test.cpp -lboost_regex >> Use `gcc -v' here. Let's see what that says. OK, here's the important part. These are the directories that the linker searches first: -L/cvos/shared/apps/gcc/gcc-4.2.4//lib/../lib64 \ -L/cvos/shared/apps/gcc/gcc-4.2.4/lib/gcc/x86_64-unknown-linux-gnu/4.2.4 \ -L/cvos/shared/apps/gcc/gcc-4.2.4/lib/gcc/x86_64-unknown-linux-gnu/4.2.4/../../../../lib64 \ -L/lib/../lib64 \ -L/usr/lib/../lib64 \ -L/cvos/shared/apps/gcc/gcc-4.2.4//lib \ -L/cvos/shared/apps/boost/gcc-4.2/1.35.0/lib \ -L/cvos/shared/apps/gcc/gcc-4.2.4/lib/gcc/x86_64-unknown-linux-gnu/4.2.4/../../.. \ Only if libboost_regex is not found in one of these will ld use `LD_LIBRARY_PATH'. If you want to make sure that your libboost_regex is used, either put it in one of these directories or specify -L explicitly. Andrew.