diff --git a/.github/workflows/emscripten.yml b/.github/workflows/emscripten.yml index 381feb564..18db5a608 100644 --- a/.github/workflows/emscripten.yml +++ b/.github/workflows/emscripten.yml @@ -575,6 +575,7 @@ jobs: -DCODE_COVERAGE=${{ env.CODE_COVERAGE }} \ -DCMAKE_INSTALL_PREFIX=$PREFIX \ -DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ON \ + -DLLVM_ENABLE_WERROR=On \ ../ else emcmake cmake -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \ @@ -586,6 +587,7 @@ jobs: -DCODE_COVERAGE=${{ env.CODE_COVERAGE }} \ -DCMAKE_INSTALL_PREFIX=$PREFIX \ -DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ON \ + -DLLVM_ENABLE_WERROR=On \ ../ fi diff --git a/lib/Interpreter/CMakeLists.txt b/lib/Interpreter/CMakeLists.txt index ba699dc83..933505691 100644 --- a/lib/Interpreter/CMakeLists.txt +++ b/lib/Interpreter/CMakeLists.txt @@ -17,6 +17,14 @@ if(EMSCRIPTEN) LINK_LIBS clangInterpreter ) + #FIXME: Setting no_soname=1 is needed until https://github.com/emscripten-core/emscripten/blob/ac676d5e437525d15df5fd46bc2c208ec6d376a3/cmake/Modules/Platform/Emscripten.cmake#L36 + # is patched out of emsdk, as --soname is not recognised by emscripten. A PR to do this has been done here https://github.com/emscripten-core/emscripten/pull/23453 + #FIXME: A patch is needed to llvm to remove -Wl,-z,defs since it is now recognised on emscripten. What needs to be removed is here + # https://github.com/llvm/llvm-project/blob/128e2e446e90c3b1827cfc7d4d19e3c0976beff3/llvm/cmake/modules/HandleLLVMOptions.cmake#L318 . The PR to do try to do this is here + # https://github.com/llvm/llvm-project/pull/123396 + set_target_properties(clangCppInterOp + PROPERTIES NO_SONAME 1 +) target_link_options(clangCppInterOp PRIVATE PUBLIC "SHELL: -s WASM_BIGINT" ) diff --git a/patches/llvm/emscripten-clang19-3-remove-zdefs.patch b/patches/llvm/emscripten-clang19-3-remove-zdefs.patch new file mode 100644 index 000000000..6d897e067 --- /dev/null +++ b/patches/llvm/emscripten-clang19-3-remove-zdefs.patch @@ -0,0 +1,13 @@ +diff --git a/llvm/cmake/modules/HandleLLVMOptions.cmake b/llvm/cmake/modules/HandleLLVMOptions.cmake +index 5ca580fbb..cff186b7b 100644 +--- a/llvm/cmake/modules/HandleLLVMOptions.cmake ++++ b/llvm/cmake/modules/HandleLLVMOptions.cmake +@@ -302,7 +302,7 @@ endif() + + # Pass -Wl,-z,defs. This makes sure all symbols are defined. Otherwise a DSO + # build might work on ELF but fail on MachO/COFF. +-if(NOT (CMAKE_SYSTEM_NAME MATCHES "Darwin|FreeBSD|OpenBSD|DragonFly|AIX|OS390" OR ++if(NOT (CMAKE_SYSTEM_NAME MATCHES "Darwin|FreeBSD|OpenBSD|DragonFly|AIX|OS390|Emscripten" OR + WIN32 OR CYGWIN) AND + NOT LLVM_USE_SANITIZER) + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,defs")