Skip to content

Commit d9aef11

Browse files
authored
Remove all warnings from emscripten build and set warnings as errors wasm build
1 parent 04f45b2 commit d9aef11

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

.github/workflows/emscripten.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -571,6 +571,7 @@ jobs:
571571
-DCODE_COVERAGE=${{ env.CODE_COVERAGE }} \
572572
-DCMAKE_INSTALL_PREFIX=$PREFIX \
573573
-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ON \
574+
-DLLVM_ENABLE_WERROR=On \
574575
../
575576
else
576577
emcmake cmake -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
@@ -582,6 +583,7 @@ jobs:
582583
-DCODE_COVERAGE=${{ env.CODE_COVERAGE }} \
583584
-DCMAKE_INSTALL_PREFIX=$PREFIX \
584585
-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ON \
586+
-DLLVM_ENABLE_WERROR=On \
585587
../
586588
fi
587589

lib/Interpreter/CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@ if(EMSCRIPTEN)
1717
LINK_LIBS
1818
clangInterpreter
1919
)
20+
#FIXME: Setting no_soname=1 is needed until https://github.com/emscripten-core/emscripten/blob/ac676d5e437525d15df5fd46bc2c208ec6d376a3/cmake/Modules/Platform/Emscripten.cmake#L36
21+
# 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
22+
#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
23+
# https://github.com/llvm/llvm-project/blob/128e2e446e90c3b1827cfc7d4d19e3c0976beff3/llvm/cmake/modules/HandleLLVMOptions.cmake#L318 . The PR to do try to do this is here
24+
# https://github.com/llvm/llvm-project/pull/123396
25+
set_target_properties(clangCppInterOp
26+
PROPERTIES NO_SONAME 1
27+
)
2028
target_link_options(clangCppInterOp PRIVATE
2129
PUBLIC "SHELL: -s WASM_BIGINT"
2230
)
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/llvm/cmake/modules/HandleLLVMOptions.cmake b/llvm/cmake/modules/HandleLLVMOptions.cmake
2+
index 5ca580fbb..cff186b7b 100644
3+
--- a/llvm/cmake/modules/HandleLLVMOptions.cmake
4+
+++ b/llvm/cmake/modules/HandleLLVMOptions.cmake
5+
@@ -302,7 +302,7 @@ endif()
6+
7+
# Pass -Wl,-z,defs. This makes sure all symbols are defined. Otherwise a DSO
8+
# build might work on ELF but fail on MachO/COFF.
9+
-if(NOT (CMAKE_SYSTEM_NAME MATCHES "Darwin|FreeBSD|OpenBSD|DragonFly|AIX|OS390" OR
10+
+if(NOT (CMAKE_SYSTEM_NAME MATCHES "Darwin|FreeBSD|OpenBSD|DragonFly|AIX|OS390|Emscripten" OR
11+
WIN32 OR CYGWIN) AND
12+
NOT LLVM_USE_SANITIZER)
13+
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,defs")

0 commit comments

Comments
 (0)