From d9464a299a46a49bf59df6c3ed57b927b084c82e Mon Sep 17 00:00:00 2001 From: Kinflou Date: Thu, 12 Nov 2026 06:55:10 +0800 Subject: [PATCH] ci-wasm: clang, for C sources built for wasm32 (tree-sitter, psm) --- images/Dockerfile | 5 ++++- images/smoke.sh | 4 ++++ images/versions.md | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/images/Dockerfile b/images/Dockerfile index 301e8b8..34d9700 100644 --- a/images/Dockerfile +++ b/images/Dockerfile @@ -228,8 +228,11 @@ LABEL org.opencontainers.image.source="https://github.com/ComlineProject/ci-imag FROM rust-base AS wasm ARG TARGETARCH ARG RUST_STABLE +# clang: crates with C sources (tree-sitter, psm via stacker) compile that C +# for wasm32 through `cc`, and gcc cannot target wasm. core, built for wasm32 +# by language-server's analysis lib, pulls both in. RUN --mount=type=bind,source=apt-install.sh,target=/apt-install.sh \ - sh /apt-install.sh binaryen jq + sh /apt-install.sh binaryen jq clang RUN --mount=type=bind,source=arch.sh,target=/arch.sh \ --mount=type=bind,source=rustup.sh,target=/rustup.sh \ --mount=type=bind,from=dl-rustup,source=/out,target=/dl \ diff --git a/images/smoke.sh b/images/smoke.sh index d76c26c..09d949b 100755 --- a/images/smoke.sh +++ b/images/smoke.sh @@ -80,6 +80,10 @@ wasm) run wasm-opt --version command -v wasm-bindgen-test-runner wasm2es6js run jq --version + run clang --version + # What `cc` asks of clang for a crate with C sources: compile for wasm32. + printf 'int add(int a, int b) { return a + b; }\n' > /tmp/add.c + run clang --target=wasm32-unknown-unknown -O2 -c /tmp/add.c -o /tmp/add.o absent valgrind cargo-fuzz cue cbindgen gh builds "" wasm32-unknown-unknown wasm32-wasip1 ;; diff --git a/images/versions.md b/images/versions.md index 6d7abc5..d02ca17 100644 --- a/images/versions.md +++ b/images/versions.md @@ -10,7 +10,7 @@ specification. Why Debian: [`../docs/base-choice.md`](../docs/base-choice.md). |---|---|---|---| | `ci-bench` | the instruction-count benchmarks (core, runtime) | stable 1.99.1, minimal | valgrind, iai-callgrind-runner 0.16.1, python3, gh | | `ci-fuzz` | the cargo-fuzz jobs (core, runtime) | nightly-2026-11-10, minimal | cargo-fuzz 0.13.2, gh, python3 (the Observatory `report-fuzz` action) | -| `ci-wasm` | the WebAssembly build (simulator, playground), core's `ir_only` job | stable 1.99.1, minimal, `wasm32-unknown-unknown`, `wasm32-wasip1` | wasm-bindgen 0.2.127, wasm-pack 0.15.1, binaryen, jq | +| `ci-wasm` | the WebAssembly build (simulator, playground), core's `ir_only` job | stable 1.99.1, minimal, `wasm32-unknown-unknown`, `wasm32-wasip1` | wasm-bindgen 0.2.127, wasm-pack 0.15.1, binaryen, jq, clang (C sources compiled for wasm32: tree-sitter, psm) | | `ci-tools` | cue, cbindgen and the musl build (runtime, specification) | stable 1.99.1, minimal, the musl target | cue v0.17.1, cbindgen 0.29.2, musl-tools, make, jq | All four have, from the base: git, ca-certificates, zstd (for `actions/cache`),