z3-staticlib is a Python package that carries Z3 native development artifacts:
- Z3 C and C++ headers, including
z3.handz3++.h. - A PIC static Z3 library:
libz3.aon Unix-like platforms or*.libon Windows. - Z3 CMake package files under
static/lib/cmake/z3. - Z3 pkg-config metadata under
static/lib/pkgconfigwhen available.
It does not publish Z3 Python bindings. The Python package exists so build systems can locate the native static library and headers.
python -m pip install build
STATICLIB_Z3_TAG=z3-4.16.0 python -m build --wheelFor local staging without building a wheel:
rm -rf build/local-package build/local-z3
STATICLIB_Z3_TAG=z3-4.16.0 \
STATICLIB_Z3_PACKAGE_DIR="$PWD/build/local-package/z3_staticlib" \
STATICLIB_Z3_BUILD_ROOT="$PWD/build/local-z3" \
uv run --no-project \
--with packaging \
--with cmake \
--with ninja \
python scripts/z3_staticlib_builder.pyrepo="$PWD"
tmpdir="$(mktemp -d)"
(
cd "$tmpdir"
PYTHONPATH="$repo/build/local-package" \
python "$repo/scripts/smoke_test_staticlib.py"
)
rm -rf "$tmpdir"The smoke test imports z3_staticlib, locates the packaged CMake prefix, builds
a tiny C++ executable, includes z3++.h, and links against z3::libz3.
Run the Publish Z3 static wheels workflow manually with publish=false first.
After the dry run succeeds, rerun it with publish=true.