Skip to content

Commit 69bf6db

Browse files
committed
fix(docker): provide z3 for CLI-building Dockerfiles
The openshell-prover crate depends on z3. For Linux-targeted builds (python-wheels), install libz3-dev to link against the system library. For macOS cross-compilation (python-wheels-macos, cli-macos), compile z3 from source via the bundled-z3 feature since system libz3-dev only provides a Linux .so, not a macOS .dylib. Add a bundled-z3 forwarding feature to openshell-cli so both cargo and maturin can activate it uniformly.
1 parent 4916e57 commit 69bf6db

4 files changed

Lines changed: 7 additions & 4 deletions

File tree

‎crates/openshell-cli/Cargo.toml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ tracing-subscriber = { workspace = true }
7676
workspace = true
7777

7878
[features]
79+
bundled-z3 = ["openshell-prover/bundled-z3"]
7980
dev-settings = ["openshell-core/dev-settings"]
8081

8182
[dev-dependencies]

‎deploy/docker/Dockerfile.cli-macos‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ RUN mkdir -p crates/openshell-cli/src \
8888
RUN --mount=type=cache,id=cargo-registry-cli-macos,sharing=locked,target=/root/.cargo/registry \
8989
--mount=type=cache,id=cargo-git-cli-macos,sharing=locked,target=/root/.cargo/git \
9090
--mount=type=cache,id=cargo-target-cli-macos-${CARGO_TARGET_CACHE_SCOPE},sharing=locked,target=/build/target \
91-
cargo build --release --target aarch64-apple-darwin -p openshell-cli 2>/dev/null || true
91+
cargo build --release --target aarch64-apple-darwin -p openshell-cli --features bundled-z3 2>/dev/null || true
9292

9393
# ---------------------------------------------------------------------------
9494
# Stage 2: real build
@@ -116,7 +116,7 @@ RUN --mount=type=cache,id=cargo-registry-cli-macos,sharing=locked,target=/root/.
116116
if [ -n "${OPENSHELL_CARGO_VERSION:-}" ]; then \
117117
sed -i -E '/^\[workspace\.package\]/,/^\[/{s/^version[[:space:]]*=[[:space:]]*".*"/version = "'"${OPENSHELL_CARGO_VERSION}"'"/}' Cargo.toml; \
118118
fi && \
119-
cargo build --release --target aarch64-apple-darwin -p openshell-cli && \
119+
cargo build --release --target aarch64-apple-darwin -p openshell-cli --features bundled-z3 && \
120120
cp target/aarch64-apple-darwin/release/openshell /openshell
121121

122122
FROM scratch AS binary

‎deploy/docker/Dockerfile.python-wheels‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
1515
curl \
1616
gcc \
1717
libc6-dev \
18+
libz3-dev \
1819
pkg-config \
1920
libssl-dev \
2021
&& rm -rf /var/lib/apt/lists/*

‎deploy/docker/Dockerfile.python-wheels-macos‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
2323
build-essential \
2424
ca-certificates \
2525
clang \
26+
cmake \
2627
curl \
2728
libssl-dev \
2829
pkg-config \
@@ -78,7 +79,7 @@ RUN mkdir -p crates/openshell-cli/src crates/openshell-core/src crates/openshell
7879
RUN --mount=type=cache,id=cargo-registry-python-wheels-macos-${TARGETARCH},sharing=locked,target=/root/.cargo/registry \
7980
--mount=type=cache,id=cargo-git-python-wheels-macos-${TARGETARCH},sharing=locked,target=/root/.cargo/git \
8081
--mount=type=cache,id=cargo-target-python-wheels-macos-${TARGETARCH}-${CARGO_TARGET_CACHE_SCOPE},sharing=locked,target=/build/target \
81-
cargo build --release --target aarch64-apple-darwin -p openshell-cli 2>/dev/null || true
82+
cargo build --release --target aarch64-apple-darwin -p openshell-cli --features bundled-z3 2>/dev/null || true
8283

8384
# Copy actual source code and Python packaging files.
8485
COPY crates/ crates/
@@ -109,7 +110,7 @@ RUN --mount=type=cache,id=cargo-registry-python-wheels-macos-${TARGETARCH},shari
109110
if [ -n "${OPENSHELL_CARGO_VERSION:-}" ]; then \
110111
sed -i -E '/^\[workspace\.package\]/,/^\[/{s/^version[[:space:]]*=[[:space:]]*".*"/version = "'"${OPENSHELL_CARGO_VERSION}"'"/}' Cargo.toml; \
111112
fi && \
112-
maturin build --release --target aarch64-apple-darwin --out /wheels
113+
maturin build --release --target aarch64-apple-darwin --features bundled-z3 --out /wheels
113114

114115
FROM scratch AS wheels
115116
COPY --from=builder /wheels/*.whl /

0 commit comments

Comments
 (0)