emscripten-core / emscripten-core/emscripten

pthread undeclared function atomic_load

Open
#20,932 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

Please include the following in your bug report:

**Version of emscripten/emsdk:**
`emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.42-git
Debian clang version 17.0.6 (++20231208085813+6009708b4367-1~exp1~20231208085906.81) Target: wasm32-unknown-emscripten
Thread model: posix InstalledDir: /usr/bin`

this was using arm64 proot debian [termux](https://github.com/termux/proot-distro) I could not use unmaintained emsdk arm64 port.

**Full link command and output with `-v` appended:**
`emcc: error: '/usr/bin/clang -target wasm32-unknown-emscripten -fignore-exceptions -fvisibility=default -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr -D__EMSCRIPTEN_SHARED_MEMORY__=1 -D__EMSCRIPTEN_WASM_WORKERS__=1 -Werror=implicit-function-declaration --sysroot=/opt/tools/emscripten-3.1.42/cache/sysroot -Xclang -iwithsysroot/include/fakesdl -Xclang -iwithsysroot/include/compat -O2 -Wall -Werror -fno-unroll-loops -std=c99 -D_XOPEN_SOURCE=700 -Wno-unused-result -Os -fno-inline-functions -fno-builtin -Wno-ignored-attributes -Wno-macro-redefined -Wno-shift-op-parentheses -Wno-string-plus-int -Wno-missing-braces -Wno-logical-op-parentheses -Wno-bitwise-op-parentheses -Wno-unused-but-set-variable -Wno-unused-variable -Wno-unused-label -Wno-pointer-sign -g3 -I/opt/tools/emscripten-3.1.42/system/lib/libc/musl/src/internal -I/opt/tools/emscripten-3.1.42/system/lib/libc/musl/src/include -I/opt/tools/emscripten-3.1.42/system/lib/libc -I/opt/tools/emscripten-3.1.42/system/lib/pthread -pthread -DNDEBUG -c -matomics -mbulk-memory /opt/tools/emscripten-3.1.42/system/lib/pthread/library_pthread.c -o /opt/tools/emscripten-3.1.42/cache/build/libc-mt-tmp/library_pthread.o' failed (returned 1)
ninja: build stopped: subcommand failed`

compile this [someone test](https://github.com/Hossein-Noroozpour/sdl2-wasm-thread-emscripten-sample) or even minimzed repro
`emcc test/test_system.c -s USE_PTHREADS=1 -o test.html
` which yields following error

`
emcc: error: Subprocess 4/1108 failed (returned 1)! (cmdline: /opt/tools/emscripten-3.1.42/emcc -O2 -Wall -Werror -fno-unroll-loops -std=c99 -D_XOPEN_SOURCE=700 -Wno-unused-result -Os -fno-inline-functions -fno-builtin -Wno-ignored-attributes -Wno-macro-redefined -Wno-shift-op-parentheses -Wno-string-plus-int -Wno-missing-braces -Wno-logical-op-parentheses -Wno-bitwise-op-parentheses -Wno-unused-but-set-variable -Wno-unused-variable -Wno-unused-label -Wno-pointer-sign -g -sSTRICT -I/opt/tools/emscripten-3.1.42/system/lib/libc/musl/src/internal -I/opt/tools/emscripten-3.1.42/system/lib/libc/musl/src/include -I/opt/tools/emscripten-3.1.42/system/lib/libc -I/opt/tools/emscripten-3.1.42/system/lib/pthread -pthread -sWASM_WORKERS -c /opt/tools/emscripten-3.1.42/system/lib/pthread/thread_mailbox.c -o /opt/tools/emscripten-3.1.42/cache/build/libc-mt-debug-tmp/thread_mailbox.o)
root@localhost:/opt/tools/emscripten-3.1.42# /opt/tools/emscripten-3.1.42/system/lib/pthread/em_task_queue.c:220:3: error: call to undeclared function 'atomic_compare_exchange_strong'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] 220 | atomic_compare_exchange_strong(
| ^
/opt/tools/emscripten-3.1.42/system/lib/pthread/em_task_queue.c:247:5: error: call to undeclared function 'atomic_exchange'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
247 | atomic_exchange(&queue->notification, NOTIFICATION_PENDING);
| ^
2 errors generated.
`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.