about summary refs log tree commit diff
path: root/src/doc
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/doc
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/doc')
-rw-r--r--src/doc/rustc/src/platform-support/wasm32-wasip1.md36
-rw-r--r--src/doc/rustc/src/platform-support/wasm32-wasip2.md33
2 files changed, 49 insertions, 20 deletions
diff --git a/src/doc/rustc/src/platform-support/wasm32-wasip1.md b/src/doc/rustc/src/platform-support/wasm32-wasip1.md
index a1ca81d1fec..77efa9c3282 100644
--- a/src/doc/rustc/src/platform-support/wasm32-wasip1.md
+++ b/src/doc/rustc/src/platform-support/wasm32-wasip1.md
@@ -73,19 +73,21 @@ be used instead.
 
 ## Building the target
 
-To build this target a compiled version of [`wasi-libc`] is required to be
-present at build time. This can be installed through
-[`wasi-sdk`](https://github.com/WebAssembly/wasi-sdk) as well. This is the
-configured with:
-
-```toml
-[target.wasm32-wasip1]
-wasi-root = ".../wasi-libc/sysroot"
+To build this target first acquire a copy of
+[`wasi-sdk`](https://github.com/WebAssembly/wasi-sdk/). At this time version 22
+is the minimum needed.
+
+Next configure the `WASI_SDK_PATH` environment variable to point to where this
+is installed. For example:
+
+```text
+export WASI_SDK_PATH=/path/to/wasi-sdk-22.0
 ```
 
-Additionally users will need to enable LLD when building Rust from source as
-LLVM's `wasm-ld` driver for LLD is required when linking WebAssembly code
-together.
+Next be sure to enable LLD when building Rust from source as LLVM's `wasm-ld`
+driver for LLD is required when linking WebAssembly code together. Rust's build
+system will automatically pick up any necessary binaries and programs from
+`WASI_SDK_PATH`.
 
 ## Building Rust programs
 
@@ -112,8 +114,10 @@ This target can be cross-compiled from any hosts.
 
 ## Testing
 
-Currently the WASI target is not tested in rust-lang/rust CI. This means that
-tests in the repository are not guaranteed to pass. This is theoretically
-possibly by installing a standalone WebAssembly runtime and using it as a
-"runner" for all tests, but there are various failures that will need to be
-waded through to adjust tests to work on the WASI target.
+This target is tested in rust-lang/rust CI on all merges. A subset of tests are
+run in the `test-various` builder such as the UI tests and libcore tests. This
+can be tested locally, for example, with:
+
+```text
+./x.py test --target wasm32-wasip1 tests/ui
+```
diff --git a/src/doc/rustc/src/platform-support/wasm32-wasip2.md b/src/doc/rustc/src/platform-support/wasm32-wasip2.md
index 4466d2c0840..a385600cc22 100644
--- a/src/doc/rustc/src/platform-support/wasm32-wasip2.md
+++ b/src/doc/rustc/src/platform-support/wasm32-wasip2.md
@@ -22,9 +22,34 @@ This target is cross-compiled. The target supports `std` fully.
 
 ## Platform requirements
 
-The WebAssembly runtime should support the wasi preview 2 API set.
+The WebAssembly runtime should support the wasi preview 2 API set. Runtimes also
+are required to support components since this target outputs a component as
+opposed to a core wasm module. As of the time of this writing Wasmtime 17 and
+above is able to run this target natively with no extra flags.
 
-This target is not a stable target. This means that there are only a few engines
-which implement wasi preview 2, for example:
+## Building the target
 
-* Wasmtime - `-W component-model`
+To build this target first acquire a copy of
+[`wasi-sdk`](https://github.com/WebAssembly/wasi-sdk/). At this time version 22
+is the minimum needed.
+
+Next configure the `WASI_SDK_PATH` environment variable to point to where this
+is installed. For example:
+
+```text
+export WASI_SDK_PATH=/path/to/wasi-sdk-22.0
+```
+
+Next be sure to enable LLD when building Rust from source as LLVM's `wasm-ld`
+driver for LLD is required when linking WebAssembly code together. Rust's build
+system will automatically pick up any necessary binaries and programs from
+`WASI_SDK_PATH`.
+
+## Testing
+
+This target is not tested in CI at this time. Locally it can be tested with a
+`wasmtime` binary in `PATH` like so:
+
+```text
+./x.py test --target wasm32-wasip2 tests/ui
+```