No supported way to negate `-pthread`: `USE_PTHREADS` is deprecated but is the only working off-switch
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 64/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- wasm
- Ambito
- compilers
Direzione di ricerca
Start with the user_settings handling in emcc.py and the LEGACY_SETTINGS entry in tools/settings.py, then reproduce the emsdk 6.0.9 commands from the issue. Determine how a supported negation of -pthread should interact with USE_PTHREADS and STRICT. Done means a thread-enabled command can be reliably disabled without the deprecated setting, or the documented workaround remains accepted under STRICT.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
USE_PTHREADS is deprecated in favour of -pthread, but -pthread has no negation, so a
project that consumes a build system which passes -pthread unconditionally has no
supported way to turn threads off. The only mechanism that works is the deprecated setting
itself, which is a hard error under STRICT.
I am filing because the deprecation message explicitly invites it ("Please open a bug if
you have a continuing need for this setting"), and a tracker search for -no-pthread,
for negating -pthread, and for the USE_PTHREADS deprecation turned up nothing similar.
What I tried, on emsdk 6.0.9
Baseline, matching what the upstream build passes:
emcc -pthread -sALLOW_MEMORY_GROWTH=1 -o out.js hello.c
# -> (import "env" "memory" (memory $mimport$0 256 32768 shared))
Then each candidate negation, injected via EMCC_CFLAGS so it lands after the
command line (the same shape a downstream build system leaves you with):
| Flag | Result |
|---|---|
-no-pthread |
still shared -- the string does not occur in emcc.py, tools/ or docs/emcc.txt; it is forwarded to clang, which reports it unused |
-sSHARED_MEMORY=0 |
still shared |
-sPTHREADS=0 |
hard error: PTHREADS is an internal setting and cannot be set from command line |
-sUSE_PTHREADS=0 |
works -- (memory $0 258 32768), non-shared, no PThread/Worker references in the glue |
emcc.py (around the user_settings handling) maps USE_PTHREADS onto the internal
PTHREADS, and that appears to be the only path that can negate it. tools/settings.py
lists USE_PTHREADS in LEGACY_SETTINGS with "No longer needed. Use -pthread instead",
and legacy settings are fatal when STRICT is on.
Why this matters downstream
We are building Lean 4 for WebAssembly. Its CMake sets
set(EMSCRIPTEN_SETTINGS "-s ALLOW_MEMORY_GROWTH=1 -fwasm-exceptions -pthread -flto")
string(APPEND LEANC_EXTRA_CC_FLAGS " -pthread")
unconditionally in its Emscripten branch, with no option to disable it. We want a
thread-free comparison build (no SharedArrayBuffer requirement, so the artifact can load
without cross-origin isolation). Our only route is -sUSE_PTHREADS=0, i.e. a deprecated
setting that a future emsdk may remove and that EMCC_STRICT already rejects.
What would help
Any one of these would remove the dead end, in rough order of preference:
- A supported negation of
-pthread---no-pthreadis the spelling most people try
first (clang accepts it for the host, which is why it fails silently here). - Keep
-sUSE_PTHREADS=0working, or exempt it fromSTRICT, until a negation exists. - Failing both, a documentation note in
docs/emcc.txtstating that-pthreadcannot be
negated and that-sUSE_PTHREADS=0is the workaround, so the deprecation warning does
not lead people to remove their only working option.
Happy to open a PR for (3) if that would be welcome, and happy to test a patch for (1).
Versions
emsdk / emscripten 6.0.9, Linux 6.18 (Manjaro), node 24.
Disclosure: this report was researched and drafted by Claude Opus 5 (Claude Code) working
at my direction. Every flag result in the table above is from a real local probe on 6.0.9,
not a hypothetical, and the cited source behaviour was checked against the installed
emscripten before filing.
- Lingua principale
- C++
- Stelle
- 27.8k
- Fork
- 3.6k
- Merge medio
- 1g 4h
- PR unite (30g)
- 179
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di emscripten-core/emscripten
-
`other.test_cmake_cxx_import_std` fails on CMake 3.30–4.0.2 due to missing `CMAKE_EXPERIMENTAL_CXX_IMPORT_STD` UUIDsForse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
emscripten-core/emscripten#28160 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
emscripten-core/emscripten#27994 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
LEGACY_GL_EMULATION: generated fixed-function fragment shaders use mediump — fp16 overflow where mediump is half precisionForse già presa @TheTomBritton l’ha presa 12 giorni fa. ApertaDesktop OpenGL emulation
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
emscripten-core/emscripten#27948 · 4 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
emscripten-core/emscripten#27906 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
run_python, run_python_compiler could readlink -fForse già presa @kapouer l’ha presa 127 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
emscripten-core/emscripten#27211 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di emscripten-core/emscripten
Issue simili
-
bug libcudf
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 2 giorni
-
level/task module/cloud monitoring type/maintenance
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
LadybirdBrowser/ladybird#13809 ·
I maintainer di solito rispondono entro 1 giorno
-
bug module:nodes tests
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
rocketride-org/rocketride-server#3020 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 9 giorni