A simple question - is there any way to make the g++
linker to link with a specific libstdc++
library version? I didn't find anything useful in the man page of gcc
/g++
, neither in other questions here.
Here's the situation - my application uses a specific shared library, that's built with libstdc++.so.5
and I want to install and use it on RHEL5
. So, when I try to build the application on a RHEL5
machine, I got the warning:
warning: libstdc++.so.5, needed by ..the_shared_library_.. may conflict with libstdc++.so.6
Installing a compat-libstdc++
rpm didn't help, the program crashes on a destructor of std::string
, because of the incapability. So, on this RHEL5
machine I have this:
[root@xxx]# ll /usr/lib/libstd*
-rwxr-xr-x 1 root root 259532 Aug 21 2006 /usr/lib/libstdc++-3-libc6.2-2-2.10.0.so
lrwxrwxrwx 1 root root 31 Jul 28 19:35 /usr/lib/libstdc++-libc6.2-2.so.3 -> libstdc++-3-libc6.2-2-2.10.0.so
lrwxrwxrwx 1 root root 18 Aug 24 15:08 /usr/lib/libstdc++.so.5 -> libstdc++.so.5.0.7
-rwxr-xr-x 1 root root 733456 Aug 21 2006 /usr/lib/libstdc++.so.5.0.7
and when I make
[root@xxxx]# ldd my_exe
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00333000)
...
libstdc++.so.5 => /usr/lib/libstdc++.so.5 (0x00ddf000)
which is bad, as I know it's undefined behavior :/
So, is there any way to build my executable using only libstdc++.so.5
? (removing libstdc++.so.6
is not an option because of many reasons. Static linking is not an option, too ).
Thanks a lot!