2

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?

1 Answer 1

3

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.

4
  • 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? Commented Apr 12, 2018 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. Commented Apr 12, 2018 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 :( Commented Apr 12, 2018 at 14:29
  • @wbkang there's the musl vs glibc problem. Commented Apr 12, 2018 at 17:56

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.