How to link different versions of the same library in g ++?

I am trying to figure out how to load two different versions of libstdc ++, therefore on a SLES10 machine. My client has a Foo process that is built with GCC 4.1.2 and therefore uses libstdc ++ 6.0.8. We are also creating a shared library called libBar.so. This library will dynamically load Foo at runtime. libBar.so compiled using GCC 4.3.6 and libstdC ++ version 6.0.10.

Currently, when I try to load Foo libBar.so, I get the following error.

error: unable to load shared object '/usr/lib64/libBar.so': / usr / lib 64 / libstdc ++. so.6: version of `GLIBCXX_3.4.9 'not found (requires / usr / lib64 / libBar.so)

At the moment, the only way to make this work is to change the library loading order (via ld.so.conf) so that Foo and libbar.so load the same (6.0.10) libstdC ++. So. However, this is not a vialbe solution, as it requires a change in the client system.

What I would like to do is Foo to load its version of libstdC ++, therefore libBar.so also refers to its own version of libstdC ++, so I can’t figure out how to write my Makefile for this to happen, that’s what I still have , for my LIBADD line in Makefile.am ...

libBar_la_LIBADD = .. / .. / vendor / SLES10 / lib / libstdC ++. so.6.0.10

Which I would suggest would like a SPECIFIC version of libstdC ++. However, when I run ldd against the fully compiled and linked libBar.so, this is the line I see ...

libstdc ++. so.6 => /usr/lib64/libstdc++.so.6 (0x00002aaaaeac5000)

libstd++. so.6.0.10? ?

+4
1

, libstdc++.

, libstdc++. , libstdc++. :

ld --relocatable -o lib3rd-party-prelinked.so lib3rd-party.so /usr/lib64/libstdc++.a.6

lib3rd-party-prelinked.so lib3rd-party.so. ( --relocatable man ld).

, C API, ++.

++ , ABI libstdc++, . . std::list<> ABI , std::list<> ABI. , undefined .

+6

Source: https://habr.com/ru/post/1526976/


All Articles