emscripten-core / emscripten-core/emscripten

Dynamic linking causing runtime errors even before modules are loaded

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

Description

I have a project that compiles and runs fine. I am now working on adding dynamic link. When I add "-s MAIN_MODULE=1" and rebuild, I get runtime errors even before attempting to load any modules. The errors occurs before main() executes and seem to be relate to pthreads. The greater the PTHREAD_POOL_SIZE value, the greater the number of errors reported. There are no dynamic libraries to preload and no modules are being loaded yet. The code is exactly the same as before. The only change was adding "-s MAIN_MODULE=1".

project.worker.js:1 Uncaught TypeError: Cannot read property 'slice' of undefined
at convertJsFunctionToWasm (project.js:1)
at addFunctionWasm (project.js:1)
at reportUndefinedSymbols (project.js:1)
at preloadDylibs (project.js:1)
at run (project.js:1)
at project.js:1
at self.onmessage

and

project.worker.js:181 RuntimeError: abort(Assertion failed: Missing signature argument to addFunction: function __emval_run_destructors(handle) {
var destructors = emval_handle_array[handle].value;
runDestructors(destructors);
__emval_decref(handle);
}) at Error
at jsStackTrace (project.js:2911)
at stackTrace (project.js:3366)
at abort (project.js:2171)
at assert (project.js:1585)
at addFunctionWasm (project.js:1442)
at reportUndefinedSymbols (project.js:3319)
at preloadDylibs (project.js:3333)
at run (project.js:111096)
at project.js:111216
at self.onmessage (project.worker.js:68)
at abort (project.js:2173)
at assert (project.js:1585)
at addFunctionWasm (project.js:1442)
at reportUndefinedSymbols (project.js:3319)
at preloadDylibs (project.js:3333)
at run (project.js:111096)
at project.js:111216
at self.onmessage (project.worker.js:68)

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.