Issue with Using pthread in WASM

Hello,
I’m trying to compile VTK-9.5.0 and use the resulting build as a library for compiling my own C++ code targeting WebAssembly.

During the VTK build process, I followed the instructions from the official guide (Building using emscripten for WebAssembly - VTK documentation) and enabled the option -DVTK_WEBASSEMBLY_THREADS:BOOL=ON.

When compiling my C++ project with this VTK build, I added the following flags in my CMakeLists.txt:
-pthread and -sPROXY_TO_PTHREAD=1

However, I encountered the following error:

–shared-memory is disallowed by vtkSMPThreadPool.cxx.o because it was not compiled with ‘atomics’ or ‘bulk-memory’ features.

Is there a specific flag or configuration I may have missed when building VTK to support threads in WASM?

Any help would be greatly appreciated!

Can you search the build.ninja of VTK for instances of -pthread? I want confirm that the generated file has that flag for the vtkSMPThreadPool.cxx.o. Sometimes, setting the option after initial configure does not work.