-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Emscripten doesn't truly produce standalone/WASI output when requested #20484
Comments
As context, even in |
Heh more precisely no standalone engine supports them yet. Node.js is the only implementation that comes to mind that has WASI and Wasm exceptions, but it's somewhat atypical to use it for server-side WASI. |
@kripken Thank you for the response. I tried adding that flag and now get the following undefined-symbol warnings:
If I ignore them, then as expected, running with both What's the solution here? It seems like I can either try to unilaterally disable exceptions project wide (which might be possible), or just wait until the standalone wasm engines support this proposal. Longer term I'd prefer if the wasm engines supported wasm exceptions, but is there anything I can do in the interim? |
For now building without exceptions is the only way, yes. For what it's worth, .NET NativeAOT-LLVM project worked around this limitation by generating LLVM IR that does manual unwind instead (condition on global variable after every potentially-throwing call, similar to what Asyncify does), and I can image Binaryen could do something similar to polyfill native Wasm exceptions for unsupported engines, but I suspect there is not enough interest for something this complex at the moment? @kripken |
That shouldn't happen with wasm exceptions. Were perhaps some object files, or some library, still built with the old way? Note that
Yes, basically what you said - possible in theory, but since engines are getting support as we speak, it hasn't been a priority. I wouldn't turn down a PR though. |
Overview
Emscripten compiler chain doesn't seem to honor
-sSTANDALONE_WASM=1 -sPURE_WASI=1
Description
See related
wasmer
ticket above for more info.When compiling a toy "hello world" project using the above flags, I am able to compile an example program
say_example
, and run via wasmer, using the commandwasmer run say_example.wasm <my_message>
, and I get the expected output.However, when compiling an executable and linking against
gtest
(which I'm building from source in this project & implementing my ownmain
function), I instead get the following error when runningwasmer run test_say.wasm
:If I inspect
test_say.js
I see thewasmImports
variable mapsinvoke_iii
to a JS function implemented further down in the file. This seems to suggest that Emscripten isn't producing truly standalone webassembly.Source Code
say.hpp
say.cpp
say_example.cpp
test_say.cpp
test_main.cpp
The text was updated successfully, but these errors were encountered: