This blog post is pretty inaccurate.
As far as I know, C ++ ABI changes were introduced with each major release of GCC (i.e. with different components of the first or second version number).
Not true. The only C ++ ABI changes introduced since GCC 3.4 were backward compatible, which means that C ++ ABI has been stable for almost nine years.
In the worst case, most major Linux distributions use GCC snapshots and / or fix their GCC versions, so itβs almost impossible to know exactly which versions of GCC you can have when distributing binary files.
The differences between the fixed versions of GCC for distributions are minor, and not a change of ABI, for example. Fedora 4.6.3 20120306 (Red Hat 4.6.3-2) is an ABI compatible with versions of FSF 4.6.x and higher, and almost certainly with any 4.6.x from any other distribution.
The GNU / Linux GCC runtime libraries use ELF character version control, so it's easy to check the character versions needed by objects and libraries, and if you have libstdc++.so that provides these characters, it will work, no matter, this is a slightly different fixed version from another version of your distribution.
but C ++ code (or any code that uses C ++ runtime support) can be linked dynamically if necessary.
This is also not true.
However, static binding to libstdc++.a is one option for you.
The reason this might not work if you dynamically load the library (using dlopen ) is because the libstdC ++ characters that it depends on may not be needed by your application when you are (statically) linked to it, therefore, these characters will not be present in your executable file. This can be solved by dynamically linking the shared library to libstdc++.so (which in any case must be done if it depends on it). ELF character substitution means that characters present in your executable file will be used by the shared library, but others not present in your executable file will be found depending on what type of libstdc++.so it refers to. If your application does not use dlopen , you do not need to worry about it.
Another option (and one that I prefer) is to deploy the new libstdc++.so next to your application and make sure that it is found before the default system libstdc++.so , which can be done by forcing the dynamic linker to look at the right, or using the environment variable $LD_LIBRARY_PATH at run time, or by setting RPATH in the executable at the time of the link. I prefer to use RPATH as it does not rely on the proper environment setting for the application to work. If you linked your application with '-Wl,-rpath,$ORIGIN' (note the single quotes to prevent the shell from expanding with the $ORIGIN extension), then the executable will have RPATH from $ORIGIN , which tells the dynamic linker to look for shared libraries in the same directory as the executable itself. If you put the new libstdc++.so in the same directory as the executable file, it will be found at runtime, the problem will be solved. (Another option is to put the executable in /some/path/bin/ and the new libstdC ++, so in /some/path/lib/ and the link with '-Wl,-rpath,$ORIGIN/../lib' or any another fixed location relative to the executable and set RPATH relative to $ORIGIN )