Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions src/doc/rustc/src/platform-support/wasm32-wasip1.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,16 @@ be used instead.

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

## Building the target
## Building the target in rustc

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.
To build this target first acquire a copy of [`wasi-sdk`]. At this time version

@jieyouxu jieyouxu May 7, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question (non-blocking): for the wasipN targets, do we just tend to want to use the latest released wasi-sdk as target baseline? Since looking at wasi-sdk's releases, 33 was just out last week, right?

View changes since the review

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given the relative age of the wasip1 and WASI and wasi-libc/wasi-sdk, personally I would say, yeah, Rust should be tracking the latest. This is something that'll highly likely change over time, but for the time being the goal is to have upgrades in wasi-sdk be relatively easy and to continue to have the freedom to push things forward while we still can on the WASI side. Eventually I think there'll be strong reasons to be more conservative, but my hope is we can postpone that for awhile...

33 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
export WASI_SDK_PATH=/path/to/wasi-sdk-33.0
```

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

The `wasm32-wasip1` toolchain comes with a self-contained sysroot meaning that
no external compiler is required when building for this target. Users which
build a `staticlib`, however, or use an external `-Clinker`, are recommended to
use [`wasi-sdk`]. The minimum version required of [`wasi-sdk`] will change over
time as it's updated in Rust and Rust relies on newer features that [`wasi-sdk`]
has. See the documentation above about building the target in rustc for the
minimum known working version.

[`wasi-sdk`]: https://github.com/WebAssembly/wasi-sdk

## Cross-compilation

This target can be cross-compiled from any hosts.
Expand Down
23 changes: 10 additions & 13 deletions src/doc/rustc/src/platform-support/wasm32-wasip2.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,20 @@ 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.

## Building the target
## Building the target in rustc

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.
See the documentation for the [building the `wasm32-wasip1` target in
rustc](./wasm32-wasip1.md#building-the-target-in-rustc) for more information. The tl;dr;
is that [`wasi-sdk`] is required, and the `wasm32-wasip1` target documents the
minimum version required.

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

```text
export WASI_SDK_PATH=/path/to/wasi-sdk-22.0
```
## Building Rust programs

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`.
For more information see the documentation [`wasm32-wasip1`
target](./wasm32-wasip1.md#building-rust-programs). Replace `wasm32-wasip1`
target strings with `wasm32-wasip2`, however.

## Testing

Expand Down
Loading