-
Notifications
You must be signed in to change notification settings - Fork 190
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
Import #0 "wasi_snapshot_preview1": module is not an object or function #499
Comments
The WASI APIs that are part of |
Hmm, I'm not sure what you mean by WASI APIs - WASI functions that you can call in your program? Because I only use normal C++ library functions as far as I can tell. Is there a way to find out what function is trying to load wasi_snapshot_preview1 so that I can eliminate it? Thanks I have another WASI program that somebody else wrote that's a lot simpler and doesn't give me this error on the web, so I know it's not absolutely necessary to use something like jco or Emscripten. |
Pretty much any WASI program (i.e. any program build with wasi-sdk) will depend on one or more WASI APIs. In theory could could try to build a pure compute module that doesn't call any inports, but there are not very many useful programs in that category and wasi-sdk doesn't have any mechanism to enforce such a thing.. Most WASI program depends on WASI imports, by design. If you want to find out why a given import is needed you can disassembly the module using |
I have a WASI C++ program that when I compile it and try to import it in my html, I get
Uncaught (in promise) TypeError: WebAssembly.instantiate(): Import #0 "wasi_snapshot_preview1": module is not an object or function
What could be causing this?
I added -Oz to the clang command line and that fixed it temporarily, but then when I tried to -Wl,--export=mainloop, I got the error back again. Then I narrowed down one specific part of my C++ code that causes the error, but nothing in that section seemed special or out of the ordinary. It did use some variables that were defined with uint32_t and uint8_t, so I tried redefining them as ints, but I still got the error. Then I kept getting the error even when commenting out the stuff that commenting out made the error go away to begin with!
The text was updated successfully, but these errors were encountered: