Search code examples
c++linuxgccgnubackwards-compatibility

gcc and libstdc++ forward compatibility


According to the ABI Policy and Guidelines is it true I should use

GCC 3.4.0 and libstdc++.so.6.0.0

to compile the binary executable runnable on every GNU/Linux distributions (same CPU architecture) with any newer libstd++.so.6 installed? Does this binary will be forward compatible with every libstd++.so.6?


Solution

  • (Why not ask this question on the gcc-help mailing list so you get an authoritative answer from people who know what they're talking about?)

    Yes, linking against libstdc++.so.6.0.0 would mean the binary could run when linked to any later libstdc++.so version, but that's not sufficient to ensure the binary can run on any GNU/Linux system. You also need to ensure you use an older version of libc.so (i.e.glibc) and any other libs you link against. Compiling and linking with GCC 3.4.0 but linking against Glibc 2.15 could mean your binary cannot run on systems with Glibc 2.14 or older, no matter what libstdc++ version they have.