Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cargo-miri does not support target wasm32-unknown-unknown #1916

Closed
dvc94ch opened this issue Nov 17, 2021 · 7 comments
Closed

cargo-miri does not support target wasm32-unknown-unknown #1916

dvc94ch opened this issue Nov 17, 2021 · 7 comments
Labels
A-cargo Area: affects the cargo wrapper (cargo miri) C-enhancement Category: a PR with an enhancement or an issue tracking an accepted enhancement

Comments

@dvc94ch
Copy link

dvc94ch commented Nov 17, 2021

this works very nicely: cargo +nightly miri test --target mips64-unknown-linux-gnuabi64 however wasm32-unknown-unknown doesn't.

cargo +nightly miri test --target wasm32-unknown-unknown
   Compiling anyhow v1.0.45
   Compiling rust-ffi v0.1.0 (/home/dvc/rust-ffi)
    Finished test [unoptimized + debuginfo] target(s) in 0.82s
     Running unittests (target/miri/wasm32-unknown-unknown/debug/deps/rust_ffi-4a0413132da28d8a.wasm)
fatal error: `cargo-miri` called with unexpected first argument `/home/dvc/rust-ffi/target/miri/wasm32-unknown-unknown/debug/deps/rust_ffi-4a0413132da28d8a.wasm`; please only invoke this binary through `cargo miri`
error: test failed, to rerun pass '--lib'
@dvc94ch dvc94ch changed the title supported targets list of supported targets Nov 17, 2021
@bjorn3
Copy link
Member

bjorn3 commented Nov 17, 2021

I think we need to do the same as for windows .exe for wasm .wasm at

miri/cargo-miri/bin.rs

Lines 708 to 710 in b258eb3

// For Windows, do the same thing again with `.exe` appended to the filename.
// (Need to do this here as cargo moves that "binary" to a different place before running it.)
info.store(&out_filename("", ".exe"));

@RalfJung
Copy link
Member

Yeah I honestly have no ideas which targets work and which do not, it's kind of a case-by-case thing.^^

This issue is probably similar to #1867.

@RalfJung RalfJung changed the title list of supported targets cargo-miri does not support target wasm32-unknown-unknown Dec 16, 2021
@RalfJung RalfJung added A-cargo Area: affects the cargo wrapper (cargo miri) C-enhancement Category: a PR with an enhancement or an issue tracking an accepted enhancement E-help-wanted labels Dec 16, 2021
@RalfJung
Copy link
Member

I know basically nothing about wasm targets and wouldn't even know what to test, so I marked this as "help-wanted".

@workingjubilee
Copy link
Member

If it is acceptable to add a dependency, Miri could simply include the wasmtime crate as an embedding and simply execute the wasm file directly from Rust, like so:

https://docs.wasmtime.dev/lang-rust.html

@RalfJung
Copy link
Member

RalfJung commented Feb 11, 2022

That's not really what Miri is expected to do, though -- it should interpret the code, not run it like normal. Running it in wasmtime will not run all of the extra checks Miri is doing to detect UB.

@workingjubilee
Copy link
Member

Ah, no idea then~!

@RalfJung
Copy link
Member

This should be fixed by #2685.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-cargo Area: affects the cargo wrapper (cargo miri) C-enhancement Category: a PR with an enhancement or an issue tracking an accepted enhancement
Projects
None yet
Development

No branches or pull requests

4 participants