emscripten-core / emscripten-core/emscripten

Enabling Asyncify breaks module: Module.dynCall_i is not a function

Open
#25,551 4 comments 0 reactions 0 assignees View on GitHub
asyncify
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

```
Uncaught (in promise) TypeError: Module.dynCall_i is not a function
invoke_i http://localhost:8000/build/MyProject.js:1
wrapper http://localhost:8000/build/MyProject.js:1
callMain http://localhost:8000/build/MyProject.js:1
doRun http://localhost:8000/build/MyProject.js:1
run http://localhost:8000/build/MyProject.js:1
createModule http://localhost:8000/build/MyProject.js:1
load http://localhost:8000/wrapper.js:71
http://localhost:8000/main.js:1
MyProject.js:1:129537
```

The link flags are as follows:

```cmake
set_target_properties(MyProject PROPERTIES LINK_FLAGS "-s WASM=1 -s MAIN_MODULE=1 \
-s ERROR_ON_UNDEFINED_SYMBOLS=0 -s EXPORT_NAME=createModule -s MODULARIZE=1 \
-s FORCE_FILESYSTEM -s EXPORTED_RUNTIME_METHODS=[\"FS\"] -s WASMFS=1 -fPIC -fexceptions --no-entry \
-z muldefs -s ALLOW_MEMORY_GROWTH -s ASYNCIFY -s DYNCALLS -s ASYNCIFY_DEBUG -lasync.js \
-s ASYNCIFY_ONLY=[\"extractFile(std::__2::basic_string?.std::__2::allocator>)\"] ")
```

Adding/removing `-s DYNCALLS` and/or `-lasync.js` seems to have no effect. The project works fine when Asyncify is not enabled.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.