emscripten-core / emscripten-core/emscripten

SINGLE_FILE and pthread incompatibility

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

Description

According to https://github.com/emscripten-core/emscripten/pull/12833#issue-746884561 which says the following:

> SINGLE_FILE=1 is not supported with Wasm Workers (like it is not supported with pthreads)

I'm unable to find other specific documentation for pthreads not supporting SINGLE_FILE, but locally I can confirm that removing SINGLE_FILE does indeed fix the threading issue I'm running into (where the thread does not get executed with `detach`).

What is the specific reason(s) that SINGLE_FILE does not work with pthreads? From what I understand about SINGLE_FILE, it adds the contents of the .js and .wasm files (as a Base64 string) into the HTML file as opposed to reading the wasm contents via locateFile - clearly there is something else that I'm missing.

Contributor guide

Open the contributing guide

Research direction

Start by reading the linked Emscripten pull request and comparing the reported pthreads behavior with and without SINGLE_FILE=1. Trace how SINGLE_FILE, locateFile, and Wasm Workers interact in the relevant Emscripten entry points. Done means documenting the specific reasons SINGLE_FILE is incompatible with pthreads and clarifying the supported configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
wasm
Domain
build-system, compilers
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.