From 2c226fc73e3ce2b87c82869eab1d07f8cc0804b1 Mon Sep 17 00:00:00 2001 From: "Jiaxiao (mossaka) Zhou" Date: Tue, 13 Jan 2026 08:10:05 +0000 Subject: [PATCH 01/12] fix: resolve CI failures for spell check and doc tests This commit fixes the following CI failures: 1. Typo "Eeach" -> "Each" in crates/containerd-shim-wasmtime/README.md 2. Typo "Bencharking" -> "Benchmarking" in docs/src/benchmarks.md 3. Lifetime elision warning in RuntimeContext trait by explicitly specifying the lifetime parameter in entrypoint() method signature These changes resolve the spell check and rustdoc build failures observed in recent PRs. Co-Authored-By: Claude Sonnet 4.5 --- crates/containerd-shim-wasm/src/sandbox/context.rs | 4 ++-- crates/containerd-shim-wasmtime/README.md | 2 +- docs/src/benchmarks.md | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/containerd-shim-wasm/src/sandbox/context.rs b/crates/containerd-shim-wasm/src/sandbox/context.rs index 623ffc2165..ef8ebfeffc 100644 --- a/crates/containerd-shim-wasm/src/sandbox/context.rs +++ b/crates/containerd-shim-wasm/src/sandbox/context.rs @@ -31,7 +31,7 @@ pub trait RuntimeContext: Send + Sync { /// "/app/app.wasm#entry" -> { source: File("/app/app.wasm"), func: "entry", name: "Some(app)", arg0: "/app/app.wasm#entry" } /// "my_module.wat" -> { source: File("my_module.wat"), func: "_start", name: "Some(my_module)", arg0: "my_module.wat" } /// "#init" -> { source: File(""), func: "init", name: None, arg0: "#init" } - fn entrypoint(&self) -> Entrypoint; + fn entrypoint(&self) -> Entrypoint<'_>; } /// The source for a WASI module / components. @@ -111,7 +111,7 @@ impl RuntimeContext for WasiContext<'_> { .unwrap_or_default() } - fn entrypoint(&self) -> Entrypoint { + fn entrypoint(&self) -> Entrypoint<'_> { let arg0 = self.args().first(); let entry_point = arg0.map(String::as_str).unwrap_or(""); diff --git a/crates/containerd-shim-wasmtime/README.md b/crates/containerd-shim-wasmtime/README.md index 626e9496f3..2e93766d38 100644 --- a/crates/containerd-shim-wasmtime/README.md +++ b/crates/containerd-shim-wasmtime/README.md @@ -27,7 +27,7 @@ upon receiving a terminate or interrupt signal in the container. This can be very useful on the Wasm-first platforms to allow instance-per-request isolation: -> Eeach Wasm instance serves only one HTTP request, and then goes away. This is fantastic for security and bug +> Each Wasm instance serves only one HTTP request, and then goes away. This is fantastic for security and bug > mitigation: the blast radius of an exploit or guest-runtime bug is only a single request, and can never see the data > from other users of the platform or even other requests by the same user. [3] diff --git a/docs/src/benchmarks.md b/docs/src/benchmarks.md index fed6085d95..1c1fa22f26 100644 --- a/docs/src/benchmarks.md +++ b/docs/src/benchmarks.md @@ -85,6 +85,6 @@ We use [benchmark-action](https://github.com/benchmark-action/github-action-benc If you want to contribute to the benchmarks, whether it's adding a new benchmark or improving the existing ones, or just want to share your ideas, please refer to the following issue: -- [Bencharking issue #97](https://github.com/containerd/runwasi/issues/97) +- [Benchmarking issue #97](https://github.com/containerd/runwasi/issues/97) Any PRs are welcome! From 5cc87c665c84c53793f36273cc3a7b0b13267b82 Mon Sep 17 00:00:00 2001 From: "Jiaxiao (mossaka) Zhou" Date: Tue, 13 Jan 2026 19:08:18 +0000 Subject: [PATCH 02/12] fix: install cross from crates.io for rustc 1.85.0 compatibility Installing cross from git causes cargo to resolve dependencies to their latest compatible versions. Some of these (like home v0.5.12+) require rustc 1.88+, which is incompatible with the project's rustc 1.85.0. Cross v0.2.5 from crates.io uses locked dependencies that support the published MSRV of rustc 1.58.1+, making it compatible with rustc 1.85.0. Co-Authored-By: Claude Sonnet 4.5 --- scripts/setup-cross.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/setup-cross.sh b/scripts/setup-cross.sh index 1990f6101a..63d095c7af 100755 --- a/scripts/setup-cross.sh +++ b/scripts/setup-cross.sh @@ -1,5 +1,8 @@ #!/bin/bash -cargo install cross --git https://github.com/cross-rs/cross +# Install cross from crates.io which has locked dependencies compatible with rustc 1.85.0 +# Installing from git causes cargo to resolve dependencies to latest versions, +# some of which (like home v0.5.12+) require rustc 1.88+ +cargo install cross --version 0.2.5 if [ ! -z "$CI" ]; then From b88cd0c49a2e9b4cc12fd31fa8d1497a0497055a Mon Sep 17 00:00:00 2001 From: "Jiaxiao (mossaka) Zhou" Date: Tue, 13 Jan 2026 22:36:31 +0000 Subject: [PATCH 03/12] fix: pin mdbook to version 0.4.52 for rustc 1.85.0 compatibility mdbook 0.5.x requires rustc 1.88+, but the project uses rustc 1.85.0. Pin mdbook to 0.4.52 (MSRV 1.82) and mdbook-mermaid to 0.16.0, which are compatible with rustc 1.85.0. Co-Authored-By: Claude Sonnet 4.5 --- .github/workflows/docs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 51d8caade1..29107e43f8 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -31,7 +31,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions-rust-lang/setup-rust-toolchain@v1 - name: install mermaid preprocessor - run: cargo install mdbook mdbook-mermaid + run: cargo install mdbook --version 0.4.52 && cargo install mdbook-mermaid --version 0.16.0 - name: Build mdbook working-directory: ./docs run: mdbook build From 41aa45df94e2f4739c17a4dd03be286b2f7458b7 Mon Sep 17 00:00:00 2001 From: "Jiaxiao (mossaka) Zhou" Date: Tue, 13 Jan 2026 23:00:53 +0000 Subject: [PATCH 04/12] fix: use cargo-binstall to install cross from pre-built binaries cargo install resolves dependencies to their latest compatible versions, which can require newer Rust versions than the project's MSRV. For example, the home crate v0.5.12+ requires rustc 1.88+, but the project uses 1.85.0. Using cargo-binstall downloads pre-built binaries for cross, avoiding dependency compilation entirely. This ensures compatibility with rustc 1.85.0. Co-Authored-By: Claude Sonnet 4.5 --- scripts/setup-cross.sh | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/scripts/setup-cross.sh b/scripts/setup-cross.sh index 63d095c7af..5b2e374d15 100755 --- a/scripts/setup-cross.sh +++ b/scripts/setup-cross.sh @@ -1,8 +1,15 @@ #!/bin/bash -# Install cross from crates.io which has locked dependencies compatible with rustc 1.85.0 -# Installing from git causes cargo to resolve dependencies to latest versions, -# some of which (like home v0.5.12+) require rustc 1.88+ -cargo install cross --version 0.2.5 +# Use cargo-binstall to install cross from pre-built binaries +# This avoids the dependency resolution issue where cargo install +# resolves dependencies to latest versions that require rustc 1.88+ + +# Install cargo-binstall if not already installed +if ! command -v cargo-binstall &> /dev/null; then + curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash +fi + +# Install cross using cargo-binstall (downloads pre-built binary) +cargo binstall cross --version 0.2.5 --no-confirm if [ ! -z "$CI" ]; then From 61a7962e6511282cd2b7847f1670d6afa26faafe Mon Sep 17 00:00:00 2001 From: "Jiaxiao (mossaka) Zhou" Date: Wed, 14 Jan 2026 18:21:00 +0000 Subject: [PATCH 05/12] fix: update Cross.toml to use proper dockerfile table format The Cross.toml was using the old string format for dockerfile paths: [target.TARGET] dockerfile = "path" This prevented cross from passing required build args like CROSS_BASE_IMAGE, CROSS_CMAKE_SYSTEM_PROCESSOR, and CROSS_SYSROOT to the Dockerfile. Updated to the proper table format: [target.TARGET.dockerfile] file = "path" This allows cross to automatically provide CROSS_BASE_IMAGE and other environment variables that the Dockerfile expects. Co-Authored-By: Claude Sonnet 4.5 --- Cross.toml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Cross.toml b/Cross.toml index 87f64e3ce9..79f385d3cd 100644 --- a/Cross.toml +++ b/Cross.toml @@ -1,14 +1,14 @@ [build] default-target = "x86_64-unknown-linux-musl" -[target.aarch64-unknown-linux-musl] -dockerfile = "cross/Dockerfile.musl" +[target.aarch64-unknown-linux-musl.dockerfile] +file = "cross/Dockerfile.musl" -[target.x86_64-unknown-linux-musl] -dockerfile = "cross/Dockerfile.musl" +[target.x86_64-unknown-linux-musl.dockerfile] +file = "cross/Dockerfile.musl" -[target.aarch64-unknown-linux-gnu] -dockerfile = "cross/Dockerfile.gnu" +[target.aarch64-unknown-linux-gnu.dockerfile] +file = "cross/Dockerfile.gnu" -[target.x86_64-unknown-linux-gnu] -dockerfile = "cross/Dockerfile.gnu" +[target.x86_64-unknown-linux-gnu.dockerfile] +file = "cross/Dockerfile.gnu" From 26b2de1035a6b38ce9fb9cea72807b531956a20d Mon Sep 17 00:00:00 2001 From: "Jiaxiao (mossaka) Zhou" Date: Wed, 14 Jan 2026 18:35:40 +0000 Subject: [PATCH 06/12] fix: explicitly pass CROSS_CMAKE_SYSTEM_PROCESSOR and CROSS_SYSROOT as build args The Dockerfile.musl expects CROSS_CMAKE_SYSTEM_PROCESSOR and CROSS_SYSROOT to be set, but cross 0.2.5 doesn't automatically provide these variables when using custom Dockerfiles. Updated Cross.toml to explicitly pass these as build-args for musl targets: - aarch64: CROSS_CMAKE_SYSTEM_PROCESSOR=aarch64, CROSS_SYSROOT=/usr/local/aarch64-linux-musl - x86_64: CROSS_CMAKE_SYSTEM_PROCESSOR=x86_64, CROSS_SYSROOT=/usr/local/x86_64-linux-musl Updated Dockerfile.musl to declare these as ARG so they can be passed in. Co-Authored-By: Claude Sonnet 4.5 --- Cross.toml | 2 ++ cross/Dockerfile.musl | 3 +++ 2 files changed, 5 insertions(+) diff --git a/Cross.toml b/Cross.toml index 79f385d3cd..331e949888 100644 --- a/Cross.toml +++ b/Cross.toml @@ -3,9 +3,11 @@ default-target = "x86_64-unknown-linux-musl" [target.aarch64-unknown-linux-musl.dockerfile] file = "cross/Dockerfile.musl" +build-args = { CROSS_CMAKE_SYSTEM_PROCESSOR = "aarch64", CROSS_SYSROOT = "/usr/local/aarch64-linux-musl" } [target.x86_64-unknown-linux-musl.dockerfile] file = "cross/Dockerfile.musl" +build-args = { CROSS_CMAKE_SYSTEM_PROCESSOR = "x86_64", CROSS_SYSROOT = "/usr/local/x86_64-linux-musl" } [target.aarch64-unknown-linux-gnu.dockerfile] file = "cross/Dockerfile.gnu" diff --git a/cross/Dockerfile.musl b/cross/Dockerfile.musl index dd6e325442..fcc5813d54 100644 --- a/cross/Dockerfile.musl +++ b/cross/Dockerfile.musl @@ -1,6 +1,9 @@ ARG CROSS_BASE_IMAGE FROM $CROSS_BASE_IMAGE +ARG CROSS_CMAKE_SYSTEM_PROCESSOR +ARG CROSS_SYSROOT + COPY --from=jorgeprendes420/apk-anywhere / / ENV MARCH=${CROSS_CMAKE_SYSTEM_PROCESSOR} RUN apk-init ${MARCH} ${CROSS_SYSROOT} From e04c4d86029f1edb2db6d3a71880401247a321c7 Mon Sep 17 00:00:00 2001 From: "Jiaxiao (mossaka) Zhou" Date: Tue, 24 Feb 2026 18:42:03 +0000 Subject: [PATCH 07/12] fix: update ring to 0.17.14 to fix VAES assembly build errors Ring 0.17.13 introduced AVX2-based VAES-CLMUL assembly for AES-GCM performance improvements, but this broke builds on systems with older GNU binutils that don't support VAES/VPCLMULQDQ instructions. Ring 0.17.14 restores compatibility with older assembler versions, fixing the "operand type mismatch for `vaesenc`" errors seen in CI for wasmedge/aarch64-linux-gnu and oci-tar-builder/x86_64-linux-gnu. Co-Authored-By: Claude Opus 4.6 (1M context) --- Cargo.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 858a94fed5..db2851c39b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3122,7 +3122,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" dependencies = [ "cfg-if 1.0.1", - "windows-targets 0.52.6", + "windows-targets 0.48.5", ] [[package]] @@ -4771,9 +4771,9 @@ dependencies = [ [[package]] name = "ring" -version = "0.17.13" +version = "0.17.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ac5d832aa16abd7d1def883a8545280c20a60f523a370aa3a9617c2b8550ee" +checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" dependencies = [ "cc", "cfg-if 1.0.1", @@ -6338,7 +6338,7 @@ version = "1.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" dependencies = [ - "cfg-if 1.0.1", + "cfg-if 0.1.10", "static_assertions", ] From 32677a44049cf196c21fc182bd53b4b8383057ed Mon Sep 17 00:00:00 2001 From: "Jiaxiao (mossaka) Zhou" Date: Tue, 24 Feb 2026 18:52:37 +0000 Subject: [PATCH 08/12] fix: install protoc from official releases in cross Docker images The cross-rs base images contain an old protoc that only supports proto2 syntax. The containerd-client crate requires proto3 support for its gRPC bindings generation. Replace the apt protobuf-compiler with protoc 25.1 downloaded from the official protobuf releases, ensuring proto3 compatibility in both GNU and musl cross-compilation Docker images. Co-Authored-By: Claude Opus 4.6 (1M context) --- cross/Dockerfile.gnu | 8 +++++++- cross/Dockerfile.musl | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/cross/Dockerfile.gnu b/cross/Dockerfile.gnu index b7d83e816c..4da2184c01 100644 --- a/cross/Dockerfile.gnu +++ b/cross/Dockerfile.gnu @@ -5,4 +5,10 @@ FROM $CROSS_BASE_IMAGE ARG CROSS_DEB_ARCH RUN dpkg --add-architecture ${CROSS_DEB_ARCH} && \ apt-get -y update && \ - apt-get install -y pkg-config protobuf-compiler libseccomp-dev:${CROSS_DEB_ARCH} libzstd-dev:${CROSS_DEB_ARCH} libssl-dev + apt-get install -y pkg-config libseccomp-dev:${CROSS_DEB_ARCH} libzstd-dev:${CROSS_DEB_ARCH} libssl-dev unzip + +# Install protoc from official releases to ensure proto3 support +# The apt protobuf-compiler may be too old in the cross base image +RUN curl -sSL https://github.com/protocolbuffers/protobuf/releases/download/v25.1/protoc-25.1-linux-x86_64.zip -o /tmp/protoc.zip && \ + unzip -o /tmp/protoc.zip -d /usr/local bin/protoc && \ + rm /tmp/protoc.zip diff --git a/cross/Dockerfile.musl b/cross/Dockerfile.musl index fcc5813d54..fa6a1d7238 100644 --- a/cross/Dockerfile.musl +++ b/cross/Dockerfile.musl @@ -28,4 +28,10 @@ rustflags = ["-Clink-arg=-lgcc"] EOF RUN apt-get -y update && \ - apt-get install -y pkg-config protobuf-compiler + apt-get install -y pkg-config unzip + +# Install protoc from official releases to ensure proto3 support +# The apt protobuf-compiler may be too old in the cross base image +RUN curl -sSL https://github.com/protocolbuffers/protobuf/releases/download/v25.1/protoc-25.1-linux-x86_64.zip -o /tmp/protoc.zip && \ + unzip -o /tmp/protoc.zip -d /usr/local bin/protoc && \ + rm /tmp/protoc.zip From f3ce2c14c54c217d7ca8a67cbfbc8d9ff622d65a Mon Sep 17 00:00:00 2001 From: "Jiaxiao (mossaka) Zhou" Date: Tue, 24 Feb 2026 18:59:30 +0000 Subject: [PATCH 09/12] fix: force reinstall cross binary to avoid stale cache The Rust cache action may clean up ~/.cargo/bin/ binaries while keeping cargo-binstall metadata. This causes cargo-binstall to report "cross is already installed" while the actual binary is missing, resulting in "cross: command not found" during builds. Add --force flag to ensure the cross binary is always present. Co-Authored-By: Claude Opus 4.6 (1M context) --- scripts/setup-cross.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/setup-cross.sh b/scripts/setup-cross.sh index 5b2e374d15..dacc4dfa38 100755 --- a/scripts/setup-cross.sh +++ b/scripts/setup-cross.sh @@ -9,7 +9,9 @@ if ! command -v cargo-binstall &> /dev/null; then fi # Install cross using cargo-binstall (downloads pre-built binary) -cargo binstall cross --version 0.2.5 --no-confirm +# Use --force to ensure the binary is actually present even if metadata +# says it's already installed (the Rust cache may have cleaned the binary) +cargo binstall cross --version 0.2.5 --no-confirm --force if [ ! -z "$CI" ]; then From da6afa79f818a80a8b09c4fb9fe7633bafc0c457 Mon Sep 17 00:00:00 2001 From: "Jiaxiao (mossaka) Zhou" Date: Tue, 24 Feb 2026 19:09:09 +0000 Subject: [PATCH 10/12] fix: install newer libclang in cross Docker images for bindgen The cross-rs 0.2.5 base images use Ubuntu 16.04 (Xenial) which ships libclang 3.8. The wamr crate uses bindgen/clang-sys which requires libclang >= 6.0 for the clang_getTranslationUnitTargetInfo function. Install libclang-9 from the LLVM apt repository in both GNU and musl cross-compilation Docker images. Co-Authored-By: Claude Opus 4.6 (1M context) --- cross/Dockerfile.gnu | 12 ++++++++++++ cross/Dockerfile.musl | 10 +++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/cross/Dockerfile.gnu b/cross/Dockerfile.gnu index 4da2184c01..8ff181890f 100644 --- a/cross/Dockerfile.gnu +++ b/cross/Dockerfile.gnu @@ -3,6 +3,18 @@ ARG CROSS_DEB_ARCH FROM $CROSS_BASE_IMAGE ARG CROSS_DEB_ARCH + +# Install newer libclang from LLVM apt repo (cross base images use Ubuntu 16.04 +# with libclang 3.8 which is too old for bindgen/clang-sys >= 6.0 requirement) +RUN apt-get -y update && \ + apt-get install -y wget gnupg software-properties-common && \ + wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - && \ + echo "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-9 main" >> /etc/apt/sources.list && \ + apt-get -y update && \ + apt-get install -y libclang-9-dev + +ENV LIBCLANG_PATH="/usr/lib/llvm-9/lib" + RUN dpkg --add-architecture ${CROSS_DEB_ARCH} && \ apt-get -y update && \ apt-get install -y pkg-config libseccomp-dev:${CROSS_DEB_ARCH} libzstd-dev:${CROSS_DEB_ARCH} libssl-dev unzip diff --git a/cross/Dockerfile.musl b/cross/Dockerfile.musl index fa6a1d7238..95c0970c7b 100644 --- a/cross/Dockerfile.musl +++ b/cross/Dockerfile.musl @@ -27,8 +27,16 @@ RUN mkdir /.cargo && cat <<'EOF' > /.cargo/config.toml rustflags = ["-Clink-arg=-lgcc"] EOF +# Install newer libclang from LLVM apt repo (cross base images use Ubuntu 16.04 +# with libclang 3.8 which is too old for bindgen/clang-sys >= 6.0 requirement) RUN apt-get -y update && \ - apt-get install -y pkg-config unzip + apt-get install -y wget gnupg software-properties-common pkg-config unzip && \ + wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - && \ + echo "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-9 main" >> /etc/apt/sources.list && \ + apt-get -y update && \ + apt-get install -y libclang-9-dev + +ENV LIBCLANG_PATH="/usr/lib/llvm-9/lib" # Install protoc from official releases to ensure proto3 support # The apt protobuf-compiler may be too old in the cross base image From 774e3cbcf04444d1623bd4fd22ac7cd0c06ee05a Mon Sep 17 00:00:00 2001 From: "Jiaxiao (mossaka) Zhou" Date: Tue, 24 Feb 2026 19:17:50 +0000 Subject: [PATCH 11/12] fix: use cross-rs :main Docker images instead of :0.2.5 The cross-rs 0.2.5 release Docker images are based on Ubuntu 16.04 (Xenial) which has outdated toolchains: - protobuf-compiler 2.6.1 (proto2 only, no proto3 support) - libclang 3.8 (too old for bindgen/clang-sys) - missing stdbool.h headers Override the base images in Cross.toml to use the :main tagged images which are based on Ubuntu 20.04+ with modern toolchains. This keeps the cross 0.2.5 binary (compatible with rustc 1.85.0) while using newer Docker images that have all required dependencies. Also simplified the Dockerfiles to use apt protobuf-compiler and libclang-dev since the :main images have modern versions. Co-Authored-By: Claude Opus 4.6 (1M context) --- Cross.toml | 6 ++++-- cross/Dockerfile.gnu | 20 +------------------- cross/Dockerfile.musl | 16 +--------------- 3 files changed, 6 insertions(+), 36 deletions(-) diff --git a/Cross.toml b/Cross.toml index 331e949888..e372176885 100644 --- a/Cross.toml +++ b/Cross.toml @@ -3,14 +3,16 @@ default-target = "x86_64-unknown-linux-musl" [target.aarch64-unknown-linux-musl.dockerfile] file = "cross/Dockerfile.musl" -build-args = { CROSS_CMAKE_SYSTEM_PROCESSOR = "aarch64", CROSS_SYSROOT = "/usr/local/aarch64-linux-musl" } +build-args = { CROSS_BASE_IMAGE = "ghcr.io/cross-rs/aarch64-unknown-linux-musl:main", CROSS_CMAKE_SYSTEM_PROCESSOR = "aarch64", CROSS_SYSROOT = "/usr/local/aarch64-linux-musl" } [target.x86_64-unknown-linux-musl.dockerfile] file = "cross/Dockerfile.musl" -build-args = { CROSS_CMAKE_SYSTEM_PROCESSOR = "x86_64", CROSS_SYSROOT = "/usr/local/x86_64-linux-musl" } +build-args = { CROSS_BASE_IMAGE = "ghcr.io/cross-rs/x86_64-unknown-linux-musl:main", CROSS_CMAKE_SYSTEM_PROCESSOR = "x86_64", CROSS_SYSROOT = "/usr/local/x86_64-linux-musl" } [target.aarch64-unknown-linux-gnu.dockerfile] file = "cross/Dockerfile.gnu" +build-args = { CROSS_BASE_IMAGE = "ghcr.io/cross-rs/aarch64-unknown-linux-gnu:main" } [target.x86_64-unknown-linux-gnu.dockerfile] file = "cross/Dockerfile.gnu" +build-args = { CROSS_BASE_IMAGE = "ghcr.io/cross-rs/x86_64-unknown-linux-gnu:main" } diff --git a/cross/Dockerfile.gnu b/cross/Dockerfile.gnu index 8ff181890f..52b6ca11a7 100644 --- a/cross/Dockerfile.gnu +++ b/cross/Dockerfile.gnu @@ -3,24 +3,6 @@ ARG CROSS_DEB_ARCH FROM $CROSS_BASE_IMAGE ARG CROSS_DEB_ARCH - -# Install newer libclang from LLVM apt repo (cross base images use Ubuntu 16.04 -# with libclang 3.8 which is too old for bindgen/clang-sys >= 6.0 requirement) -RUN apt-get -y update && \ - apt-get install -y wget gnupg software-properties-common && \ - wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - && \ - echo "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-9 main" >> /etc/apt/sources.list && \ - apt-get -y update && \ - apt-get install -y libclang-9-dev - -ENV LIBCLANG_PATH="/usr/lib/llvm-9/lib" - RUN dpkg --add-architecture ${CROSS_DEB_ARCH} && \ apt-get -y update && \ - apt-get install -y pkg-config libseccomp-dev:${CROSS_DEB_ARCH} libzstd-dev:${CROSS_DEB_ARCH} libssl-dev unzip - -# Install protoc from official releases to ensure proto3 support -# The apt protobuf-compiler may be too old in the cross base image -RUN curl -sSL https://github.com/protocolbuffers/protobuf/releases/download/v25.1/protoc-25.1-linux-x86_64.zip -o /tmp/protoc.zip && \ - unzip -o /tmp/protoc.zip -d /usr/local bin/protoc && \ - rm /tmp/protoc.zip + apt-get install -y pkg-config protobuf-compiler libseccomp-dev:${CROSS_DEB_ARCH} libzstd-dev:${CROSS_DEB_ARCH} libssl-dev libclang-dev diff --git a/cross/Dockerfile.musl b/cross/Dockerfile.musl index 95c0970c7b..f9805dd649 100644 --- a/cross/Dockerfile.musl +++ b/cross/Dockerfile.musl @@ -27,19 +27,5 @@ RUN mkdir /.cargo && cat <<'EOF' > /.cargo/config.toml rustflags = ["-Clink-arg=-lgcc"] EOF -# Install newer libclang from LLVM apt repo (cross base images use Ubuntu 16.04 -# with libclang 3.8 which is too old for bindgen/clang-sys >= 6.0 requirement) RUN apt-get -y update && \ - apt-get install -y wget gnupg software-properties-common pkg-config unzip && \ - wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - && \ - echo "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-9 main" >> /etc/apt/sources.list && \ - apt-get -y update && \ - apt-get install -y libclang-9-dev - -ENV LIBCLANG_PATH="/usr/lib/llvm-9/lib" - -# Install protoc from official releases to ensure proto3 support -# The apt protobuf-compiler may be too old in the cross base image -RUN curl -sSL https://github.com/protocolbuffers/protobuf/releases/download/v25.1/protoc-25.1-linux-x86_64.zip -o /tmp/protoc.zip && \ - unzip -o /tmp/protoc.zip -d /usr/local bin/protoc && \ - rm /tmp/protoc.zip + apt-get install -y pkg-config protobuf-compiler libclang-dev From 631427306181eb47075e580281e6f0a2fca44d19 Mon Sep 17 00:00:00 2001 From: "Jiaxiao (mossaka) Zhou" Date: Tue, 24 Feb 2026 19:25:52 +0000 Subject: [PATCH 12/12] fix: use custom BASE_IMAGE arg to override cross-rs Docker base images Cross 0.2.5 always overrides CROSS_BASE_IMAGE with its own :0.2.5 tagged image. Use a custom BASE_IMAGE build arg instead, which cross doesn't override, to use the :main tagged images (Ubuntu 20.04+). This provides modern toolchains (protoc 3.x, libclang 10+) while keeping the cross 0.2.5 binary compatible with rustc 1.85.0. Co-Authored-By: Claude Opus 4.6 (1M context) --- Cross.toml | 8 ++++---- cross/Dockerfile.gnu | 4 ++-- cross/Dockerfile.musl | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Cross.toml b/Cross.toml index e372176885..9196c2c3b1 100644 --- a/Cross.toml +++ b/Cross.toml @@ -3,16 +3,16 @@ default-target = "x86_64-unknown-linux-musl" [target.aarch64-unknown-linux-musl.dockerfile] file = "cross/Dockerfile.musl" -build-args = { CROSS_BASE_IMAGE = "ghcr.io/cross-rs/aarch64-unknown-linux-musl:main", CROSS_CMAKE_SYSTEM_PROCESSOR = "aarch64", CROSS_SYSROOT = "/usr/local/aarch64-linux-musl" } +build-args = { BASE_IMAGE = "ghcr.io/cross-rs/aarch64-unknown-linux-musl:main", CROSS_CMAKE_SYSTEM_PROCESSOR = "aarch64", CROSS_SYSROOT = "/usr/local/aarch64-linux-musl" } [target.x86_64-unknown-linux-musl.dockerfile] file = "cross/Dockerfile.musl" -build-args = { CROSS_BASE_IMAGE = "ghcr.io/cross-rs/x86_64-unknown-linux-musl:main", CROSS_CMAKE_SYSTEM_PROCESSOR = "x86_64", CROSS_SYSROOT = "/usr/local/x86_64-linux-musl" } +build-args = { BASE_IMAGE = "ghcr.io/cross-rs/x86_64-unknown-linux-musl:main", CROSS_CMAKE_SYSTEM_PROCESSOR = "x86_64", CROSS_SYSROOT = "/usr/local/x86_64-linux-musl" } [target.aarch64-unknown-linux-gnu.dockerfile] file = "cross/Dockerfile.gnu" -build-args = { CROSS_BASE_IMAGE = "ghcr.io/cross-rs/aarch64-unknown-linux-gnu:main" } +build-args = { BASE_IMAGE = "ghcr.io/cross-rs/aarch64-unknown-linux-gnu:main" } [target.x86_64-unknown-linux-gnu.dockerfile] file = "cross/Dockerfile.gnu" -build-args = { CROSS_BASE_IMAGE = "ghcr.io/cross-rs/x86_64-unknown-linux-gnu:main" } +build-args = { BASE_IMAGE = "ghcr.io/cross-rs/x86_64-unknown-linux-gnu:main" } diff --git a/cross/Dockerfile.gnu b/cross/Dockerfile.gnu index 52b6ca11a7..945344c2be 100644 --- a/cross/Dockerfile.gnu +++ b/cross/Dockerfile.gnu @@ -1,6 +1,6 @@ -ARG CROSS_BASE_IMAGE +ARG BASE_IMAGE ARG CROSS_DEB_ARCH -FROM $CROSS_BASE_IMAGE +FROM ${BASE_IMAGE} ARG CROSS_DEB_ARCH RUN dpkg --add-architecture ${CROSS_DEB_ARCH} && \ diff --git a/cross/Dockerfile.musl b/cross/Dockerfile.musl index f9805dd649..074e628d68 100644 --- a/cross/Dockerfile.musl +++ b/cross/Dockerfile.musl @@ -1,5 +1,5 @@ -ARG CROSS_BASE_IMAGE -FROM $CROSS_BASE_IMAGE +ARG BASE_IMAGE +FROM ${BASE_IMAGE} ARG CROSS_CMAKE_SYSTEM_PROCESSOR ARG CROSS_SYSROOT