3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-02-09 18:40:51 +00:00
z3/src/api/julia
copilot-swe-agent[bot] a08e8a99f9 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>
2026-02-08 03:26:13 +00:00
..
CMakeLists.txt Add -headerpad_max_install_names flag for macOS dylib builds 2026-02-08 03:26:13 +00:00
README.md C API now used by Julia. (#7387) 2024-09-24 15:17:00 +01:00
z3jl.cpp Fix 13 compiler warnings: sign-comparison and unused parameters (#8215) 2026-01-16 16:00:42 -08:00

Julia bindings

The Julia package Z3.jl provides and interface to Z3 by exposing its C API.

A previous version exposed the C++ API via CxxWrap.jl. The bindings therefore consisted of a C++ part and a Julia part. The C++ part defines the Z3 types/methods which are exposed. The resulting library is loaded in the Julia part via CxxWrap.jl which creates the corresponding Julia types/methods.

Building the C++ part

In order to build the Julia bindings the build option Z3_BUILD_JULIA_BINDINGS has to be enabled via CMake and libcxxwrap-julia has to be present. Infos about obtaining the libcxxwrap prefix can be found here.

mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release -DZ3_BUILD_JULIA_BINDINGS=True -DCMAKE_PREFIX_PATH=/path/to/libcxxwrap-julia-prefix ..
make

Julia part

The Z3 binaries are provided to Z3.jl via z3_jll.jl. That is, in order to propagate any C++ changes to the Julia side, one has to:

  1. Release a new version of Z3.
  2. Update the corresponding build script to use the new Z3 release.

Using the compiled version of Z3

The binaries are managed via the JLL package z3_jll. To use your own binaries, you need to set up an overrides file, by default at ~/.julia/artifacts/Overrides.toml with the following content:

[1bc4e1ec-7839-5212-8f2f-0d16b7bd09bc]
z3 = "/path/to/z3/build"