@@ -207,6 +207,19 @@ if(PSP_PYTHON_BUILD AND MACOS)
207207 set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS } -undefined dynamic_lookup" )
208208endif ()
209209
210+ if (EMSCRIPTEN)
211+ # Emscripten 6.0.0's libc no longer exposes pthread symbols without
212+ # `-pthread`, so CMake's `FindThreads` probe (`CMAKE_HAVE_LIBC_PTHREAD`)
213+ # fails and dependencies that `find_package(Threads REQUIRED)` (protobuf)
214+ # refuse to configure. We deliberately do NOT enable pthreads for the WASM
215+ # build (no SharedArrayBuffer, no `-pthread`). Pre-seeding this *cache* entry
216+ # (global, so it reaches protobuf's add_subdirectory) makes `FindThreads`
217+ # skip the probe and report success via its `CMAKE_HAVE_LIBC_PTHREAD` branch,
218+ # which sets `CMAKE_THREAD_LIBS_INIT ""` — i.e. `Threads::Threads` links
219+ # nothing and the build stays single-threaded, as it did before the bump.
220+ set (CMAKE_HAVE_LIBC_PTHREAD TRUE CACHE BOOL "psp: satisfy FindThreads on WASM without enabling pthreads" FORCE )
221+ endif ()
222+
210223# ######################
211224set (psp_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR } /src/include" )
212225
@@ -357,7 +370,10 @@ endif()
357370set (RAPIDJSON_BUILD_TESTS OFF CACHE BOOL "Disable rapidjson tests" )
358371
359372if (PSP_PYODIDE)
360- set (RELOCATABLE_FLAGS " -sRELOCATABLE=1 -sSIDE_MODULE=2 -fwasm-exceptions -sSUPPORT_LONGJMP=wasm \ " )
373+ # NB: `-sRELOCATABLE=1` was removed in emscripten 6.0.0 ("No longer
374+ # supported") and is redundant here — `-sSIDE_MODULE=2` already emits a
375+ # relocatable side module.
376+ set (RELOCATABLE_FLAGS " -sSIDE_MODULE=2 -fwasm-exceptions -sSUPPORT_LONGJMP=wasm \ " )
361377 string (APPEND CMAKE_EXE_LINKER_FLAGS "${RELOCATABLE_FLAGS} -sWASM_BIGINT=1 " )
362378 string (APPEND CMAKE_C_FLAGS "${RELOCATABLE_FLAGS} " )
363379 string (APPEND CMAKE_CXX_FLAGS "${RELOCATABLE_FLAGS} " )
0 commit comments