Can't resolve 'env' in .../pkg - how to investigate? #3500
-
Following on from issue reported here and closed. My situation in particular:
What I've done
So, my question - what's the right way to investigate this?
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
You can pretty easily see the name of the import that's causing an issue using (import "env" "function" (func $function (type 4))) Unfortunately though all the information about what crate the import came from is erased. However, I got kind of over-invested in this and created a tool which does that automatically: https://github.com/Liamolucko/find_wasm_import. You have to use
Also, by the way, the error isn't necessarily cropping up now because of something changing about your dependencies. Imported functions like the one causing this error only get included in the output wasm if they're used, so it might be happening because you started using some new feature of a dependency you already had which relies on some wasm-incompatible import. |
Beta Was this translation helpful? Give feedback.
-
I encountered a similar error in |
Beta Was this translation helpful? Give feedback.
You can pretty easily see the name of the import that's causing an issue using
wasm2wat
by searching for(import "env"
, which should show you one or more lines like this:Unfortunately though all the information about what crate the import came from is erased.
However,
cargo
outputs a separate object file for every crate you depend on intarget/wasm32-unknown-unknown/debug/deps
(wrapped up inside anrlib
), so you could figure out which crate caused the offending import by looking through all of those to see which one imports it.I got kind of over-invested in this and created a tool which does that automatically: https://github.com/Liamo…