Commit b7033a8
Chance Zibolski
·
2026-08-05 01:02:05 -0400 EDT
parent bdea415
build: fetch the zig tarball for the host arch
The Dockerfile hardcoded the x86_64 tarball, so on an arm64 host the
image ran under emulation and `zig build` died before compiling anything:
error: rosetta error: bss_size overflow
That made `zmx run build`, `test`, `fmt`, and `integration` from pico.sh
unusable on Apple silicon.
`uname -m` already reports the names zig uses (x86_64, aarch64), so
substituting it needs no mapping table. Unknown arches now fail with
their own name rather than a 404 from ziglang.org.
Also drop `-v` from tar, which printed a line per extracted file, and
remove the tarball after extracting it.
1 files changed,
+12,
-4
+12,
-4
| ... | ... | @@ -3,11 +3,19 @@ FROM debian:12 | |
| 3 | 3 | RUN apt-get update && apt-get install -y curl git bats coreutils && rm -rf /var/lib/apt/lists/* | |
| 4 | 4 | ||
| 5 | 5 | ARG ZIG_VERSION=0.16.0 | |
| 6 | - | RUN curl -L -o /tmp/zig.tar.xz https://ziglang.org/download/${ZIG_VERSION}/zig-x86_64-linux-${ZIG_VERSION}.tar.xz && \ | |
| 6 | + | # `uname -m` already reports the names zig uses in its tarballs (x86_64, | |
| 7 | + | # aarch64), so it needs no mapping. | |
| 8 | + | RUN ARCH="$(uname -m)" && \ | |
| 9 | + | case "$ARCH" in \ | |
| 10 | + | x86_64|aarch64) ;; \ | |
| 11 | + | *) echo "unsupported arch: $ARCH" >&2; exit 1 ;; \ | |
| 12 | + | esac && \ | |
| 13 | + | curl -L -o /tmp/zig.tar.xz https://ziglang.org/download/${ZIG_VERSION}/zig-${ARCH}-linux-${ZIG_VERSION}.tar.xz && \ | |
| 7 | 14 | cd /tmp && \ | |
| 8 | - | tar -xvf zig.tar.xz && \ | |
| 9 | - | mv zig-x86_64-linux-${ZIG_VERSION} /usr/local/zig && \ | |
| 10 | - | ln -s /usr/local/zig/zig /usr/local/bin/zig | |
| 15 | + | tar -xf zig.tar.xz && \ | |
| 16 | + | mv zig-${ARCH}-linux-${ZIG_VERSION} /usr/local/zig && \ | |
| 17 | + | ln -s /usr/local/zig/zig /usr/local/bin/zig && \ | |
| 18 | + | rm -f /tmp/zig.tar.xz | |
| 11 | 19 | ||
| 12 | 20 | ENV PATH=/usr/local/zig:$PATH | |
| 13 | 21 |