emscripten-core / emscripten-core/emscripten

Building wasm with MAIN_MODULE gives runtime error after upgrade to 2.0.12 version

Open
#13,314 1 comment 0 reactions 0 assignees View on GitHub
wontfix
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

I'm using in my project WebGl with GLFW library. I have one module build as main and a few side modules.
After I upgraded empscripten from 2.0.8 to 2.0.12 I ran in two issues:
1. Main module gives runtime error
2. Side module compiler gives warning (emscripten:WARNING: STACK_OVERFLOW_CHECK disabled because emscripten stack helpers not exported)

I don't know how to resolve the warning however biggest concern is runtime error.

This is settings to build side module:
`-O3 -std=c++14 --profiling -Wall -Wextra -fPIC -s DISABLE_EXCEPTION_CATCHING=0 -s ERROR_ON_UNDEFINED_SYMBOLS=1 -s ASSERTIONS=1 -s SIDE_MODULE=1 -s EXPORTED_FUNCTIONS="['InitializeModule']"
`
This is settings to build main module:
`-O3 -std=c++14 --profiling -Wall -Wextra -fPIC --bind -lidbfs.js -s DISABLE_EXCEPTION_CATCHING=0 -s ERROR_ON_UNDEFINED_SYMBOLS=1 -s FETCH=1 -s LLD_REPORT_UNDEFINED=1 -s ASSERTIONS=1 -s SAFE_HEAP=1 -s STACK_OVERFLOW_CHECK=1 -s ALLOW_MEMORY_GROWTH=1 -s FORCE_FILESYSTEM=1 -s USE_WEBGL2=1 -s MIN_WEBGL_VERSION=2 -s MAX_WEBGL_VERSION=2 -s FULL_ES3=1 -s USE_GLFW=3 -s USE_FREETYPE=1 -s USE_ZLIB=1 -s WASM=1 -s MAIN_MODULE=1
`
As a result I'm getting runtime error:
**Assertion failed: Missing signature argument to addFunction: function _emscripten_html5_remove_all_event_listeners() {
JSEvents.removeAllEventListeners();
}**

I tried use MAIN_MODULE=2 option with setting variables:
```
EMCC_ONLY_FORCED_STDLIBS=1
EMCC_FORCE_STDLIBS=libembind,libmalloc,libc,libc++,libc++abi,libsockets,libfetch,libcompiler_rt,libc_rt_wasm

```
As a result I'm getting runtime error:
**Assertion failed: undefined symbol `emscripten_html5_remove_all_event_listeners`. perhaps a side module was not linked in? if this global was expected to arrive from a system library, try to build the MAIN_MODULE with EMCC_FORCE_STDLIBS=1 in the environment**

It looks like emscripten build library is not linked to my wasm.

What am I missing? How can I resolve warning for side module and runtime error?

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.