emscripten-core / emscripten-core/emscripten
`-s EXPORT_NAME=...` + pthreads breaks in Node.js
- Dominant language
- C++
- Stars
- 27.6k
- Forks
- 3.6k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 105
Description
Passing any custom `-s EXPORT_NAME=...` in combination with `-pthread` fails to execute the resulting code in Node.js:
```bash
rreverser@rreverser:~/emscripten$ ./emcc -pthread temp.c -o temp.js -s PTHREAD_POOL_SIZE=1
rreverser@rreverser:~/emscripten$ node --experimental-wasm-threads --experimental-wasm-bulk-memory temp.js
Before Thread
Printing GeeksQuiz from Thread
After Thread
main thread called exit: keepRuntimeAlive=true (counter=0)
program exited (with status: 0), but EXIT_RUNTIME is not set, so halting execution but not exiting the runtime or preventing further async execution (build with EXIT_RUNTIME=1, if you want a true shutdown)
rreverser@rreverser:~/emscripten$ ./emcc -pthread temp.c -o temp.js -s PTHREAD_POOL_SIZE=1 -s EXPORT_NAME=Smth
rreverser@rreverser:~/emscripten$ node --experimental-wasm-threads --experimental-wasm-bulk-memory temp.js
worker.js onmessage() captured an uncaught exception: ReferenceError: __filename is not defined
pthread sent an error! undefined:undefined: __filename is not defined
```
Contributor guide
Assessment
This issue has not been assessed yet.