Skip to content

emcc: warning: USE_PTHREADS is deprecated (prefer the standard -pthread flag). Please open a bug if you have a continuing need for this setting #27960

Open

Description

@tdrz

As instructed by the warning message, I am requesting that USE_PTHREADS should NOT be removed. We are using it when building PGlite - Postgres in WASM. We're relying on upstream code for our build and just removing USE_PTHREADS=0 fails our builds.

Please include the following in your bug report:

Version of emscripten/emsdk:

emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 6.0.5 (1db513782be24469589d7cb8a1f1834e9a33f271)
clang version 24.0.0git (https:/github.com/llvm/llvm-project abd3b3a1445b5a8eeffae5c3912883faa9287fb7)
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir: /emsdk/upstream/bin

Failing command line in full:
This is the output that we're seeing when removing the flag USE_PTHREADS=0:

wasm-ld: error: --shared-memory is disallowed by pg_get_line_shlib.o because it was not compiled with 'atomics' or 'bulk-memory' features.
emcc: error: '/emsdk/upstream/bin/wasm-ld -o libpq.so -Bstatic --import-memory --shared-memory --export=__wasm_call_ctors --export=_emscripten_tls_init --export-if-defined=__start_em_asm --export-if-defined=__stop_em_asm --export-if-defined=__start_em_lib_deps --export-if-defined=__stop_em_lib_deps --export-if-defined=__start_em_js --export-if-defined=__stop_em_js --export-if-defined=main --export-if-defined=__main_argc_argv --export-if-defined=fflush --unresolved-symbols=import-dynamic -shared --stack-first --whole-archive fe-auth-scram.o fe-cancel.o fe-connect.o fe-exec.o fe-lobj.o fe-misc.o fe-print.o fe-protocol3.o fe-secure.o fe-trace.o legacy-pqsignal.o libpq-events.o pqexpbuffer.o fe-auth.o fe-auth-oauth_shlib.o -L../../../src/port -L../../../src/common -lpgcommon_shlib -lpgport_shlib -L/install/libs/lib -L/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/pic -L/emsdk/upstream/emscripten/src/lib /emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/pic/crtbegin-mt.o --no-whole-archive -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr' failed (returned 1)

This is the deprecation message when using that flag:

emcc: warning: USE_PTHREADS is deprecated (prefer the standard -pthread flag). Please open a bug if you have a continuing need for this setting

Activity

  1. sbc100 commented on Oct 13, 2026

    @sbc100
    Collaborator

    Can we maybe find a way to remove the -pthread flag from the PGlite build instead? That seems like a more correct way to go about disabling pthreads.

  2. tdrz commented on Oct 13, 2026

    @tdrz
    Author

    Can we maybe find a way to remove the -pthread flag from the PGlite build instead? That seems like a more correct way to go about disabling pthreads.

    My understanding is that there is no -no-pthread flag: #20720 so unsure if it is doable.

    btw this is the error:

    wasm-ld: error: --shared-memory is disallowed by pg_get_line_shlib.o because it was not compiled with 'atomics' or 'bulk-memory' features.
    emcc: error: '/emsdk/upstream/bin/wasm-ld -o libpq.so -Bstatic --import-memory --shared-memory --strip-debug --export=__wasm_call_ctors --export=_emscripten_tls_init --export-if-defined=__start_em_asm --export-if-defined=__stop_em_asm --export-if-defined=__start_em_lib_deps --export-if-defined=__stop_em_lib_deps --export-if-defined=__start_em_js --export-if-defined=__stop_em_js --export-if-defined=main --export-if-defined=__main_argc_argv --unresolved-symbols=import-dynamic -shared --no-stack-first --whole-archive fe-auth-scram.o fe-cancel.o fe-connect.o fe-exec.o fe-lobj.o fe-misc.o fe-print.o fe-protocol3.o fe-secure.o fe-trace.o legacy-pqsignal.o libpq-events.o pqexpbuffer.o fe-auth.o fe-auth-oauth_shlib.o -L../../../src/port -L../../../src/common -lpgcommon_shlib -lpgport_shlib -L/install/libs/lib -L/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/pic -L/emsdk/upstream/emscripten/src/lib /emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/pic/crtbegin-mt.o --no-whole-archive -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr' failed (returned 1)
    make[3]: *** [../../../src/Makefile.shlib:275: libpq.so] Error 1
    make[3]: *** Deleting file 'libpq.so'
    
  3. sbc100 commented on Oct 13, 2026

    @sbc100
    Collaborator

    2. My understanding is that there is no -no-pthread flag: #20720 so unsure if it is doable.

    Right, but somebody is explictly adding -pthread to the build? Presumably there is some way to stop them from doing that? I assume its coming from upstream build system?

  4. tdrz commented on Oct 13, 2026

    @tdrz
    Author

    3. > 2. My understanding is that there is no -no-pthread flag: #20720 so unsure if it is doable.

    Right, but somebody is explictly adding `-pthread` to the build?  Presumably there is some way to stop them from doing that?    I assume its coming from upstream build system?
    

    Yes, looking into it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions