ldconfig and same name libs

Manoj Ekbote manoj23@gmail.com
Tue Aug 29 18:42:00 GMT 2006


Hello,

I have different (32-bit,64-bit and n32) versions of libstdc++
installed in multiple paths.

localhost 4.1.1 # pwd
/usr/lib/gcc/mips64el-unknown-linux-gnu/4.1.1
localhost 4.1.1 # find . -name libstdc++.so.6
./32/libstdc++.so.6
./64/libstdc++.so.6
./libstdc++.so.6

The above are links to actual files.

I have added all the three paths to /etc/ld.so.conf in the following order:
/usr/lib/gcc/mips64el-unknown-linux-gnu/4.1.1       // n32
/usr/lib/gcc/mips64el-unknown-linux-gnu/4.1.1/64  // 64-bit
/usr/lib/gcc/mips64el-unknown-linux-gnu/4.1.1/32  // 32-bit

Now, when I build a 64-bit program and run ldd on it, it says
libstdc++.so.6 => not found.
But if I run ldd on a n32 program, it works.

Is this expected? Does ldconfig pick up the first occurence of
libstdc++.so.6 and since it is not the version that matches, throws an
error reporting that it is not found? Does it mean that one can't have
libraries with same name? Is rpath the right way to go?

I read somewhere that setting LD_LIBRARY_PATH is not the best solution
though it works.

Thx.



More information about the Gcc-help mailing list