Apparently Clang has a -no-pthread option. It's not very useful on most platforms (and is even broken on some llvm/llvm-project#69363) but supporting it in Emscripten could help solve a common issue with complex build system where some autoconf + libtool scripts add -pthread to the list of linker flags and they end up propagated all the way to the top linker invocation with no easy way to remove it.
If you know that the library only uses pthread condvars and similar APIs that don't really need multi-threading support, you could link with the Emscripten's pthread stub, and still get a usable, smaller, and, in some cases, even faster, Wasm binary. However, currently there is no way to selectively disable just the pthreads during the linking phase and ask for the stub instead.
Being able to do $(LD) $(LDFLAGS) -no-pthread where -no-pthread overrides a former -pthread flag would solve this issue elegantly.
Apparently Clang has a
-no-pthreadoption. It's not very useful on most platforms (and is even broken on some llvm/llvm-project#69363) but supporting it in Emscripten could help solve a common issue with complex build system where some autoconf + libtool scripts add-pthreadto the list of linker flags and they end up propagated all the way to the top linker invocation with no easy way to remove it.If you know that the library only uses pthread condvars and similar APIs that don't really need multi-threading support, you could link with the Emscripten's pthread stub, and still get a usable, smaller, and, in some cases, even faster, Wasm binary. However, currently there is no way to selectively disable just the pthreads during the linking phase and ask for the stub instead.
Being able to do
$(LD) $(LDFLAGS) -no-pthreadwhere-no-pthreadoverrides a former-pthreadflag would solve this issue elegantly.