These are changes i made to build a static library of libomp to run on wasm32
using the emscripten tool chain
export CFLAGS="-pthread" export CXXFLAGS="-pthread" emcmake cmake \ -DOPENMP_STANDALONE_BUILD=ON \ -DOPENMP_ENABLE_OMPT_TOOLS=OFF \ -DOPENMP_ENABLE_LIBOMPTARGET=OFF \ -DLIBOMP_HAVE_OMPT_SUPPORT=OFF \ -DLIBOMP_OMPT_SUPPORT=OFF \ -DLIBOMP_OMPD_SUPPORT=OFF \ -DLIBOMP_USE_DEBUGGER=OFF \ -DLIBOMP_FORTRAN_MODULES=OFF \ -DLIBOMP_ENABLE_SHARED=OFF \ -DLIBOMP_ARCH=wasm32 \ -DOPENMP_ENABLE_LIBOMPTARGET_PROFILING=OFF \ . emmake make -j
downstream libaries need to compile with
-pthread -fopenmp=libomp`
then link to libomp.a that was built above
Emscripten has dlopen and dlsym emulation under a flag, though other ways to use Clang won't provide that.