Skip to content

Commit 48a0902

Browse files
SDAChesselezar
authored andcommitted
chore(build): remove bundled Z3 support
Signed-off-by: Simon Scatton <sscatton@nvidia.com>
1 parent 26f2f96 commit 48a0902

22 files changed

Lines changed: 81 additions & 482 deletions

File tree

‎.agents/skills/build-openshell-mxc-windows/SKILL.md‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ The lane targets a Windows host with Visual Studio Build Tools and rustup.
115115
| Visual C++ ARM64 tools | `vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.ARM64 -property installationPath` | Required for native ARM64 check, build, and tests and for x64-to-ARM64 check/build. Tests always require a native runner. |
116116
| Visual C++ ARM64 Spectre-mitigated libraries | `vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Runtimes.ARM64.Spectre -property installationPath` | Required by `regorus` through `msvc_spectre_libs`; the build fails when the selected MSVC toolset lacks `lib\spectre\arm64`. |
117117
| Visual C++ Clang tools | `vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Llvm.Clang -property installationPath` | Provides host-native `libclang.dll` for `bindgen` and `clang-cl.exe` for ARM64 crypto dependencies such as `aws-lc-sys`. On ARM64, the wrapper uses `VC\Tools\Llvm\Arm64\bin`. |
118-
| Visual C++ CMake tools | `vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.CMake.Project -property installationPath` | Provides CMake and Ninja for bundled Z3 and other native dependencies. The x64-to-ARM64 path adds Ninja to `PATH`; Z3 uses MSVC's Visual Studio generator. |
118+
| Visual C++ CMake tools | `vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.CMake.Project -property installationPath` | Provides CMake and Ninja for native dependencies. The x64-to-ARM64 path adds Ninja to `PATH`; Z3 uses an architecture-specific prebuilt release. |
119119
| Windows SDK | `where.exe rc.exe` from a Developer PowerShell | Install an SDK containing target libraries and ARM64 tools. |
120120
| Rust via rustup | `rustc --version` | Add each target being validated: `x86_64-pc-windows-msvc` and/or `aarch64-pc-windows-msvc`. The wrapper also adds the selected target. |
121121
| mise | `mise --version` | Used as a task runner only. |
@@ -203,8 +203,7 @@ jobs in the current mirror push run, or push a new mirrored commit. The binaries
203203
The ARM64 check/build steps in this x64-host contract are cross-builds. The
204204
wrapper discovers and adds host-native LLVM and Ninja to `PATH`, requires the
205205
ARM64 compiler and Spectre-mitigated libraries, lets ARM64 crypto crates select
206-
`clang-cl`, and builds bundled Z3 with native MSVC `cl.exe` and the Visual
207-
Studio generator.
206+
`clang-cl`, and downloads the official prebuilt ARM64 Z3 static library.
208207

209208
On ARM64 hosts, validate the native ARM64 check, build, and test path. The
210209
wrapper rejects test targets that do not match the host architecture, so x64
@@ -259,7 +258,7 @@ MXC on Windows. Each other `compute-driver-*` feature installs its own Windows
259258
rejection stub without linking that driver crate. The default
260259
`in-tree-compute-drivers` alias enables all five features. An MXC-only build
261260
uses `--no-default-features --features compute-driver-mxc` (add `telemetry`
262-
and `bundled-z3` as needed).
261+
and `openshell-server/prebuilt-z3` as needed).
263262

264263
| Driver | Windows build behavior | Runtime behavior |
265264
|---|---|---|
@@ -311,12 +310,13 @@ Useful log files:
311310
| `test-x86_64-pc-windows-msvc-unsupported-*.log` | Focused unsupported-driver contract output. |
312311
| `test-aarch64-pc-windows-msvc-unsupported-*.log` | Focused native ARM64 contract output. |
313312

314-
The first check builds bundled Z3 from source through `z3-sys`. Cargo stores the
315-
native build output in its target tree, so the Windows target cache reuses it.
316-
The resulting release executables do not require `libz3.dll`. The artifact
317-
report computes SHA256 through .NET directly and does not rely on the
318-
`Get-FileHash` module being available inside the mise-launched Windows
319-
PowerShell process.
313+
The first check downloads the pinned official Z3 archive for the target
314+
architecture through `z3-sys`. GitHub Actions authenticates the lookup with its
315+
read-only workflow token; local users can set `READ_ONLY_GITHUB_TOKEN` if an
316+
unauthenticated lookup is rate-limited. Cargo stores the extracted library in
317+
its target tree, so the Windows target cache reuses it. The artifact report
318+
computes SHA256 through .NET directly and does not rely on the `Get-FileHash`
319+
module being available inside the mise-launched Windows PowerShell process.
320320

321321
## Common Fix Patterns
322322

‎.agents/skills/build-openshell-mxc-windows/reference.md‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,11 @@ file.
6868
For ARM64, verify the Visual Studio instance contains the ARM64 MSVC tools,
6969
ARM64 Spectre-mitigated libraries, Clang tools, CMake tools, and a Windows SDK.
7070
Clang supplies host-native `libclang.dll` for `bindgen` and `clang-cl.exe` for
71-
ARM64 crypto dependencies such as `aws-lc-sys`. Native builds use the normal
72-
bundled-Z3 CMake path. An x64-to-ARM64 check/build discovers and adds
73-
host-native Ninja to `PATH`, builds bundled Z3 with native MSVC `cl.exe` and
74-
the Visual Studio generator, and lets the crypto crates select `clang-cl`. Use
75-
a short `CARGO_TARGET_DIR` if Windows path-length limits are reached.
71+
ARM64 crypto dependencies such as `aws-lc-sys`. Native and x64-to-ARM64 builds
72+
use the official prebuilt Z3 4.16.0 static library for the target architecture.
73+
An x64-to-ARM64 check/build discovers and adds host-native Ninja to `PATH`,
74+
while the crypto crates select `clang-cl`. Use a short `CARGO_TARGET_DIR` if
75+
Windows path-length limits are reached.
7676

7777
## Unsupported Driver Rules
7878

‎CONTRIBUTING.md‎

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -309,16 +309,15 @@ Project requirements:
309309
- Rust 1.94+
310310
- Python 3.11+
311311
- Docker (running)
312-
- CMake 3.16+ (only required when building with the `bundled-z3` feature)
313312

314313
### Z3 installation
315314

316315
The `openshell-prover` crate links directly against Z3. The `openshell-server`
317316
crate depends on the prover, and the `openshell-gateway` binary crate depends
318-
on `openshell-server` in turn; both forward a `bundled-z3` feature down to
319-
`openshell-prover/bundled-z3`. The `openshell-cli` crate does not depend on
320-
Z3. On macOS and Linux, install the system Z3 development package; `z3-sys`
321-
discovers it through `pkg-config`.
317+
on `openshell-server` in turn. The `openshell-cli` crate does not depend on Z3.
318+
The Nix development shell supplies Z3. For builds outside that shell on macOS
319+
and Linux, install the system Z3 development package; `z3-sys` discovers it
320+
through `pkg-config`.
322321

323322
```bash
324323
# macOS
@@ -331,18 +330,15 @@ sudo apt install libz3-dev
331330
sudo dnf install z3-devel
332331
```
333332

334-
If you prefer not to install Z3 system-wide, use the bundled Z3 feature. This
335-
compiles Z3 from source during the Rust build and requires CMake 3.16+:
336-
337-
```bash
338-
cargo build -p openshell-prover --features bundled-z3
339-
```
340-
341333
For x86-64 and ARM64 Windows MSVC builds, use one of these Z3 paths:
342334

343-
- Bundled Z3 (the default for `windows:*` tasks): `z3-sys` builds Z3 from
344-
source and links it into the OpenShell binaries. This keeps the release
345-
executables independent of `libz3.dll` when they are copied to another host.
335+
- Prebuilt Z3 (the default for `windows:*` tasks): `z3-sys` downloads the
336+
pinned Z3 4.16.0 GitHub release for the target architecture on the first
337+
build. Cargo reuses the extracted archive from its target directory. Windows
338+
CI authenticates the GitHub API request with `READ_ONLY_GITHUB_TOKEN` and
339+
preserves the archive in the architecture-specific Cargo target cache. For
340+
cold local builds, you may set `READ_ONLY_GITHUB_TOKEN` to avoid anonymous
341+
GitHub API rate limits.
346342
- System Z3: point `Z3_LIBRARY_PATH_OVERRIDE` at the directory containing the
347343
target-compatible MSVC Z3 library and `Z3_SYS_Z3_HEADER` at the full path to
348344
`z3.h`. The `windows:*` tasks use this path automatically when
@@ -353,24 +349,24 @@ For x86-64 and ARM64 Windows MSVC builds, use one of these Z3 paths:
353349
just this crate does not require `LIBCLANG_PATH`:
354350

355351
```powershell
356-
cargo build -p openshell-prover --target x86_64-pc-windows-msvc --features bundled-z3
352+
cargo build -p openshell-prover --target x86_64-pc-windows-msvc --features prebuilt-z3
357353
```
358354

359355
### Windows full build
360356

361357
To build the full set of Windows binaries, including `openshell-gateway.exe`
362358
and `openshell.exe`, use the `windows:build:x64` mise task instead of a
363-
single-crate `cargo build`. It builds Z3 from source (bundled) by default. A full
364-
build also compiles crates that use `bindgen` (e.g. the MXC driver on Windows),
365-
so it requires `libclang.dll`; if LLVM is not on the default search path, set
366-
`LIBCLANG_PATH` to the directory containing `libclang.dll`:
359+
single-crate `cargo build`. It downloads the pinned prebuilt Z3 release by
360+
default. A full build also compiles crates that use `bindgen` (e.g. the MXC
361+
driver on Windows), so it requires `libclang.dll`; if LLVM is not on the default
362+
search path, set `LIBCLANG_PATH` to the directory containing `libclang.dll`:
367363

368364
```powershell
369365
$env:LIBCLANG_PATH='C:\Program Files\Microsoft Visual Studio\2022\<Edition>\VC\Tools\Llvm\x64\bin'
370366
mise run --skip-tools windows:build:x64
371367
```
372368

373-
To use a local x64 Z3 release instead of the bundled build, set
369+
To use a local x64 Z3 release instead of the prebuilt download, set
374370
`Z3_LIBRARY_PATH_OVERRIDE` and `Z3_SYS_Z3_HEADER` before running the task:
375371

376372
```powershell

‎Cargo.lock‎

Lines changed: 0 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Cargo.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ k8s-openapi = { version = "0.24", features = ["v1_29"] }
139139
# IDs
140140
uuid = { version = "1.10", features = ["v4"] }
141141

142-
# SMT solver (uses system libz3; enable z3/bundled via the prover's bundled-z3 feature for local dev without system z3)
142+
# SMT solver (uses system libz3; Windows build tasks enable the prebuilt release feature)
143143
z3 = "0.20"
144144

145145
[workspace.lints.rust]

‎README.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,8 @@ cargo build --release -p openshell-gateway --no-default-features --features tele
283283
# Docker and VM only, with telemetry compiled out.
284284
cargo build --release -p openshell-gateway --no-default-features --features compute-driver-docker,compute-driver-vm
285285

286-
# Windows MXC only, with telemetry support and bundled Z3.
287-
cargo build --release -p openshell-gateway --no-default-features --features telemetry,compute-driver-mxc,bundled-z3
286+
# Windows MXC only, with telemetry support and prebuilt Z3.
287+
cargo build --release -p openshell-gateway --no-default-features --features telemetry,compute-driver-mxc,openshell-server/prebuilt-z3
288288
```
289289

290290
Regular builds retain their platform driver set through the default `in-tree-compute-drivers` compatibility feature. On Windows, `compute-driver-mxc` selects MXC; the other four features install unsupported-driver stubs. On other platforms, MXC is excluded.

‎architecture/build.md‎

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ already satisfies Linux distribution trust-store policy.
8282

8383
The workspace uses `z3` versions whose `z3-sys` dependency keeps downloader
8484
HTTP/TLS support behind explicit build features, so default system-Z3 builds do
85-
not reintroduce bundled Mozilla roots. Release builds that need bundled Z3
86-
continue to opt in with `bundled-z3`.
85+
not reintroduce bundled Mozilla roots. Windows builds can explicitly select the
86+
prebuilt Z3 release path.
8787

8888
## Linux Runtime Environments
8989

@@ -92,9 +92,9 @@ The standalone `openshell` CLI is built as a static musl binary so it can run on
9292
a wide range of Linux distributions without depending on the host's glibc. Host
9393
runtime binaries that use the GNU/Linux runtime environment are GNU-linked.
9494
`openshell-gateway` and `openshell-driver-vm` are built with a glibc 2.28 floor.
95-
The gateway bundles z3 into the release binary so Linux packages, standalone
96-
tarballs, and gateway images do not depend on distro-specific z3 shared-library
97-
SONAMEs.
95+
The gateway statically links the target-specific Z3 library supplied by the Nix
96+
toolchain so Linux packages, standalone tarballs, and gateway images do not
97+
depend on distro-specific Z3 shared-library SONAMEs.
9898

9999
The supervisor is the one binary whose libc is selectable, because it is the one
100100
binary executed inside a userland OpenShell does not control. `SUPERVISOR_LIBC`
@@ -138,12 +138,12 @@ otherwise fail with `ProcessFdQuotaExceeded` under macOS's default soft limit of
138138
256. The guard is a no-op on Linux and when `cargo-zigbuild` is absent. Gateway
139139
binaries use `cargo zigbuild` with GNU targets pinned to glibc 2.28, including
140140
native-architecture builds, so the gateway image, standalone tarballs, and Linux
141-
packages share the same host portability floor. The gateway build enables
142-
`bundled-z3`. Linux VM driver release artifacts use the same glibc floor so
143-
package-managed VM support does not raise the package runtime requirement.
144-
Gateway staging and release workflows set up the Zig C/C++ wrapper before
145-
bundled Z3 builds and verify the maximum referenced `GLIBC_*` symbol version
146-
before publishing or copying artifacts.
141+
packages share the same host portability floor. The gateway build links the
142+
target-specific static Z3 library from the Nix toolchain. Linux VM driver
143+
release artifacts use the same glibc floor so package-managed VM support does
144+
not raise the package runtime requirement. Gateway staging and release
145+
workflows use the target-specific C/C++ toolchain and verify the maximum
146+
referenced `GLIBC_*` symbol version before publishing or copying artifacts.
147147
Supervisor binaries are static in every configuration. The default `musl`
148148
variant uses `cargo zigbuild` when available, including native CPU
149149
architectures, so C dependencies are compiled for the musl target instead of the
@@ -217,8 +217,8 @@ Runtime layout:
217217
- **Gateway**: `gcr.io/distroless/cc-debian13:nonroot` base, GNU-linked binary at
218218
`/usr/local/bin/openshell-gateway`, runs as UID/GID `1000:1000`. Linux GNU
219219
gateway binaries must not reference `GLIBC_*` symbols newer than
220-
`GLIBC_2.28`; release workflows verify this before publishing artifacts. The
221-
gateway bundles z3, so the image does not need a distro-provided z3 runtime.
220+
`GLIBC_2.28`; release workflows verify this before publishing artifacts. Z3
221+
is statically linked, so the image does not need a distro-provided Z3 runtime.
222222
The base is pinned to a multi-architecture digest; distro security updates
223223
require refreshing that digest and rebuilding the gateway image.
224224
- **VM driver**: host GNU-linked binary installed at

‎architecture/windows-msvc-build.md‎

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -110,13 +110,15 @@ packaging-asset tests; its
110110
cross-platform Python, Markdown, license, and documentation checks still run.
111111
Test tasks require the Rust target architecture to match the Windows host, so
112112
an ARM64 test result is native coverage rather than x64 emulation coverage.
113-
By default it enables bundled Z3 for reproducible Windows builds. `z3-sys`
114-
builds Z3 from source and links it into the release binaries, so copying
115-
`openshell-gateway.exe` and `openshell.exe` does not create an undeclared
116-
`libz3.dll` runtime dependency. When `Z3_LIBRARY_PATH_OVERRIDE` points at a
117-
directory containing `libz3.lib`, the wrapper uses that system Z3 instead and
118-
requires `Z3_SYS_Z3_HEADER` to point at the full path to `z3.h`. Binaries built
119-
against a dynamic system Z3 must be deployed with the matching `libz3.dll`.
113+
By default it enables the `z3-sys` prebuilt-release feature and pins Z3 4.16.0.
114+
On a clean target directory, `z3-sys` downloads the official static library for
115+
the selected Windows architecture instead of compiling Z3 through
116+
CMake/MSBuild. GitHub Actions supplies its read-only workflow token for the
117+
release lookup, and the Cargo target cache preserves the extracted library for
118+
subsequent runs. When `Z3_LIBRARY_PATH_OVERRIDE` points at a directory
119+
containing `libz3.lib`, the wrapper uses that system Z3 instead and requires
120+
`Z3_SYS_Z3_HEADER` to point at the full path to `z3.h`. Local clean builds use
121+
the unauthenticated GitHub API unless `READ_ONLY_GITHUB_TOKEN` is set.
120122

121123
GitHub Actions layers the Cargo target cache with sccache's GitHub Actions
122124
backend. The target cache lets Cargo skip intact dependency builds; sccache
@@ -136,10 +138,10 @@ Spectre-mitigated libraries, host-native Clang tools, CMake tools, and an
136138
ARM64-capable Windows SDK. Clang provides `libclang.dll` for `bindgen` and
137139
`clang-cl.exe` for ARM64 crypto dependencies. During x64-to-ARM64 check/build,
138140
the wrapper discovers and adds the Visual Studio-bundled Ninja to `PATH` for
139-
native dependencies. Bundled Z3 uses native MSVC `cl.exe` with the Visual
140-
Studio generator, while the crypto crates select `clang-cl`. Artifact hashing
141-
uses .NET SHA256 directly because module autoloading in the mise-launched
142-
Windows PowerShell process is not guaranteed.
141+
native dependencies. Z3 uses the official prebuilt ARM64 static library, so it
142+
does not inherit compiler settings from those native dependencies. Artifact
143+
hashing uses .NET SHA256 directly because module autoloading in the
144+
mise-launched Windows PowerShell process is not guaranteed.
143145

144146
The wrapper defaults Cargo compilation to four jobs. Set
145147
`OPENSHELL_WINDOWS_BUILD_JOBS` to a positive integer to override that limit.

‎crates/openshell-gateway/Cargo.toml‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ telemetry = ["openshell-core/telemetry", "openshell-server/telemetry"]
7272
## telemetry-on build. Kept in sync with `default` by
7373
## `rust:verify:defaults-without-telemetry`.
7474
defaults-without-telemetry = ["in-tree-compute-drivers"]
75-
bundled-z3 = ["openshell-server/bundled-z3"]
7675

7776
[lints]
7877
workspace = true

‎crates/openshell-prover/Cargo.toml‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ license.workspace = true
1111
repository.workspace = true
1212

1313
[features]
14-
bundled-z3 = ["z3/bundled"]
1514
prebuilt-z3 = ["z3/gh-release"]
1615

1716
[dependencies]

0 commit comments

Comments
 (0)