Skip to content

ci(release): build macOS CLI with static bundled-z3 via zig#7

Merged
vessux merged 1 commit into
mainfrom
fix/release-macos-bundled-z3
Jun 11, 2026
Merged

ci(release): build macOS CLI with static bundled-z3 via zig#7
vessux merged 1 commit into
mainfrom
fix/release-macos-bundled-z3

Conversation

@vessux

@vessux vessux commented Jun 11, 2026

Copy link
Copy Markdown
Owner

Summary

The macOS release openshell CLI dynamically linked Homebrew's libz3.4.15.dylib (built with Z3_SYS_Z3_HEADER=/opt/homebrew/include/z3.h), so on a clean Mac with no brew z3 it failed at startup with dyld: Library not loaded: libz3.4.15.dylib. This makes the macOS bundled-z3 path match the Linux job: build z3 from source and statically link it, so the released binary is self-contained.

Related Issue

Fork-local CI fix; tracked downstream as openlock openlock-pvq (macOS mirror of the Linux openlock-1o3 static-z3 fix). No upstream NVIDIA issue.

Changes

.github/workflows/openlock-release.yml, build-macos job only:

  • brew install protobuf z3brew install protobuf (no system z3 needed)
  • Add Set up zig (0.14.1) + Configure zig C/C++ wrappers steps, mirroring the Linux job
  • Build openshell CLI: drop Z3_SYS_Z3_HEADER, add --features bundled-z3, point CC/CXX/CC_<triple>/CXX_<triple> at the zig wrappers, set CXXSTDLIB=c++, MACOSX_DEPLOYMENT_TARGET=11.0, and READ_ONLY_GITHUB_TOKEN

zig is used only as the compiler (z3 builds static); the final binary is linked by the default system linker (ld64) — zig cannot link a macOS executable. -fno-sanitize=all disables zig cc's default UBSan instrumentation whose __ubsan_handle_* symbols are otherwise unresolved at the system-link step.

Testing

Reproduced the exact recipe locally on macOS with zig 0.14.1 (the pinned CI version), cargo build --release --target aarch64-apple-darwin -p openshell-cli --features bundled-z3:

  • otool -L on the resulting binary → only system libraries (libc++, libSystem, libiconv, Security/CoreFoundation) — no z3 / Homebrew / /opt
  • Binary runs: openshell --versionopenshell 0.6.3 (rc=0); a clean load proves z3 is statically resolved

Final verification is the release run itself + a clean-Mac smoke (openlock side).

Checklist

  • Conventional commit
  • Scoped to the issue
  • No secrets
  • YAML validated; wrapper script bash-syntax checked

The macOS release CLI dynamically linked Homebrew's libz3.4.15.dylib
(Z3_SYS_Z3_HEADER=/opt/homebrew/include/z3.h), so it failed at startup on
a clean Mac with no brew z3 (dyld: Library not loaded). Mirror the Linux
job instead: build z3 from source and statically link it via
--features bundled-z3, using zig as the C/C++ compiler so the vendored z3
compiles regardless of the runner's Apple clang version.

zig only compiles z3 (built static); the final binary is linked by the
default system linker (ld64) because zig cannot link a macOS executable.
-fno-sanitize=all disables zig cc's default UBSan instrumentation, whose
__ubsan_handle_* symbols are otherwise unresolved at the system-link step.

Verified locally with zig 0.14.1 (the pinned CI version): otool -L on the
resulting binary shows only system libraries (libc++, libSystem, libiconv,
Security/CoreFoundation) -- no z3/Homebrew/opt -- and the binary runs
(openshell --version -> 0.6.3).
@vessux vessux merged commit 2ce9cf1 into main Jun 11, 2026
2 checks passed
@vessux vessux deleted the fix/release-macos-bundled-z3 branch June 11, 2026 16:15
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

Successfully merging this pull request may close these issues.

1 participant