Are shared library ABI compatible as long as their versions are the same?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite
1












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?







share|improve this question
























    up vote
    0
    down vote

    favorite
    1












    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?







    share|improve this question






















      up vote
      0
      down vote

      favorite
      1









      up vote
      0
      down vote

      favorite
      1






      1





      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?







      share|improve this question












      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?









      share|improve this question











      share|improve this question




      share|improve this question










      asked Apr 12 at 1:31









      wbkang

      1032




      1032




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          2
          down vote



          accepted










          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.






          share|improve this answer
















          • 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 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 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 at 14:29










          • @wbkang there's the musl vs glibc problem.
            – muru
            Apr 12 at 17:56










          Your Answer







          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "106"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: false,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );








           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f437174%2fare-shared-library-abi-compatible-as-long-as-their-versions-are-the-same%23new-answer', 'question_page');

          );

          Post as a guest






























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          2
          down vote



          accepted










          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.






          share|improve this answer
















          • 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 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 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 at 14:29










          • @wbkang there's the musl vs glibc problem.
            – muru
            Apr 12 at 17:56














          up vote
          2
          down vote



          accepted










          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.






          share|improve this answer
















          • 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 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 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 at 14:29










          • @wbkang there's the musl vs glibc problem.
            – muru
            Apr 12 at 17:56












          up vote
          2
          down vote



          accepted







          up vote
          2
          down vote



          accepted






          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.






          share|improve this answer












          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.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Apr 12 at 2:33









          muru

          33.3k576140




          33.3k576140







          • 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 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 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 at 14:29










          • @wbkang there's the musl vs glibc problem.
            – muru
            Apr 12 at 17:56












          • 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 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 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 at 14:29










          • @wbkang there's the musl vs glibc problem.
            – muru
            Apr 12 at 17:56







          1




          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 at 5:43





          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 at 5:43





          1




          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 at 7:46




          @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 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 at 14:29




          @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 at 14:29












          @wbkang there's the musl vs glibc problem.
          – muru
          Apr 12 at 17:56




          @wbkang there's the musl vs glibc problem.
          – muru
          Apr 12 at 17:56












           

          draft saved


          draft discarded


























           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f437174%2fare-shared-library-abi-compatible-as-long-as-their-versions-are-the-same%23new-answer', 'question_page');

          );

          Post as a guest













































































          Popular posts from this blog

          Peggy Mitchell

          Palaiologos

          The Forum (Inglewood, California)