Skip to content

Commit

Permalink
Rename usage of wasm32-wasi to wasm32-wasip1 (bytecodealliance#1634)
Browse files Browse the repository at this point in the history
* Rename usage of `wasm32-wasi` to `wasm32-wasip1`

This'll start warning on nightly soon so go ahead and get a rename in
now that stable supports this target name.

* Add wasm32-wasip1 target

* More wasi installs

* Update libdl build

* Bless some test changes, more CI tweaks
  • Loading branch information
alexcrichton committed Jun 24, 2024
1 parent a5fa1eb commit 28e96f6
Show file tree
Hide file tree
Showing 11 changed files with 324 additions and 367 deletions.
20 changes: 11 additions & 9 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ jobs:
- build: aarch64-linux
os: ubuntu-latest
target: aarch64-unknown-linux-gnu
- build: wasm32-wasi
- build: wasm32-wasip1
os: ubuntu-latest
target: wasm32-wasi
target: wasm32-wasip1
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -44,7 +44,7 @@ jobs:
- uses: bytecodealliance/wasmtime/.github/actions/binary-compatible-builds@v20.0.0
with:
name: ${{ matrix.build }}
if: matrix.build != 'wasm32-wasi'
if: matrix.build != 'wasm32-wasip1'
- run: |
echo CARGO_BUILD_TARGET=${{ matrix.target }} >> $GITHUB_ENV
rustup target add ${{ matrix.target }}
Expand Down Expand Up @@ -132,11 +132,12 @@ jobs:
submodules: true
- uses: bytecodealliance/wasmtime/.github/actions/install-rust@v20.0.0
with:
toolchain: 1.77.0
toolchain: 1.79.0
- run: rustup target add wasm32-wasip1
- run: |
curl -LO https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-21/wasi-sdk-21.0-linux.tar.gz
tar xf wasi-sdk-21.0-linux.tar.gz
export WASI_SDK_PATH=$(pwd)/wasi-sdk-21.0
curl -LO https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-22/wasi-sdk-22.0-linux.tar.gz
tar xf wasi-sdk-22.0-linux.tar.gz
export WASI_SDK_PATH=$(pwd)/wasi-sdk-22.0
cd crates/wit-component/dl && bash check.sh
wasm:
Expand All @@ -147,13 +148,14 @@ jobs:
with:
submodules: true
- uses: bytecodealliance/wasmtime/.github/actions/install-rust@v20.0.0
- run: rustup target add wasm32-wasip1
- run: |
tag=v10.0.1
curl -LO https://github.com/bytecodealliance/wasmtime/releases/download/${tag}/wasmtime-${tag}-x86_64-linux.tar.xz
tar xf wasmtime-${tag}-x86_64-linux.tar.xz
echo `pwd`/wasmtime-${tag}-x86_64-linux >> $GITHUB_PATH
echo CARGO_TARGET_WASM32_WASI_RUNNER='wasmtime run --dir . --' >> $GITHUB_ENV
echo CARGO_BUILD_TARGET='wasm32-wasi' >> $GITHUB_ENV
echo CARGO_TARGET_WASM32_WASIP1_RUNNER='wasmtime run --dir . --' >> $GITHUB_ENV
echo CARGO_BUILD_TARGET='wasm32-wasip1' >> $GITHUB_ENV
- run: |
cargo --locked test --workspace \
--exclude fuzz-stats \
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/playground.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ jobs:
- uses: cargo-bins/cargo-binstall@v1.6.9
- run: cargo binstall cargo-component -y
- run: rustup component add rustfmt # needed for cargo-component, apparently?
- run: rustup target add wasm32-wasip1
- run: npm ci
working-directory: playground
- run: npm run build
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ merged once all tests are passing. CI checks currently include:
* Code is all formatted correctly (use `cargo fmt` locally to pass this)
* Tests pass on Rust stable, beta, and Nightly.
* Tests pass on Linux, macOS, and Windows.
* This tool can be compiled to WebAssembly using the `wasm32-wasi` target.
* This tool can be compiled to WebAssembly using the `wasm32-wasip1` target.
* Fuzzers can be built.
* Various miscellaneous checks such as building the tool with various
combinations of Cargo features.
Expand Down
4 changes: 2 additions & 2 deletions ci/build-tarballs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ fmt=tar
if [ "$platform" = "x86_64-windows" ]; then
cp target/release/wasm-tools.exe tmp/$bin_pkgname
fmt=zip
elif [ "$target" = "wasm32-wasi" ]; then
cp target/wasm32-wasi/release/wasm-tools.wasm tmp/$bin_pkgname
elif [ "$target" = "wasm32-wasip1" ]; then
cp target/wasm32-wasip1/release/wasm-tools.wasm tmp/$bin_pkgname
elif [ "$target" = "" ]; then
cp target/release/wasm-tools tmp/$bin_pkgname
else
Expand Down
4 changes: 2 additions & 2 deletions crates/wit-component/dl/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

set -ex

CARGO_PROFILE_RELEASE_LTO=true RUSTFLAGS="-C relocation-model=pic" cargo build --release --target=wasm32-wasi
$WASI_SDK_PATH/bin/clang -shared -o $1 -Wl,--whole-archive ../../../target/wasm32-wasi/release/libdl.a -Wl,--no-whole-archive
CARGO_PROFILE_RELEASE_LTO=true RUSTFLAGS="-C relocation-model=pic" cargo build --release --target=wasm32-wasip1
$WASI_SDK_PATH/bin/clang -shared -o $1 -Wl,--whole-archive ../../../target/wasm32-wasip1/release/libdl.a -Wl,--no-whole-archive
cargo run --manifest-path ../../../Cargo.toml -- strip $1 -o $1
cargo run --manifest-path ../../../Cargo.toml -- strip --delete name $1 -o $1
4 changes: 2 additions & 2 deletions crates/wit-component/dl/check.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
set -ex

bash ./build.sh ../../../target/wasm32-wasi/release/tmp.so
if diff ../../../target/wasm32-wasi/release/tmp.so ../libdl.so; then
bash ./build.sh ../../../target/wasm32-wasip1/release/tmp.so
if diff ../../../target/wasm32-wasip1/release/tmp.so ../libdl.so; then
exit 0
else
echo "libdl.so is out-of-date; please run crates/wit-component/dl/build.sh to update it">&2
Expand Down
Binary file modified crates/wit-component/libdl.so
Binary file not shown.
Loading

0 comments on commit 28e96f6

Please sign in to comment.