Suppose I have a program compiled that's linked against libc.so.6 on one system (e.g., Ubuntu x64). If I take this binary to another system that has the same libc version 6 (e.g., Fedora x64), it seems to run fine.

My question is, is it more-or-less a contract that the ABI is stable as long as the so versions are identical?


No, it's not necessary that shared libraries be ABI compatible cross-distro. I think it's a reasonable expectation, but ABI breaks happen and you can't rely on ABI compatibility blindly.

An example would be libstdc++. On Ubuntu 16.04 (with GCC 5) and CentOS 7 (with GCC 4.8), the respective sos fall on opposite sides of an ABI break. Software compiled on Ubuntu 16.04 with C++ but without _GLIBCXX_USE_CXX11_ABI set would not run on CentOS 7. They're both still libstc++.so.6. ABI breaks may also happen with bug-fix patches applied by distro maintainers, who would not usually bump the so major version numbers for bug fixes.

  • 1
    Out of interest, would this depend on the compiler alone or on the combination of compiler and Linux distribution? I.e., could this still be a problem within a single Linux distribution? – Kusalananda Apr 12 '18 at 5:43
  • 1
    @Kusalananda well, the bug-fix breaking ABI would be within the same release of the same distro, but I don't have any good examples of that handy. – muru Apr 12 '18 at 7:46
  • @muru Thank you. Just out of curiosity, is there a similar ABI rule for libc? I tried googling this but my google-fu is weak :( – wbkang Apr 12 '18 at 14:29
  • @wbkang there's the musl vs glibc problem. – muru Apr 12 '18 at 17:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.