From b7a08fde77eca340adb1ed942d8cd1f7519e332c Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 19 Nov 2025 18:38:36 -0800 Subject: [PATCH 1/2] Gate `__wasilibc_register_preopened_fd` on WASI This API is only available in WASIp1 and as the libc build for WASIp2 is changing the symbol was recently deleted. This functionality makes sense for WASIp1, but for WASIp2 it's a fundamentally different set of syscalls so this is no longer provided by libc. --- src/wasi/mod.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/wasi/mod.rs b/src/wasi/mod.rs index 7891322991ed8..ec6830594e098 100644 --- a/src/wasi/mod.rs +++ b/src/wasi/mod.rs @@ -793,6 +793,7 @@ extern "C" { timeout: *const timeval, ) -> c_int; + #[cfg(target_env = "p1")] pub fn __wasilibc_register_preopened_fd(fd: c_int, path: *const c_char) -> c_int; pub fn __wasilibc_fd_renumber(fd: c_int, newfd: c_int) -> c_int; pub fn __wasilibc_unlinkat(fd: c_int, path: *const c_char) -> c_int; From 33db7eeb34321b0beadaa5b304c5e5ecefef03d8 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 19 Nov 2025 18:58:45 -0800 Subject: [PATCH 2/2] Update wasi-sdk in CI, plus some script updates * Update to wasi-sdk-29 which is the latest * Pass `-Clink-self-contained=n` instead of `-Ctarget-feature=-crt-static` (which didn't work) to force using the external libc. --- ci/docker/wasm32-wasip1/Dockerfile | 2 +- ci/docker/wasm32-wasip2/Dockerfile | 2 +- ci/wasi.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ci/docker/wasm32-wasip1/Dockerfile b/ci/docker/wasm32-wasip1/Dockerfile index 419159a0b1380..93258ac7e4422 100644 --- a/ci/docker/wasm32-wasip1/Dockerfile +++ b/ci/docker/wasm32-wasip1/Dockerfile @@ -10,7 +10,7 @@ RUN /wasi.sh # library. ENV CARGO_TARGET_WASM32_WASIP1_RUNNER=wasmtime \ CARGO_TARGET_WASM32_WASIP1_LINKER=/opt/wasi-sdk/bin/clang \ - CARGO_TARGET_WASM32_WASIP1_RUSTFLAGS="-lwasi-emulated-process-clocks -Ctarget-feature=-crt-static" \ + CARGO_TARGET_WASM32_WASIP1_RUSTFLAGS="-Clink-self-contained=n -lwasi-emulated-process-clocks" \ CC_wasm32_wasip1=/opt/wasi-sdk/bin/clang \ CFLAGS_wasm32_wasip1=-D_WASI_EMULATED_PROCESS_CLOCKS \ PATH=$PATH:/rust/bin:/wasmtime diff --git a/ci/docker/wasm32-wasip2/Dockerfile b/ci/docker/wasm32-wasip2/Dockerfile index 8d819b36e5c15..a8da1e212333e 100644 --- a/ci/docker/wasm32-wasip2/Dockerfile +++ b/ci/docker/wasm32-wasip2/Dockerfile @@ -9,7 +9,7 @@ RUN /wasi.sh # itself, this should be fixed upstream. ENV CARGO_TARGET_WASM32_WASIP2_RUNNER=wasmtime \ CARGO_TARGET_WASM32_WASIP2_LINKER=/opt/wasi-sdk/bin/clang \ - CARGO_TARGET_WASM32_WASIP2_RUSTFLAGS="-lwasi-emulated-process-clocks -Ctarget-feature=-crt-static -Clink-arg=-Wl,--export,cabi_realloc" \ + CARGO_TARGET_WASM32_WASIP2_RUSTFLAGS="-Clink-self-contained=n -lwasi-emulated-process-clocks -Clink-arg=-Wl,--export,cabi_realloc" \ CC_wasm32_wasip2=/opt/wasi-sdk/bin/clang \ CFLAGS_wasm32_wasip2=-D_WASI_EMULATED_PROCESS_CLOCKS \ PATH=$PATH:/rust/bin:/wasmtime diff --git a/ci/wasi.sh b/ci/wasi.sh index f0d8a5245c99b..2648aa38207d7 100755 --- a/ci/wasi.sh +++ b/ci/wasi.sh @@ -12,7 +12,7 @@ apt-get install -y --no-install-recommends \ # Wasmtime is used to execute tests and wasi-sdk is used to compile tests. # Download appropriate versions here and configure various flags below. wasmtime=38.0.2 -wasi_sdk=27 +wasi_sdk=29 curl -L https://github.com/bytecodealliance/wasmtime/releases/download/v$wasmtime/wasmtime-v$wasmtime-x86_64-linux.tar.xz | tar xJf -