Which version of nightly supports wasm64 target

I hear that Rust now can compile source .rs file into wasm64,when I use command:rustup target add wasm64-unknown-unknown --toolchain nightly,it shows
error: toolchain 'nightly-x86_64-unknown-linux-gnu' does not contain component 'rust-std' for target 'wasm64-unknown-unknown'; did you mean 'wasm32-unknown-unknown'?
note: not all platforms have the standard library pre-compiled: Platform Support - The rustc book
help: consider using cargo build -Z build-std instead.
maybe it lacks rust-std,while I try to build std,using:cargo +nightly build -Z build-std=std,panic_abort --target wasm64-unknown-unknown,it shows:wasm32 object file can't be linked in wasm64 mode.I do not know what results in this,can you give me some advice?thank you.

Over my head, but...I found this.

Rust does not yet ship pre-compiled artifacts for this target. To compile for this target, you will either need to build Rust with the target enabled (see "Building the target" above), or build your own copy of std by using build-std or similar.

platform-support/wasm64

I have tried to build std,using this command:cargo +nightly build -Z build-std=std,panic_abort --target wasm64-unknown-unknown,but it failed,the error message is:wasm32 object file can't be linked in wasm64 mode.


I do not know why there is wasm32 object file

That is Compiling tests for `wasm64-unknown-unknown` on latest Nightly results in linking error · Issue #121460 · rust-lang/rust · GitHub which will be fixed by rustc: Fix wasm64 metadata object files by alexcrichton · Pull Request #121464 · rust-lang/rust · GitHub once it lands. You can try using a nightly from before wasm: Store rlib metadata in wasm object files by alexcrichton · Pull Request #120588 · rust-lang/rust · GitHub landed.

Hello, I downloaded the latest version of rust, now can compile to wasm64-unknown-unknown as the target, unknown target does not seem to interact with the operating system, so hello world can compile normally, but no output, so how do I test the generated wasm64 module?

Just like wasm32-unknown-unknown you need to define your own abi between the wasm module and the host and implement it on both sides. When running in the browser with wasm32-unknown-unknown you can use wasm-bindgen to take over most of this work, but I don't know if it supports wasm64 and if you aren't running in the browser it doesn't help anyway.

Thank you

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.