about summary refs log tree commit diff
path: root/src/ci/docker
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2024-04-15 09:27:34 -0700
committerAlex Crichton <alex@alexcrichton.com>2024-04-15 14:27:41 -0700
commit8bb9d30a02552cb04fe9d7f7b57ee378fbe6f246 (patch)
tree0561172a4163add08f7e4c202d4c49922c975d5f /src/ci/docker
parent023084804e5e8ea42877451c2b3030e7050281cc (diff)
downloadrust-8bb9d30a02552cb04fe9d7f7b57ee378fbe6f246.tar.gz
rust-8bb9d30a02552cb04fe9d7f7b57ee378fbe6f246.zip
Update how WASI toolchains are used in CI and bootstrap
This commit updates how the WASI targets are configured with their
toolchain. Long ago a `config.toml` option of `wasi-root` was added to
enable building with the WASI files produced by wasi-libc. Additionally
for CI testing and release building the Rust toolchain has been using a
hard-coded commit of wasi-libc which is bundled with the release of the
`wasm32-wasip1` target, for example.

Nowadays though the wasi-sdk project, the C/C++ toolchain for WASI, is
the go-to solution for compiling/linking WASI code and contains the
more-or-less official releases of wasi-libc. This commit migrates CI to
using wasi-sdk releases and additionally updates `bootstrap` to
recognize when this is configured. This means that with `$WASI_SDK_PATH`
configured there's no further configuration necessary to get a working
build. Notably this also works better for the new targets of WASI as
well, such as `wasm32-wasip2` and `wasm32-wasip1-threads` where the
wasi-sdk release now has libraries for all targets bundled within it.
Diffstat (limited to 'src/ci/docker')
-rw-r--r--src/ci/docker/host-x86_64/dist-various-2/Dockerfile11
-rwxr-xr-xsrc/ci/docker/host-x86_64/dist-various-2/build-wasi-threads-toolchain.sh24
-rwxr-xr-xsrc/ci/docker/host-x86_64/dist-various-2/build-wasi-toolchain.sh23
-rw-r--r--src/ci/docker/host-x86_64/test-various/Dockerfile11
4 files changed, 7 insertions, 62 deletions
diff --git a/src/ci/docker/host-x86_64/dist-various-2/Dockerfile b/src/ci/docker/host-x86_64/dist-various-2/Dockerfile
index 9b15bb3530b..bb6254942cb 100644
--- a/src/ci/docker/host-x86_64/dist-various-2/Dockerfile
+++ b/src/ci/docker/host-x86_64/dist-various-2/Dockerfile
@@ -85,11 +85,9 @@ RUN /tmp/build-solaris-toolchain.sh sparcv9 sparcv9 solaris-sparc sun
 COPY host-x86_64/dist-various-2/build-x86_64-fortanix-unknown-sgx-toolchain.sh /tmp/
 RUN /tmp/build-x86_64-fortanix-unknown-sgx-toolchain.sh
 
-COPY host-x86_64/dist-various-2/build-wasi-toolchain.sh /tmp/
-RUN /tmp/build-wasi-toolchain.sh
-
-COPY host-x86_64/dist-various-2/build-wasi-threads-toolchain.sh /tmp/
-RUN /tmp/build-wasi-threads-toolchain.sh
+RUN curl -L https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-22/wasi-sdk-22.0-linux.tar.gz | \
+  tar -xz
+ENV WASI_SDK_PATH=/tmp/wasi-sdk-22.0
 
 COPY scripts/freebsd-toolchain.sh /tmp/
 RUN /tmp/freebsd-toolchain.sh i686
@@ -136,9 +134,6 @@ ENV TARGETS=$TARGETS,x86_64-unknown-uefi
 RUN ln -s /usr/include/x86_64-linux-gnu/asm /usr/local/include/asm
 
 ENV RUST_CONFIGURE_ARGS --enable-extended --enable-lld --enable-llvm-bitcode-linker --disable-docs \
-  --set target.wasm32-wasi.wasi-root=/wasm32-wasip1 \
-  --set target.wasm32-wasip1.wasi-root=/wasm32-wasip1 \
-  --set target.wasm32-wasip1-threads.wasi-root=/wasm32-wasip1-threads \
   --musl-root-armv7=/musl-armv7
 
 ENV SCRIPT python3 ../x.py dist --host='' --target $TARGETS
diff --git a/src/ci/docker/host-x86_64/dist-various-2/build-wasi-threads-toolchain.sh b/src/ci/docker/host-x86_64/dist-various-2/build-wasi-threads-toolchain.sh
deleted file mode 100755
index 8f802eeaa8c..00000000000
--- a/src/ci/docker/host-x86_64/dist-various-2/build-wasi-threads-toolchain.sh
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/sh
-
-set -ex
-
-# Originally from https://github.com/llvm/llvm-project/releases/download/llvmorg-16.0.4/clang+llvm-16.0.4-x86_64-linux-gnu-ubuntu-22.04.tar.xz
-curl https://ci-mirrors.rust-lang.org/rustc/2023-05-17-clang%2Bllvm-16.0.4-x86_64-linux-gnu-ubuntu-22.04.tar.xz | \
-  tar xJf -
-bin="$PWD/clang+llvm-16.0.4-x86_64-linux-gnu-ubuntu-22.04/bin"
-
-git clone https://github.com/WebAssembly/wasi-libc
-
-cd wasi-libc
-git reset --hard ec4566beae84e54952637f0bf61bee4b4cacc087
-make -j$(nproc) \
-    CC="$bin/clang" \
-    NM="$bin/llvm-nm" \
-    AR="$bin/llvm-ar" \
-    THREAD_MODEL=posix \
-    INSTALL_DIR=/wasm32-wasip1-threads \
-    install
-
-cd ..
-rm -rf wasi-libc
-rm -rf clang+llvm*
diff --git a/src/ci/docker/host-x86_64/dist-various-2/build-wasi-toolchain.sh b/src/ci/docker/host-x86_64/dist-various-2/build-wasi-toolchain.sh
deleted file mode 100755
index a2447494078..00000000000
--- a/src/ci/docker/host-x86_64/dist-various-2/build-wasi-toolchain.sh
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/sh
-
-set -ex
-
-# Originally from https://github.com/llvm/llvm-project/releases/download/llvmorg-16.0.4/clang+llvm-16.0.4-x86_64-linux-gnu-ubuntu-22.04.tar.xz
-curl https://ci-mirrors.rust-lang.org/rustc/2023-05-17-clang%2Bllvm-16.0.4-x86_64-linux-gnu-ubuntu-22.04.tar.xz | \
-  tar xJf -
-bin="$PWD/clang+llvm-16.0.4-x86_64-linux-gnu-ubuntu-22.04/bin"
-
-git clone https://github.com/WebAssembly/wasi-libc
-
-cd wasi-libc
-git reset --hard ec4566beae84e54952637f0bf61bee4b4cacc087
-make -j$(nproc) \
-    CC="$bin/clang" \
-    NM="$bin/llvm-nm" \
-    AR="$bin/llvm-ar" \
-    INSTALL_DIR=/wasm32-wasip1 \
-    install
-
-cd ..
-rm -rf wasi-libc
-rm -rf clang+llvm*
diff --git a/src/ci/docker/host-x86_64/test-various/Dockerfile b/src/ci/docker/host-x86_64/test-various/Dockerfile
index 4de9afdb171..8875e226fd8 100644
--- a/src/ci/docker/host-x86_64/test-various/Dockerfile
+++ b/src/ci/docker/host-x86_64/test-various/Dockerfile
@@ -39,14 +39,14 @@ WORKDIR /
 COPY scripts/sccache.sh /scripts/
 RUN sh /scripts/sccache.sh
 
-COPY host-x86_64/dist-various-2/build-wasi-toolchain.sh /tmp/
-RUN /tmp/build-wasi-toolchain.sh
+RUN curl -L https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-22/wasi-sdk-22.0-linux.tar.gz | \
+  tar -xz
+ENV WASI_SDK_PATH=/wasi-sdk-22.0
 
 ENV RUST_CONFIGURE_ARGS \
   --musl-root-x86_64=/usr/local/x86_64-linux-musl \
   --set build.nodejs=/node-v18.12.0-linux-x64/bin/node \
-  --set rust.lld \
-  --set target.wasm32-wasip1.wasi-root=/wasm32-wasip1
+  --set rust.lld
 
 # Some run-make tests have assertions about code size, and enabling debug
 # assertions in libstd causes the binary to be much bigger than it would
@@ -68,9 +68,6 @@ ENV WASM_SCRIPT python3 /checkout/x.py --stage 2 test --host='' --target $WASM_T
   tests/codegen \
   tests/assembly \
   library/core
-ENV CC_wasm32_wasip1=clang-11 \
-    CFLAGS_wasm32_wasip1="--sysroot /wasm32-wasip1" \
-    AR_wasm32_wasip1=llvm-ar-11
 
 ENV NVPTX_TARGETS=nvptx64-nvidia-cuda
 ENV NVPTX_SCRIPT python3 /checkout/x.py --stage 2 test --host='' --target $NVPTX_TARGETS \