SurpriseMF
SurpriseMF

Reputation: 212

.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?

Upvotes: 4

Views: 1391

Answers (1)

Kevin Reid
Kevin Reid

Reputation: 43753

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"]

Upvotes: 6

Related Questions