.Rlib and .d file instead of .wasm
I want to compile a .rs
file in a Rust lib to a .wasm
.
RUSTFLAGS='-C link-arg=-s' cargo build --release --target wasm32-unknown-unknown
Instead of a .wasm
file I get a .Rlib
and .d
file. What do I need to change to get a .wasm
?
Solution 1:
rustc
considers .wasm
files to fill the “native dynamic library” role in the WASM target. Add this to your Cargo.toml
configuration to request that build instead of the default .rlib
:
[lib]
crate-type = ["cdylib"]