Skip to content

Commit bf367e1

Browse files
committed
fix
1 parent 2beee39 commit bf367e1

File tree

4 files changed

+33
-13
lines changed

4 files changed

+33
-13
lines changed

projects/mlir-python-bindings-wasm/pyproject.toml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,14 @@ CMAKE_PLATFORM_NO_VERSIONED_SONAME = "ON"
5555
CMAKE_VISIBILITY_INLINES_HIDDEN = "ON"
5656
CMAKE_C_VISIBILITY_PRESET = "hidden"
5757
CMAKE_CXX_VISIBILITY_PRESET = "hidden"
58-
# re -Wno-undefined see https://github.com/emscripten-core/emscripten/issues/21516
59-
# missing symbol: _LLVMAddSymbol
60-
CMAKE_EXE_LINKER_FLAGS = "-sALLOW_TABLE_GROWTH -sASSERTIONS -sWASM_BIGINT -Wno-undefined"
61-
CMAKE_SHARED_LINKER_FLAGS = "-sALLOW_TABLE_GROWTH -sASSERTIONS -sWASM_BIGINT -Wno-undefined"
62-
CMAKE_MODULE_LINKER_FLAGS = "-sALLOW_TABLE_GROWTH -sASSERTIONS -sWASM_BIGINT -Wno-undefined"
58+
CMAKE_C_FLAGS = "-sLINKABLE"
59+
CMAKE_CXX_FLAGS = "-sLINKABLE"
60+
CMAKE_EXE_LINKER_FLAGS = "-sALLOW_TABLE_GROWTH -sASSERTIONS -sWASM_BIGINT"
61+
CMAKE_SHARED_LINKER_FLAGS = "-sALLOW_TABLE_GROWTH -sASSERTIONS -sWASM_BIGINT"
62+
CMAKE_MODULE_LINKER_FLAGS = "-sALLOW_TABLE_GROWTH -sASSERTIONS -sWASM_BIGINT"
63+
# De-duplicate libraries on link lines based on linker capabilities.
64+
# minimum cmake version is 3.29
65+
CMAKE_POLICY_DEFAULT_CMP0156 = "NEW"
6366
CMAKE_VERBOSE_MAKEFILE = "ON"
6467

6568
# so that NATIVE doesn't try to get built

scripts/llvm_wasm/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ FROM ubuntu
22

33
ENV DEBIAN_FRONTEND=noninteractive
44

5-
RUN apt-get update && apt-get -y install python-is-python3 cmake ninja-build python3-pip vim git unzip software-properties-common
5+
RUN apt-get update && apt-get -y install python-is-python3 ninja-build python3-pip vim git unzip software-properties-common wget
6+
RUN wget https://github.com/Kitware/CMake/releases/download/v4.2.0/cmake-4.2.0-linux-aarch64.sh && bash cmake-4.2.0-linux-aarch64.sh --skip-license --prefix=/usr
67

78
RUN add-apt-repository -y ppa:deadsnakes/ppa && apt update && apt -y install python3.13 python3.13-venv
89
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.13 99

scripts/llvm_wasm/llvm_wasm_cache.cmake

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ set(LLVM_HOST_TRIPLE "wasm32-unknown-emscripten" CACHE STRING "")
1313
set(LLVM_TARGETS_TO_BUILD "WebAssembly" CACHE STRING "")
1414
set(LLVM_TARGET_ARCH "wasm32" CACHE STRING "")
1515

16-
set(LLVM_BUILD_STATIC ON CACHE BOOL "")
16+
# For LLVM_ABI and LLVM_C_ABI
17+
set(LLVM_ENABLE_LLVM_EXPORT_ANNOTATIONS ON CACHE BOOL "")
18+
set(LLVM_BUILD_STATIC OFF CACHE BOOL "")
1719
# for ExecutionEngine
1820
set(LLVM_ENABLE_PIC ON CACHE BOOL "")
1921

@@ -58,7 +60,6 @@ set(LLVM_MlirDevelopment_DISTRIBUTION_COMPONENTS
5860
lld-cmake-exports
5961
lld-mlirdevelopment-cmake-exports
6062

61-
llvm-config
6263
llvm-headers
6364
llvm-libraries
6465

scripts/llvm_wasm/pyproject.toml

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,26 @@ cmake.args = ["-C", "llvm_wasm_cache.cmake"]
4545
CMAKE_BUILD_TYPE = { env = "CMAKE_BUILD_TYPE", default = "Release" }
4646
CMAKE_C_COMPILER_LAUNCHER = { env = "CMAKE_C_COMPILER_LAUNCHER", default = "" }
4747
CMAKE_CXX_COMPILER_LAUNCHER = { env = "CMAKE_CXX_COMPILER_LAUNCHER", default = "" }
48-
# re -Wno-undefined see https://github.com/emscripten-core/emscripten/issues/21516
49-
# missing symbol: _LLVMAddSymbol
50-
CMAKE_EXE_LINKER_FLAGS = "-sALLOW_TABLE_GROWTH -sASSERTIONS -sWASM_BIGINT -Wno-undefined"
51-
CMAKE_SHARED_LINKER_FLAGS = "-sALLOW_TABLE_GROWTH -sASSERTIONS -sWASM_BIGINT -Wno-undefined"
52-
CMAKE_MODULE_LINKER_FLAGS = "-sALLOW_TABLE_GROWTH -sASSERTIONS -sWASM_BIGINT -Wno-undefined"
48+
# https://github.com/emscripten-core/emscripten/issues/25911
49+
# https://github.com/pyodide/pyodide/blob/7f2feb1a673b7b610cf17bfc8a48727687843cd3/docs/development/abi.md?plain=1#L40C34-L40C49
50+
# Linking a shared libraries with `-sSIDE_MODULE=1` will pass `-whole-archive` to
51+
#`wasm-ld` and so force inclusion of all object files and all symbols. Linking
52+
# with `-sSIDE_MODULE=2` will only include symbols that are explicitly listed with
53+
#`-sEXPORTED_FUNCTIONS=<export list>`. The name of each symbol in the list must
54+
# be prefixed with an underscore.
55+
# https://github.com/emscripten-core/emscripten/blob/04fda5c8e488985bd5825a11e21373316dd133e4/site/source/docs/getting_started/FAQ.rst?plain=1#L461-L463
56+
# https://github.com/pyodide/pyodide/blob/7f2feb1a673b7b610cf17bfc8a48727687843cd3/docs/development/abi.md
57+
58+
#CMAKE_C_FLAGS = "-sLINKABLE -Wl,-allow-multiple-definition"
59+
#CMAKE_CXX_FLAGS = "-sLINKABLE -Wl,-allow-multiple-definition"
60+
CMAKE_C_FLAGS = "-sLINKABLE"
61+
CMAKE_CXX_FLAGS = "-sLINKABLE"
62+
CMAKE_EXE_LINKER_FLAGS = "-sALLOW_TABLE_GROWTH -sASSERTIONS -sWASM_BIGINT"
63+
CMAKE_SHARED_LINKER_FLAGS = "-sALLOW_TABLE_GROWTH -sASSERTIONS -sWASM_BIGINT"
64+
CMAKE_MODULE_LINKER_FLAGS = "-sALLOW_TABLE_GROWTH -sASSERTIONS -sWASM_BIGINT"
65+
# De-duplicate libraries on link lines based on linker capabilities.
66+
# minimum cmake version is 3.29
67+
CMAKE_POLICY_DEFAULT_CMP0156 = "NEW"
5368
CMAKE_VERBOSE_MAKEFILE = "ON"
5469

5570
# so that NATIVE doesn't try to get built

0 commit comments

Comments
 (0)