Link with an older version of libstdc++

You don't need to link to a different library, you need to use an older version of the compiler.

Have a look at the GNU ABI policy. The libstdc++ shared library is designed to be forward compatible. I.e. version 6.0.10 can be used if you need 6.0.8. In the policy you can read that from gcc-4.2.0 on, 6.0.9 is needed, so you need a gcc-4.1.x.

In short, that's why there's only one libstdc++.so.6.0.x on your system, you only need the latest.

As for setting up your build system to use only a specific version of the compiler: make sure the standard g++ can't be used (rename the link, remove the package providing it, take it out of PATH), and start digging. Worked for me.


You can ship the required shared libraries with your own code (in a subdirectory for instance) and set LD_LIBRARY_PATH, as a precursor to running your application, to first search in that directory.

Shipping the specific version that you need will mean that it won't matter which version the user has installed. You just have to make sure you ship all dependencies as well.

Tags:

Linux

C++

Linker