C++ – How do I get libraries to work with Linux packaging?

How do I get libraries to work with Linux packaging?… here is a solution to the problem.

How do I get libraries to work with Linux packaging?

I am the author of a C++ library that is distributed across multiple Linux packaging distributions.
The library includes titles and source code; Linux packages distribute it as a header + shared library (.so).

I’m looking for a guide that can make life easier for Linux package maintainers.

Things I’m interested in include:

  • API compatibility (such as changing function signatures). Obviously, it is crucial to maintain compatibility with minor versions. What about major version changes?

  • Binary compatibility (for example, changing the size of externally visible data structures). How important is ABI compatibility across minor versions? Is there anything wrong with breaking it in the major version?

  • Build versioning recommendations. I’m currently using CMake – what specific settings should I set to maximize the chances that package maintainers can just use my CMakeLists.txt?

If there’s anything else I’m missing, I’d love to hear it too.


As a Linux maintainer, I can say that the backward binary (ABI) and source code (API) compatibility of your libraries is very important to us.

API changes may break rebuilds of some applications (or other libraries) in distributions that depend on your libraries. This could break a massive rebuild of the distribution.

ABI changes may break specific binary updates. We need to verify the ABI changes in the update repository and rebuild all dependent applications if some dangerous changes are detected. In this case, the user should download the update package for the library and all related applications. If the library is lagging with an API and ABI stable, then we can just update the library package.

IF YOU BREAK THE ABI, THEN CHANGE THE SONAME (BUMP VERSION) OF YOUR LIBRARY. And please do not introduce API/ABI changes in micro/patch releases.

I recommend that you use abi-compliance-checker tool for verifying the API/ABI backward compatibility of your library. Check out a sample report for the Qt library tool: http://abi-laboratory.pro/tracker/timeline/qt/

You need to compile the debug version of your library with the additional –g -og option and dump your library with the help of abi-dumper. Two ABI dumps of different versions are then compared to generate an ABI change report.

enter image description here

Related Problems and Solutions