Skip to content

Commit 403f320

Browse files
alabulei1juntao
andauthored
Update the new rust compiler target for wasm (#263)
* Update the new rust compiler target for wasm Signed-off-by: alabulei1 <[email protected]> * Update simd.md Signed-off-by: Michael Yuan <[email protected]> Signed-off-by: Michael Yuan <[email protected]> --------- Signed-off-by: Michael Yuan <[email protected]> Co-authored-by: Michael Yuan <[email protected]>
1 parent 6a6339d commit 403f320

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+292
-292
lines changed

docs/contribute/source/os/android/cli.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -74,17 +74,17 @@ git clone https://github.com/second-state/wasm-learning.git
7474
cd wasm-learning/rust/birds_v1
7575
```
7676

77-
Use the `cargo` command to build a WASM bytecode file from the Rust source code. The WASM file is located at `target/wasm32-wasi/release/birds_v1.wasm`.
77+
Use the `cargo` command to build a WASM bytecode file from the Rust source code. The WASM file is located at `target/wasm32-wasip1/release/birds_v1.wasm`.
7878

7979
```bash
80-
rustup target add wasm32-wasi
81-
cargo build --release --target=wasm32-wasi
80+
rustup target add wasm32-wasip1
81+
cargo build --release --target=wasm32-wasip1
8282
```
8383

8484
Push the WASM bytecode file, tensorflow lite model file, and the test bird picture file onto the Android device using `adb`.
8585

8686
```bash
87-
adb push target/wasm32-wasi/release/birds_v1.wasm /data/local/tmp/WasmEdge-tensorflow-tools
87+
adb push target/wasm32-wasip1/release/birds_v1.wasm /data/local/tmp/WasmEdge-tensorflow-tools
8888
adb push lite-model_aiy_vision_classifier_birds_V1_3.tflite /data/local/tmp/WasmEdge-tensorflow-tools
8989
adb push bird.jpg /data/local/tmp/WasmEdge-tensorflow-tools
9090
```

docs/develop/c/simd.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ sidebar_position: 4
66

77
[128-bit packed Single Instruction Multiple Data (SIMD)](https://webassembly.github.io/simd/core/syntax/instructions.html#simd-instructions) instructions provide simultaneous computations over packed data in just one instruction. It's commonly used to improve performance for multimedia applications. With the SIMD proposal, the modules can benefit from using these commonly used instructions in modern hardware to gain more speedup.
88

9-
If you are interested in enabling the SIMD proposal will improve how much performance of the applications, please refer to our [wasm32-wasi benchmark](https://github.com/second-state/wasm32-wasi-benchmark) for more information. The Mandelbrot Set application can have a **2.65x** speedup in our benchmark.
9+
If you are interested in enabling the SIMD proposal will improve how much performance of the applications, please refer to our [wasm32-wasip1 benchmark](https://github.com/second-state/wasm32-wasi-benchmark) for more information. The Mandelbrot Set application can have a **2.65x** speedup in our benchmark.
1010

11-
We modified the Mandelbrot Set example from our [wasm32-wasi benchmark project](https://github.com/second-state/wasm32-wasi-benchmark/blob/master/src/mandelbrot.c). We will use this as an example in this article.
11+
We modified the Mandelbrot Set example from our [wasm32-wasip1 benchmark project](https://github.com/second-state/wasm32-wasi-benchmark/blob/master/src/mandelbrot.c). We will use this as an example in this article.
1212

1313
## Prerequisites
1414

docs/develop/javascript/hello_world.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,15 @@ git clone https://github.com/second-state/wasmedge-quickjs
7676
cd wasmedge-quickjs
7777

7878
# Build the QuickJS JavaScript interpreter
79-
cargo build --target wasm32-wasi --release
79+
cargo build --target wasm32-wasip1 --release
8080
```
8181

8282
The WebAssembly-based JavaScript interpreter program is located in the build `target` directory.
8383

8484
WasmEdge provides a `wasmedgec` utility to compile and add a native machine code section to the `wasm` file. You can use `wasmedge` to run the natively instrumented `wasm` file to get a much faster performance.
8585

8686
```bash
87-
wasmedge compile target/wasm32-wasi/release/wasmedge_quickjs.wasm wasmedge_quickjs.wasm
87+
wasmedge compile target/wasm32-wasip1/release/wasmedge_quickjs.wasm wasmedge_quickjs.wasm
8888
wasmedge --dir .:. wasmedge_quickjs.wasm example_js/hello.js
8989
```
9090

docs/develop/javascript/rust.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ The examples are in the `examples/embed_js` folder in the `wasmedge-quickjs` rep
2222

2323
```bash
2424
cd examples/embed_js
25-
cargo build --target wasm32-wasi --release
26-
wasmedge --dir .:. target/wasm32-wasi/release/embed_js.wasm
25+
cargo build --target wasm32-wasip1 --release
26+
wasmedge --dir .:. target/wasm32-wasip1/release/embed_js.wasm
2727
```
2828

2929
## Code explanation: embed JavaScript into a Rust program
@@ -191,8 +191,8 @@ The project is in the [examples/embed_rust_module](https://github.com/second-sta
191191

192192
```bash
193193
cd examples/embed_rust_module
194-
cargo build --target wasm32-wasi --release
195-
wasmedge --dir .:. target/wasm32-wasi/release/embed_rust_module.wasm
194+
cargo build --target wasm32-wasip1 --release
195+
wasmedge --dir .:. target/wasm32-wasip1/release/embed_rust_module.wasm
196196
```
197197

198198
### Code explanation

docs/develop/javascript/tensorflow.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -103,13 +103,13 @@ git clone https://github.com/second-state/wasmedge-quickjs
103103
cd wasmedge-quickjs
104104

105105
# Build the QuickJS JavaScript interpreter with WASI NN
106-
cargo build --target wasm32-wasi --release --features=wasi_nn
106+
cargo build --target wasm32-wasip1 --release --features=wasi_nn
107107
```
108108

109109
The WebAssembly-based JavaScript interpreter program is located in the build `target` directory.
110110

111111
WasmEdge provides a `wasmedge compile` utility to compile and add a native machine code section to the wasm file. You can use wasmedge to run the natively instrumented wasm file to get much faster performance.
112112

113113
```bash
114-
wasmedge compile target/wasm32-wasi/release/wasmedge_quickjs.wasm wasmedge_quickjs_nn.wasm
114+
wasmedge compile target/wasm32-wasip1/release/wasmedge_quickjs.wasm wasmedge_quickjs_nn.wasm
115115
```

docs/develop/python/hello_world.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -8,34 +8,34 @@ Several different language implementations of the Python runtime exist, and some
88

99
## Compile RustPython
1010

11-
To compile RustPython, you should install the Rust toolchain on your machine. And `wasm32-wasi` platform support should be enabled.
11+
To compile RustPython, you should install the Rust toolchain on your machine. And `wasm32-wasip1` platform support should be enabled.
1212

1313
```bash
14-
rustup target add wasm32-wasi
14+
rustup target add wasm32-wasip1
1515
```
1616

1717
Then you could use the following command to clone and compile RustPython:
1818

1919
```bash
2020
git clone https://github.com/RustPython/RustPython.git
2121
cd RustPython
22-
cargo build --release --target wasm32-wasi --features="freeze-stdlib"
22+
cargo build --release --target wasm32-wasip1 --features="freeze-stdlib"
2323
```
2424

25-
`freeze-stdlib` feature is enabled for including Python standard library inside the binary file. The output file should be at `target/wasm32-wasi/release/rustpython.wasm`.
25+
`freeze-stdlib` feature is enabled for including Python standard library inside the binary file. The output file should be at `target/wasm32-wasip1/release/rustpython.wasm`.
2626

2727
## AOT Compile
2828

2929
WasmEdge supports compiling WebAssembly bytecode programs into native machine code for better performance. It is highly recommended to compile the RustPython to native machine code before running.
3030

3131
```bash
32-
wasmedge compile ./target/wasm32-wasi/release/rustpython.wasm ./target/wasm32-wasi/release/rustpython.wasm
32+
wasmedge compile ./target/wasm32-wasip1/release/rustpython.wasm ./target/wasm32-wasip1/release/rustpython.wasm
3333
```
3434

3535
## Run
3636

3737
```bash
38-
wasmedge ./target/wasm32-wasi/release/rustpython.wasm
38+
wasmedge ./target/wasm32-wasip1/release/rustpython.wasm
3939
```
4040

4141
Then you could get a Python shell in WebAssembly!
@@ -45,5 +45,5 @@ Then you could get a Python shell in WebAssembly!
4545
You can pre-open directories to let WASI programs have permission to read and write files stored on the real machine. The following command mounted the current working directory to the WASI virtual file system.
4646

4747
```bash
48-
wasmedge --dir .:. ./target/wasm32-wasi/release/rustpython.wasm
48+
wasmedge --dir .:. ./target/wasm32-wasip1/release/rustpython.wasm
4949
```

docs/develop/rust/dapr.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ Build.
5959

6060
```bash
6161
cd image-api-grayscale
62-
cargo build --target wasm32-wasi --release
63-
wasmedgec ./target/wasm32-wasi/release/image-api-grayscale.wasm image-api-grayscale.wasm
62+
cargo build --target wasm32-wasip1 --release
63+
wasmedgec ./target/wasm32-wasip1/release/image-api-grayscale.wasm image-api-grayscale.wasm
6464
```
6565

6666
Deploy.
@@ -81,8 +81,8 @@ Build.
8181

8282
```bash
8383
cd image-api-classify
84-
cargo build --target wasm32-wasi --release
85-
wasmedgec target/wasm32-wasi/release/wasmedge_hyper_server_tflite.wasm wasmedge_hyper_server_tflite.wasm
84+
cargo build --target wasm32-wasip1 --release
85+
wasmedgec target/wasm32-wasip1/release/wasmedge_hyper_server_tflite.wasm wasmedge_hyper_server_tflite.wasm
8686
```
8787

8888
Deploy.
@@ -103,8 +103,8 @@ Build.
103103

104104
```bash
105105
cd events-service
106-
cargo build --target wasm32-wasi --release
107-
wasmedgec target/wasm32-wasi/release/events_service.wasm events_service.wasm
106+
cargo build --target wasm32-wasip1 --release
107+
wasmedgec target/wasm32-wasip1/release/events_service.wasm events_service.wasm
108108
```
109109

110110
Deploy.

docs/develop/rust/database/my_sql_driver.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ git clone https://github.com/WasmEdge/wasmedge-db-examples
2121
cd wasmedge-db-examples/mysql_async
2222

2323
# Compile the rust code into WASM
24-
RUSTFLAGS="--cfg wasmedge --cfg tokio_unstable" cargo build --target wasm32-wasi --release
24+
RUSTFLAGS="--cfg wasmedge --cfg tokio_unstable" cargo build --target wasm32-wasip1 --release
2525

2626
# Execute MySQL statements against a MySQL database at mysql://user:[email protected]:3306
27-
wasmedge --env "DATABASE_URL=mysql://user:[email protected]:3306/mysql" target/wasm32-wasi/release/crud.wasm
27+
wasmedge --env "DATABASE_URL=mysql://user:[email protected]:3306/mysql" target/wasm32-wasip1/release/crud.wasm
2828
```
2929

3030
<!-- prettier-ignore -->

docs/develop/rust/database/postgres_driver.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ git clone https://github.com/WasmEdge/wasmedge-db-examples
2121
cd wasmedge-db-examples/postgres
2222

2323
# Compile the rust code into WASM
24-
RUSTFLAGS="--cfg wasmedge --cfg tokio_unstable" cargo build --target wasm32-wasi --release
24+
RUSTFLAGS="--cfg wasmedge --cfg tokio_unstable" cargo build --target wasm32-wasip1 --release
2525

2626
# Execute SQL statements against a PostgreSQL database at postgres://user:passwd@localhost/testdb
27-
wasmedge --env "DATABASE_URL=postgres://user:passwd@localhost/testdb" target/wasm32-wasi/release/crud.wasm
27+
wasmedge --env "DATABASE_URL=postgres://user:passwd@localhost/testdb" target/wasm32-wasip1/release/crud.wasm
2828
```
2929

3030
## Configuration

docs/develop/rust/database/qdrant_driver.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ git clone https://github.com/WasmEdge/wasmedge-db-examples
2323
cd wasmedge-db-examples/qdrant
2424

2525
# Compile the rust code into WASM
26-
RUSTFLAGS="--cfg wasmedge --cfg tokio_unstable" cargo build --target wasm32-wasi --release
26+
RUSTFLAGS="--cfg wasmedge --cfg tokio_unstable" cargo build --target wasm32-wasip1 --release
2727

2828
# Perform vector data operations against a Qdrant at http://localhost:6333
29-
wasmedge target/wasm32-wasi/release/qdrant_examples.wasm
29+
wasmedge target/wasm32-wasip1/release/qdrant_examples.wasm
3030
```
3131

3232
## Configuration

docs/develop/rust/database/redis_driver.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ git clone https://github.com/WasmEdge/wasmedge-db-examples
2121
cd wasmedge-db-examples/redis
2222

2323
# Compile the rust code into WASM
24-
RUSTFLAGS="--cfg wasmedge --cfg tokio_unstable" cargo build --target wasm32-wasi --release
24+
RUSTFLAGS="--cfg wasmedge --cfg tokio_unstable" cargo build --target wasm32-wasip1 --release
2525

2626
# Execute Redis command against a Redis instance at redis://localhost/
27-
wasmedge --env "REDIS_URL=redis://localhost/" target/wasm32-wasi/release/wasmedge-redis-client-examples.wasm
27+
wasmedge --env "REDIS_URL=redis://localhost/" target/wasm32-wasip1/release/wasmedge-redis-client-examples.wasm
2828
```
2929

3030
## Configuration

docs/develop/rust/hello_world.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ fn main() {
2020
Build the WASM bytecode:
2121

2222
```bash
23-
cargo build --target wasm32-wasi --release
23+
cargo build --target wasm32-wasip1 --release
2424
```
2525

2626
We will use the `wasmedge` command to run the program.
2727

2828
```bash
29-
wasmedge target/wasm32-wasi/release/hello.wasm
29+
wasmedge target/wasm32-wasip1/release/hello.wasm
3030
```
3131

3232
## A simple function
@@ -47,15 +47,15 @@ pub fn add(a: i32, b: i32) -> i32 {
4747
### Build the WASM bytecode
4848

4949
```bash
50-
cargo build --target wasm32-wasi --release
50+
cargo build --target wasm32-wasip1 --release
5151
```
5252

5353
### Run the application from command line
5454

5555
We will use `wasmedge` in reactor mode to run the program. We pass the function name and its input parameters as command line arguments.
5656

5757
```bash
58-
wasmedge --reactor target/wasm32-wasi/release/add.wasm add 2 2
58+
wasmedge --reactor target/wasm32-wasip1/release/add.wasm add 2 2
5959
```
6060

6161
## Pass parameters with complex data types

docs/develop/rust/http_service/client.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ git clone https://github.com/WasmEdge/wasmedge_reqwest_demo
3131
cd wasmedge_reqwest_demo
3232

3333
# Build the Rust code
34-
RUSTFLAGS="--cfg wasmedge --cfg tokio_unstable" cargo build --target wasm32-wasi --release
34+
RUSTFLAGS="--cfg wasmedge --cfg tokio_unstable" cargo build --target wasm32-wasip1 --release
3535
# Use the AoT compiler to get better performance
36-
wasmedge compile target/wasm32-wasi/release/http.wasm http.wasm
37-
wasmedge compile target/wasm32-wasi/release/https.wasm https.wasm
36+
wasmedge compile target/wasm32-wasip1/release/http.wasm http.wasm
37+
wasmedge compile target/wasm32-wasip1/release/https.wasm https.wasm
3838

3939
# Run the HTTP GET and POST examples
4040
wasmedge http.wasm
@@ -102,9 +102,9 @@ git clone https://github.com/WasmEdge/wasmedge_hyper_demo
102102
cd wasmedge_hyper_demo/client
103103

104104
# Build the Rust code
105-
RUSTFLAGS="--cfg wasmedge --cfg tokio_unstable" cargo build --target wasm32-wasi --release
105+
RUSTFLAGS="--cfg wasmedge --cfg tokio_unstable" cargo build --target wasm32-wasip1 --release
106106
# Use the AoT compiler to get better performance
107-
wasmedge compile target/wasm32-wasi/release/wasmedge_hyper_client.wasm wasmedge_hyper_client.wasm
107+
wasmedge compile target/wasm32-wasip1/release/wasmedge_hyper_client.wasm wasmedge_hyper_client.wasm
108108

109109
# Run the example
110110
wasmedge wasmedge_hyper_client.wasm
@@ -130,8 +130,8 @@ The HTTPS version of the demo is as follows.
130130
```bash
131131
// Build
132132
cd wasmedge_hyper_demo/client-https
133-
RUSTFLAGS="--cfg wasmedge --cfg tokio_unstable" cargo build --target wasm32-wasi --release
134-
wasmedge compile target/wasm32-wasi/release/wasmedge_hyper_client_https.wasm wasmedge_hyper_client_https.wasm
133+
RUSTFLAGS="--cfg wasmedge --cfg tokio_unstable" cargo build --target wasm32-wasip1 --release
134+
wasmedge compile target/wasm32-wasip1/release/wasmedge_hyper_client_https.wasm wasmedge_hyper_client_https.wasm
135135

136136
// Run
137137
wasmedge wasmedge_hyper_client_https.wasm

docs/develop/rust/http_service/server.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ git clone https://github.com/WasmEdge/wasmedge_hyper_demo
2727
cd wasmedge_hyper_demo/server-axum
2828

2929
# Build the Rust code
30-
RUSTFLAGS="--cfg wasmedge --cfg tokio_unstable" cargo build --target wasm32-wasi --release
30+
RUSTFLAGS="--cfg wasmedge --cfg tokio_unstable" cargo build --target wasm32-wasip1 --release
3131
# Use the AoT compiler for better performance
32-
wasmedge compile target/wasm32-wasi/release/wasmedge_axum_server.wasm wasmedge_axum_server.wasm
32+
wasmedge compile target/wasm32-wasip1/release/wasmedge_axum_server.wasm wasmedge_axum_server.wasm
3333

3434
# Run the example
3535
wasmedge wasmedge_axum_server.wasm
@@ -103,9 +103,9 @@ git clone https://github.com/WasmEdge/wasmedge_hyper_demo
103103
cd wasmedge_hyper_demo/server
104104

105105
# Build the Rust code
106-
RUSTFLAGS="--cfg wasmedge --cfg tokio_unstable" cargo build --target wasm32-wasi --release
106+
RUSTFLAGS="--cfg wasmedge --cfg tokio_unstable" cargo build --target wasm32-wasip1 --release
107107
# Use the AoT compiler to get better performance
108-
wasmedge compile target/wasm32-wasi/release/wasmedge_hyper_server.wasm wasmedge_hyper_server.wasm
108+
wasmedge compile target/wasm32-wasip1/release/wasmedge_hyper_server.wasm wasmedge_hyper_server.wasm
109109

110110
# Run the example
111111
wasmedge wasmedge_hyper_server.wasm

docs/develop/rust/os.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ sidebar_position: 3
44

55
# Access OS services
66

7-
The WASI (WebAssembly Systems Interface) standard is designed to allow WebAssembly applications to access operating system services. The `wasm32-wasi` target in the Rust compiler supports WASI. This section will use [an example project](https://github.com/second-state/rust-examples/tree/main/wasi) to show how to use Rust standard APIs to access operating system services.
7+
The WASI (WebAssembly Systems Interface) standard is designed to allow WebAssembly applications to access operating system services. The `wasm32-wasip1` target in the Rust compiler supports WASI. This section will use [an example project](https://github.com/second-state/rust-examples/tree/main/wasi) to show how to use Rust standard APIs to access operating system services.
88

99
<!-- prettier-ignore -->
1010
:::note
@@ -13,7 +13,7 @@ Before we start, ensure [you have Rust and WasmEdge installed](setup.md).
1313

1414
## Random numbers
1515

16-
The WebAssembly VM is a pure software construct. It does not have a hardware entropy source for random numbers. That's why WASI defines a function for WebAssembly programs to call its host operating system to get a random seed. As a Rust developer, you only need to use the popular (de facto standard) `rand` and/or `getrandom` crates. With the `wasm32-wasi` compiler backend, these crates generate the correct WASI calls in the WebAssembly bytecode. The `Cargo.toml` dependencies are as follows.
16+
The WebAssembly VM is a pure software construct. It does not have a hardware entropy source for random numbers. That's why WASI defines a function for WebAssembly programs to call its host operating system to get a random seed. As a Rust developer, you only need to use the popular (de facto standard) `rand` and/or `getrandom` crates. With the `wasm32-wasip1` compiler backend, these crates generate the correct WASI calls in the WebAssembly bytecode. The `Cargo.toml` dependencies are as follows.
1717

1818
```toml
1919
[dependencies]
@@ -117,13 +117,13 @@ fn main() {
117117
Use the command below to compile [the Rust project](https://github.com/second-state/rust-examples/blob/main/wasi/).
118118

119119
```bash
120-
cargo build --target wasm32-wasi --release
120+
cargo build --target wasm32-wasip1 --release
121121
```
122122

123123
To run it in `wasmedge`, do the following. The `--dir` option maps the current directory of the command shell to the file system's current directory inside the WebAssembly app.
124124

125125
```bash
126-
$ wasmedge --dir .:. target/wasm32-wasi/release/wasi.wasm
126+
$ wasmedge --dir .:. target/wasm32-wasip1/release/wasi.wasm
127127
Random number: -1157533356
128128
Random bytes: [159, 159, 9, 119, 106, 172, 207, 82, 173, 145, 233, 214, 104, 35, 23, 53, 155, 12, 102, 231, 117, 67, 192, 215, 207, 202, 128, 198, 213, 41, 235, 57, 89, 223, 138, 70, 185, 137, 74, 162, 42, 20, 226, 177, 114, 170, 172, 39, 149, 99, 122, 68, 115, 205, 155, 202, 4, 48, 178, 224, 124, 42, 24, 56, 215, 90, 203, 150, 106, 128, 127, 201, 177, 187, 20, 195, 172, 56, 72, 28, 53, 163, 59, 36, 129, 160, 69, 203, 196, 72, 113, 61, 46, 249, 81, 134, 94, 134, 159, 51, 233, 247, 253, 116, 202, 210, 100, 75, 74, 95, 197, 44, 81, 87, 89, 115, 20, 226, 143, 139, 50, 60, 196, 59, 206, 105, 161, 226]
129129
Printed from wasi: This is from a main function

docs/develop/rust/setup.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
2626

2727
## Set up the Rust compiler's target
2828

29-
To build a WASM file running in server-side WebAssembly like WasmEdge, we need to add the `wasm32-wasi` target for the Rust compiler after Rust is installed.
29+
To build a WASM file running in server-side WebAssembly like WasmEdge, we need to add the `wasm32-wasip1` target for the Rust compiler after Rust is installed.
3030

3131
```bash
32-
rustup target add wasm32-wasi
32+
rustup target add wasm32-wasip1
3333
```
3434

3535
## Special notes for networking apps
@@ -40,21 +40,21 @@ WasmEdge supports async networking APIs provided by [Tokio](https://tokio.rs/) a
4040
need to add a few config flags to help the Rust compiler choose the correct feature branches in the library source code. Here is an example of `cargo build` command for compiling a tokio app to Wasm.
4141

4242
```bash
43-
RUSTFLAGS="--cfg wasmedge --cfg tokio_unstable" cargo build --target wasm32-wasi --release
43+
RUSTFLAGS="--cfg wasmedge --cfg tokio_unstable" cargo build --target wasm32-wasip1 --release
4444
```
4545

4646
Alternatively, you could add these lines to the `.cargo/config.toml` file.
4747

4848
```toml
4949
[build]
50-
target = "wasm32-wasi"
50+
target = "wasm32-wasip1"
5151
rustflags = ["--cfg", "wasmedge", "--cfg", "tokio_unstable"]
5252
```
5353

5454
Once you have these lines in `.cargo/config.toml`, you can simply use the regular `cargo` command.
5555

5656
```bash
57-
cargo build --target wasm32-wasi --release
57+
cargo build --target wasm32-wasip1 --release
5858
```
5959

6060
### TLS on MacOS

0 commit comments

Comments
 (0)