3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-02-23 08:47:37 +00:00

Add -headerpad_max_install_names flag for macOS dylib builds

This fixes the install_name_tool issue on macOS where the tool fails
with "larger updated load commands do not fit". The linker flag
-Wl,-headerpad_max_install_names ensures sufficient header padding
in the Mach-O binary for install_name_tool to modify install names.

Changes made:
- CMake: Added flag to libz3, z3java, z3jl shared libraries on Darwin
- Python build: Changed flag from ML-only to all macOS builds
- OCaml CMake: Added flag to OCaml stublib build on APPLE

Fixes #7623 (regression in 4.15.5)

Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2026-02-08 03:26:13 +00:00 committed by Nikolaj Bjorner
parent 62bfb13ada
commit d3c388a489
5 changed files with 18 additions and 1 deletions

View file

@ -159,6 +159,9 @@ endif()
if( APPLE )
# set(ocaml_rpath "@executable_path/../libz3${so_ext}")
# Add header padding to allow install_name_tool to modify the dylib
# This fixes issues where install_name_tool fails with "larger updated load commands do not fit"
list(APPEND c_lib_deps "-ldopt" "-Wl,-headerpad_max_install_names")
elseif( UNIX )
set(ocaml_rpath "\\$ORIGIN/../libz3${so_ext}")
list(APPEND c_lib_deps "-dllpath" ${ocaml_rpath})