You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried adding the panic_abort crate from crates.io but it gives some other errors and I'm pretty sure I shouldn't have to.
Compiling with RUSTC_LOG=info gives a bit more info:
INFO rustc_metadata::creader panic runtime not found -- loading panic_abort
INFO rustc_metadata::creader resolving crate `panic_abort`
INFO rustc_metadata::creader falling back to a load
INFO rustc_metadata::locator lib candidate: /Users/tim/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libpanic_abort-14c6721c1e3ddac4.rlib
INFO rustc_metadata::locator rlib reading metadata from: /Users/tim/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/lib/libpanic_abort-14c6721c1e3ddac4.rlib
INFO rustc_metadata::locator Rejecting via proc macro: expected true got false
INFO rustc_metadata::locator metadata mismatch
As you can see it is looking for the wrong libpanic_abort.rlib! It's especially weird because it finds the right crate when it tries to resolve other ones, e.g:
INFO rustc_metadata::creader resolving crate `cfg_if`
INFO rustc_metadata::creader falling back to a load
INFO rustc_metadata::locator lib candidate: /Users/tim/wasm-pack-template/target/wasm32-unknown-unknown/debug/deps/libcfg_if-40fde05178aa587c.rlib
INFO rustc_metadata::locator lib candidate: /Users/tim/wasm-pack-template/target/wasm32-unknown-unknown/debug/deps/libcfg_if-40fde05178aa587c.rmeta
INFO rustc_metadata::locator rmeta reading metadata from: /Users/tim/wasm-pack-template/target/wasm32-unknown-unknown/debug/deps/libcfg_if-40fde05178aa587c.rmeta
INFO rustc_metadata::creader register crate `cfg_if` (cnum = 17. private_dep = false)
And it actually did successfully compile libpanic_abort.rlib for wasm:
This is a known issue (unfortunately), mainly tracked in rust-lang/wg-cargo-std-aware#29. The build-std feature doesn't know how to handle abort vs unwind targets, so it doesn't handle them automatically. wasm doesn't support unwinding, so it needs to use abort. You can force it by using -Zbuild-std=std,panic_abort.
I'm trying to build
std
forwasm32-unknown-unknown
. I cloned the wasm template but compiling it gives this:I tried adding the
panic_abort
crate from crates.io but it gives some other errors and I'm pretty sure I shouldn't have to.Compiling with
RUSTC_LOG=info
gives a bit more info:As you can see it is looking for the wrong
libpanic_abort.rlib
! It's especially weird because it finds the right crate when it tries to resolve other ones, e.g:And it actually did successfully compile
libpanic_abort.rlib
for wasm:Possibly related to #56228. I also made a thread about this here.
The text was updated successfully, but these errors were encountered: