Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmake build decreases the compatibility_version of the shared libraries vs autotools build #130

Open
nieder opened this issue Mar 20, 2022 · 4 comments

Comments

@nieder
Copy link

nieder commented Mar 20, 2022

On macOS, the old autotools release (tested with 0.13.62) creates the library libzzip-0.13.dylib with a compatibility_version of 14.0.0. But the cmake build (tested with 0.13.72) has a compatibility_version of 13.0.0. This means that anything linked against 0.13.62 will fail if zziplib is upgraded to 0.13.72 because the compat_version decreased.

Setting MACHO_COMPATIBILITY_VERSION to 14.0.0 will fix this (or higher if new interfaces have been added between 0.13.62 and 0.13.72). This change does not affect the install_name (SOVERSION) of the library. And if the install_name for the libraries is ever increased, you can remove setting MACHO_COMPATIBILITY_VERSION because then SOVERSION will take precedence and it will a new one that autotools never saw.

https://cmake.org/cmake/help/git-stage/prop_tgt/MACHO_COMPATIBILITY_VERSION.html

Sample code change in zzip/CMakeLists.txt (but needs to be done for the 4 libraries)

 set_target_properties(libzzip PROPERTIES OUTPUT_NAME "zzip" RELEASE_POSTFIX "-${RELNUM}")
-SET_TARGET_PROPERTIES(libzzip PROPERTIES VERSION ${VERNUM}.${FIXNUM} SOVERSION ${VERNUM})
+SET_TARGET_PROPERTIES(libzzip PROPERTIES VERSION ${VERNUM}.${FIXNUM} SOVERSION ${VERNUM} MACHO_COMPATIBILITY_VERSION 14.0.0)
@gdraheim
Copy link
Owner

gdraheim commented Sep 8, 2022

I am a bit hesitant as the feature was introduced in cmake 3.17 and that's the version that I have installed as latest on my system. Pretty new? I don't know about the current cmake support in the common distros around. May be that needs an ifelse() somehow ... and I am not sure if a liberal value is the way to go here. I will keep this patch open so that people are informed how to fix the mac issue if needed.

@nieder
Copy link
Author

nieder commented Sep 10, 2022

Latest upstream is 3.24.1. Don't know which distro is still carrying 3.17 (Debian stable is 3.18.4; Ubuntu Jammy is at 3.22), and 3.17 seems to have come out in 2020).
This issue has been common when switching from autotools (libtool really) versioning to cmake versioning. Once the SOVERSION gets bumped in zziplib, then this will be moot.

@nieder
Copy link
Author

nieder commented Jan 15, 2023

To patch this locally, have any interfaces been added, removed, or changed between zziplib 0.13.62 and 0.13.72? This will help me figure out which way I should change MACHO_COMPATIBILITY_VERSION. Thanks.

@ryandesign
Copy link

Please finally fix this two-year-old issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants