Skip to content

Can't resolve 'env' in .../pkg - how to investigate? #3500

Closed Answered by Liamolucko
kalzoo asked this question in Q&A
Discussion options

You must be logged in to vote

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:

(import "env" "function" (func $function (type 4)))

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 in target/wasm32-unknown-unknown/debug/deps (wrapped up inside an rlib), 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…

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
4 replies
@daxpedda
Comment options

@kalzoo
Comment options

@frewsxcv
Comment options

@xangelix
Comment options

Answer selected by kalzoo
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
6 participants