-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
-sMAIN_MODULE=2
with -pthread
misses exports __emscripten_thread_crashed
and __embind_initialize_bindings
#21844
Comments
Looks like a real bug which I imagine was introduced in #21701. I can take a look at this tomorrow. |
Actually I can't see how this is possible since Line 488 in 0e4c599
Line 496 in 0e4c599
I'm having trouble reproducing as when I build with the above options I see this in the generated JS file:
And the wasm file contains that |
Hmm, for me the js file contained the Wasm exportsExport[34]: - func[21607] <__wasm_call_ctors> -> "__wasm_call_ctors" - func[15916] <__wasm_apply_data_relocs> -> "__wasm_apply_data_relocs" - func[213] -> "free" - func[13252] <__main_argc_argv> -> "__main_argc_argv" - func[250] -> "malloc" - func[15546] -> "pthread_self" - func[15582] -> "htonl" - func[8231] -> "htons" - func[8231] -> "ntohs" - func[15614] <__getTypeName> -> "__getTypeName" - func[15613] <_emscripten_tls_init> -> "_emscripten_tls_init" - func[5573] -> "emscripten_builtin_memalign" - func[15612] -> "setThrew" - func[15611] <_emscripten_tempret_set> -> "_emscripten_tempret_set" - func[15610] -> "emscripten_stack_set_limits" - func[15609] <_emscripten_stack_restore> -> "_emscripten_stack_restore" - func[15608] <_emscripten_stack_alloc> -> "_emscripten_stack_alloc" - func[15607] -> "emscripten_stack_get_current" - func[8262] <__dl_seterr> -> "__dl_seterr" - func[15600] <_emscripten_dlsync_self_async> -> "_emscripten_dlsync_self_async" - func[5644] <_emscripten_dlsync_self> -> "_emscripten_dlsync_self" - func[15598] <_emscripten_proxy_dlsync_async> -> "_emscripten_proxy_dlsync_async" - func[15594] <_emscripten_proxy_dlsync> -> "_emscripten_proxy_dlsync" - func[15587] <_emscripten_thread_init> -> "_emscripten_thread_init" - func[15564] <_emscripten_run_on_main_thread_js> -> "_emscripten_run_on_main_thread_js" - func[15549] <_emscripten_thread_free_data> -> "_emscripten_thread_free_data" - func[8209] <_emscripten_thread_exit> -> "_emscripten_thread_exit" - func[8194] <_emscripten_timeout> -> "_emscripten_timeout" - func[15534] <_emscripten_check_mailbox> -> "_emscripten_check_mailbox" - func[8171] <__cxa_decrement_exception_refcount> -> "__cxa_increment_exception_refcount" - func[8171] <__cxa_decrement_exception_refcount> -> "__cxa_decrement_exception_refcount" - func[15507] <__cxa_can_catch> -> "__cxa_can_catch" - func[15506] <__cxa_is_pointer_type> -> "__cxa_is_pointer_type" - func[15285] <_emscripten_run_callback_on_thread> -> "_emscripten_run_callback_on_thread" Those lines you highlighted in Edit: Also I forgot to mention, this error does not occur in debug mode |
Anything you can do to reduce the side the reproducer would be great. For example, can you try other opt levels (e.g. You could also try to bisect to figure out if #21701 was really the change that introduced this issue. See https://emscripten.org/docs/contributing/developers_guide.html?highlight=developer#bisecting |
Ok, so the
As does this one:
Removing the calls resolves the issue, even if the same Qt libraries are linked with the same build options. |
Actually, scrap that about |
+1 Normally (on 3.1.56) I'd use the following linker flags:
I just upgraded to 3.1.59 and added I got:
Switching to Any help with this would be much appreciated. |
The |
Thank you. I changed the linker flags to
Sadly I am still getting: I also tried adding |
I'm using (a custom build of) Qt 6.7 with emscripten 3.1.58, with both
-pthread
and-sMAIN_MODULE=2
.When trying to run the build in a webbrowser, I'm getting an exception because
__emscripten_thread_crashed
is undefined, which is caused by an exception because__embind_initialize_bindings
is undefined.Setting
-sEXPORTED_FUNCTIONS=_main,__emscripten_thread_crashed,__embind_initialize_bindings
works around this (but this wasn't needed on 3.1.55 I think).I'm guessing DCE deletes these because they're only called from javascript?
emcc --version:
Linker command:
The text was updated successfully, but these errors were encountered: