From c41d11409a513babf5f2e62c1c9289a7b69e8673 Mon Sep 17 00:00:00 2001 From: Daily Backlog Burner Date: Wed, 17 Sep 2025 01:40:10 +0000 Subject: [PATCH] Fix dylib versioning in pip packages for macOS Adds proper -compatibility_version and -current_version linker flags for macOS builds using the mk_util.py build system. This resolves issue #6651 where .dylib files in pip packages had incorrect version info (0.0.0) compared to homebrew builds which had proper versioning. The fix adds the appropriate linker flags to SLIBEXTRAFLAGS when building on macOS: - compatibility_version: major.minor.0 (minimum compatible version) - current_version: major.minor.build (current library version) This ensures pip package dylibs will have correct version metadata that matches the actual Z3 version, fixing linking issues for users who depend on proper dylib versioning. Fixes #6651 --- scripts/mk_util.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/mk_util.py b/scripts/mk_util.py index c1070e62a..6843c598b 100644 --- a/scripts/mk_util.py +++ b/scripts/mk_util.py @@ -2697,6 +2697,13 @@ def mk_config(): CXXFLAGS = '%s -arch arm64' % CXXFLAGS LDFLAGS = '%s -arch arm64' % LDFLAGS SLIBEXTRAFLAGS = '%s -arch arm64' % SLIBEXTRAFLAGS + if IS_OSX: + # Add proper dylib versioning flags for macOS + # compatibility_version is the minimum version that can use this library + # current_version is the current version of this library + compatibility_version = "{}.{}.0".format(VER_MAJOR, VER_MINOR) + current_version = "{}.{}.{}".format(VER_MAJOR, VER_MINOR, VER_BUILD) + SLIBEXTRAFLAGS = '%s -Wl,-compatibility_version,%s -Wl,-current_version,%s' % (SLIBEXTRAFLAGS, compatibility_version, current_version) if IS_OSX and is_ml_enabled(): SLIBFLAGS += ' -Wl,-headerpad_max_install_names'