Skip to content

Commit aff432b

Browse files
authored
Rollup merge of #156258 - alexcrichton:update-some-docs, r=jieyouxu
Document wasi-sdk minimum versions for WASI targets This commit updates the documentation for WASI targets in the rustc book to mention a minimum version of wasi-sdk that's required. Closes #155971
2 parents 9c12e4b + aadf600 commit aff432b

2 files changed

Lines changed: 24 additions & 18 deletions

File tree

src/doc/rustc/src/platform-support/wasm32-wasip1.md

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,17 +70,16 @@ be used instead.
7070

7171
[`wasi-libc`]: https://github.com/WebAssembly/wasi-libc
7272

73-
## Building the target
73+
## Building the target in rustc
7474

75-
To build this target first acquire a copy of
76-
[`wasi-sdk`](https://github.com/WebAssembly/wasi-sdk/). At this time version 22
77-
is the minimum needed.
75+
To build this target first acquire a copy of [`wasi-sdk`]. At this time version
76+
33 is the minimum needed.
7877

7978
Next configure the `WASI_SDK_PATH` environment variable to point to where this
8079
is installed. For example:
8180

8281
```text
83-
export WASI_SDK_PATH=/path/to/wasi-sdk-22.0
82+
export WASI_SDK_PATH=/path/to/wasi-sdk-33.0
8483
```
8584

8685
Next be sure to enable LLD when building Rust from source as LLVM's `wasm-ld`
@@ -103,6 +102,16 @@ Rust programs can be built for that target:
103102
rustc --target wasm32-wasip1 your-code.rs
104103
```
105104

105+
The `wasm32-wasip1` toolchain comes with a self-contained sysroot meaning that
106+
no external compiler is required when building for this target. Users which
107+
build a `staticlib`, however, or use an external `-Clinker`, are recommended to
108+
use [`wasi-sdk`]. The minimum version required of [`wasi-sdk`] will change over
109+
time as it's updated in Rust and Rust relies on newer features that [`wasi-sdk`]
110+
has. See the documentation above about building the target in rustc for the
111+
minimum known working version.
112+
113+
[`wasi-sdk`]: https://github.com/WebAssembly/wasi-sdk
114+
106115
## Cross-compilation
107116

108117
This target can be cross-compiled from any hosts.

src/doc/rustc/src/platform-support/wasm32-wasip2.md

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,23 +27,20 @@ are required to support components since this target outputs a component as
2727
opposed to a core wasm module. As of the time of this writing Wasmtime 17 and
2828
above is able to run this target natively with no extra flags.
2929

30-
## Building the target
30+
## Building the target in rustc
3131

32-
To build this target first acquire a copy of
33-
[`wasi-sdk`](https://github.com/WebAssembly/wasi-sdk/). At this time version 22
34-
is the minimum needed.
32+
See the documentation for the [building the `wasm32-wasip1` target in
33+
rustc](./wasm32-wasip1.md#building-the-target-in-rustc) for more information. The tl;dr;
34+
is that [`wasi-sdk`] is required, and the `wasm32-wasip1` target documents the
35+
minimum version required.
3536

36-
Next configure the `WASI_SDK_PATH` environment variable to point to where this
37-
is installed. For example:
37+
[`wasi-sdk`]: https://github.com/WebAssembly/wasi-sdk
3838

39-
```text
40-
export WASI_SDK_PATH=/path/to/wasi-sdk-22.0
41-
```
39+
## Building Rust programs
4240

43-
Next be sure to enable LLD when building Rust from source as LLVM's `wasm-ld`
44-
driver for LLD is required when linking WebAssembly code together. Rust's build
45-
system will automatically pick up any necessary binaries and programs from
46-
`WASI_SDK_PATH`.
41+
For more information see the documentation [`wasm32-wasip1`
42+
target](./wasm32-wasip1.md#building-rust-programs). Replace `wasm32-wasip1`
43+
target strings with `wasm32-wasip2`, however.
4744

4845
## Testing
4946

0 commit comments

Comments
 (0)