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
Issue:
When enabling the JSPI flag and attempting to emit Typescript definitions (via --emit-tsd), the build fails. The error indicates that JSPI is not supported in the current environment. It seems that it tries to assert in Node context that WebAssembly.promising exists.
I suspect that the issue lies in tsgen.js, which appears to validate the generated codes but fails because Node.js does not support JSPI. However, the generated code works correctly in a browser environment when the JSPI flag is enabled.
# This command is executed by CMake
em++ -gsource-map \
-lembind \
--emit-tsd test1.d.ts \ # It works without this line
-s EXPORT_NAME=Test1Module \
-s JSPI \
-s STRICT \
-s USE_ES6_IMPORT_META \
-s MODULARIZE \
-s EXPORT_ES6=1 \
--no-entry \
test1.cpp.o \
-o test1.js
Full link command and output with -v appended:
RuntimeError: Aborted(Assertion failed: JSPI not supported by current environment. Perhaps it needs to be enabled via flags?)
at abort (C:\Users\User\AppData\Local\Temp\emscripten_temp_52rs7em6\tsgen.js:498:11)
at assert (C:\Users\User\AppData\Local\Temp\emscripten_temp_52rs7em6\tsgen.js:231:5)
at Object.instrumentWasmImports (C:\Users\User\AppData\Local\Temp\emscripten_temp_52rs7em6\tsgen.js:4548:9)
at getWasmImports (C:\Users\User\AppData\Local\Temp\emscripten_temp_52rs7em6\tsgen.js:639:12)
at createWasm (C:\Users\User\AppData\Local\Temp\emscripten_temp_52rs7em6\tsgen.js:689:14)
at Object.<anonymous> (C:\Users\User\AppData\Local\Temp\emscripten_temp_52rs7em6\tsgen.js:4824:1)
at Module._compile (node:internal/modules/cjs/loader:1469:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1548:10)
at Module.load (node:internal/modules/cjs/loader:1288:32)
at Module._load (node:internal/modules/cjs/loader:1104:12)
Node.js v20.18.0
em++: error: 'C:/Users/User/Workspace/third-party/emsdk/node/20.18.0_64bit/bin/node.exe C:\Users\User\AppData\Local\Temp\emscripten_temp_52rs7em6\tsgen.js' failed (returned 1)
ninja: build stopped: subcommand failed.
The text was updated successfully, but these errors were encountered:
- Adds a Promise<T> wrapper around the return type for async embind functions.
- Disables JSPI while generating the definitions, since it's not needed.
Fixesemscripten-core#23272
brendandahl
added a commit
to brendandahl/emscripten
that referenced
this issue
Jan 7, 2025
- Adds a Promise<T> wrapper around the return type for async embind functions.
- Disables JSPI while generating the definitions, since it's not needed.
Fixesemscripten-core#23272
- Adds a Promise<T> wrapper around the return type for async embind
functions.
- Disables JSPI while generating the definitions, since it's not needed.
Fixes#23272
Version of emscripten/emsdk:
Issue:
When enabling the JSPI flag and attempting to emit Typescript definitions (via --emit-tsd), the build fails. The error indicates that JSPI is not supported in the current environment. It seems that it tries to assert in Node context that
WebAssembly.promising
exists.I suspect that the issue lies in
tsgen.js
, which appears to validate the generated codes but fails because Node.js does not support JSPI. However, the generated code works correctly in a browser environment when the JSPI flag is enabled.Demo to reproduce: https://github.com/mroohian/emscripten-jspi-demo
Failing command line in full:
Full link command and output with
-v
appended:The text was updated successfully, but these errors were encountered: