When compiling a WASM module with the multivalue
target feature flag, I'd like to use Cargo rather than rustc directly.
However, I can't get cargo to pass this target feature flag to rustc.
I've tried creating a .cargo/config.toml
file in the project with the following contents:
[build]
rustflags = ["target-feature=+multivalue"]
But that gets me the following error:
cargo build --target wasm32-unknown-unknown
error: failed to run `rustc` to learn about target-specific information
Caused by:
process didn't exit successfully: `rustc - --crate-name ___ --print=file-names target-feature=+multivalue --target wasm32-unknown-unknown --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=cfg` (exit code: 1)
--- stderr
error: multiple input filenames provided (first two filenames are `-` and `target-feature=+multivalue`)
The only command I have got to work successfully is by invoking rustc:
cargo rustc -v --crate-type=cdylib --target wasm32-unknown-unknown -- -C target-feature=+multivalue
I really would like the config file to work so that I can use the bog standard cargo build --target
command. What am I doing wrong?