Closed bruno-j-nicoletti closed 1 week ago
I think you're missing the -pthread
link flag when adding the compile flag.
@sbc100 Do you know off hand if there should be a linking error if you compile with pthreads enabled, but link without them?
I think we allow that. It shouldn't cause any issues on modern browsers.
What is the cause of this issue?
I didn't dig too deep, but it seems this thread_local is not working correctly.
There was a recent fix for TLS in non-threaded builds: https://github.com/llvm/llvm-project/pull/116136.
I wonder if that made it into an emscripten release yet? Are you able to reproduce on tot?
Works with emsdk tot!
Awesome I think we can close this then. The fix is in emsdk tot already and will be in the next release (3.1.73)
Thank you all. Just updated to 3.1.73 and that fixed it.
I'm trying to call a JS function from C++ via the
val
API. If I compile with-pthread
and link with any -O1, -O2 or -O3 it will fail as the function caller won't be registered on the JS side.I get errors along the line of...
After some experimenting it looks like the function signature registration is not happening correctly.
_emval_get_method_caller
is being called on the C++ side, but apparently not being invoked on the JS side.I have a small project that replicates the issue. Uncomment the line in CMakeLists.txt with
add_compile_options(-pthread)
, rebuild and it will fail.https://github.com/bruno-j-nicoletti/webbind
Possibly related to this older issue?
https://github.com/emscripten-core/emscripten/issues/15557
Any help appreciated.