Skip to content

Commit ccb13fa

Browse files
committed
builds fully but still not working
1 parent bf367e1 commit ccb13fa

File tree

8 files changed

+38
-38
lines changed

8 files changed

+38
-38
lines changed

.github/workflows/build_llvm.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ jobs:
314314
###############################
315315
316316
$CCACHE -z
317-
pyodide build scripts/llvm_wasm -o wheelhouse --compression-level 10
317+
PYODIDE_BUILD_EXPORTS=whole_archive pyodide build scripts/llvm_wasm -o wheelhouse --compression-level 10
318318
$CCACHE -s
319319
320320
- name: Upload ccache log

.github/workflows/build_mlir_python_bindings_wheel.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ jobs:
214214
run: |
215215
216216
if [[ "${{ matrix.target-arch }}" == "wasm32" ]]; then
217-
pyodide build "$PWD/projects/mlir-python-bindings-wasm" -o wheelhouse --compression-level 10
217+
PYODIDE_BUILD_EXPORTS=whole_archive pyodide build "$PWD/projects/mlir-python-bindings-wasm" -o wheelhouse --compression-level 10
218218
else
219219
$python3_command -m cibuildwheel "$PWD/projects/mlir-python-bindings" --output-dir wheelhouse
220220
fi

projects/mlir-python-bindings-wasm/build.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/bin/bash
22

3+
TD="$(cd $(dirname $0) && pwd)"
4+
REPO_ROOT="$(cd $TD/../.. && pwd)"
35

46
if ! command -v pyodide >/dev/null 2>&1
57
then
@@ -33,4 +35,4 @@ if [[ "$OSTYPE" == "darwin"* ]]; then
3335
# the above doesn't work so you need to run in docker
3436
fi
3537

36-
pyodide build . -o wheelhouse --compression-level 10
38+
PYODIDE_SOURCEMAPS=1 PYODIDE_BUILD_EXPORTS=whole_archive pyodide build $TD -o $REPO_ROOT/wheelhouse --compression-level 10

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ Discussions = "https://discourse.llvm.org/"
2323
requires = [
2424
"scikit-build-core==0.10.7",
2525
"typing_extensions==4.12.2",
26-
"nanobind>=2.4, <3.0",
26+
# https://github.com/wjakob/nanobind/commit/dd350fe81931a1b362196cb415d188c36422766e#diff-8599263e788c107944d356ce118965942735cfbe16289ccf98ee5f8a33f0e808
27+
# error: static assertion failed due to requirement 'pyobj_name::total_count * sizeof(_object *) == 96'
28+
"nanobind>=2.4, <=2.9.2",
2729
"pybind11>=2.10.0, <=2.13.6",
2830
]
2931
build-backend = "scikit_build_core.build"
@@ -55,15 +57,13 @@ CMAKE_PLATFORM_NO_VERSIONED_SONAME = "ON"
5557
CMAKE_VISIBILITY_INLINES_HIDDEN = "ON"
5658
CMAKE_C_VISIBILITY_PRESET = "hidden"
5759
CMAKE_CXX_VISIBILITY_PRESET = "hidden"
58-
CMAKE_C_FLAGS = "-sLINKABLE"
59-
CMAKE_CXX_FLAGS = "-sLINKABLE"
6060
CMAKE_EXE_LINKER_FLAGS = "-sALLOW_TABLE_GROWTH -sASSERTIONS -sWASM_BIGINT"
6161
CMAKE_SHARED_LINKER_FLAGS = "-sALLOW_TABLE_GROWTH -sASSERTIONS -sWASM_BIGINT"
6262
CMAKE_MODULE_LINKER_FLAGS = "-sALLOW_TABLE_GROWTH -sASSERTIONS -sWASM_BIGINT"
63+
CMAKE_VERBOSE_MAKEFILE = "ON"
6364
# De-duplicate libraries on link lines based on linker capabilities.
6465
# minimum cmake version is 3.29
6566
CMAKE_POLICY_DEFAULT_CMP0156 = "NEW"
66-
CMAKE_VERBOSE_MAKEFILE = "ON"
6767

6868
# so that NATIVE doesn't try to get built
6969
LLVM_NATIVE_TOOL_DIR = { env = "LLVM_NATIVE_TOOL_DIR", default = "" }

scripts/llvm_wasm/Dockerfile

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,32 @@ FROM ubuntu
22

33
ENV DEBIAN_FRONTEND=noninteractive
44

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
5+
RUN apt-get update && apt-get -y install cmake python-is-python3 ninja-build python3-pip vim git unzip software-properties-common wget ripgrep pkg-config autoconf libtool curl
6+
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
7+
RUN echo 'source "/root/.cargo/env"' >> $HOME/.bashrc
78

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

1112
RUN python -m venv venv
12-
RUN /venv/bin/python -m pip install pip-tools pyodide-build==0.30.9
1313
RUN echo 'source "/venv/bin/activate"' >> $HOME/.bashrc
1414

15-
RUN git clone https://github.com/emscripten-core/emsdk.git
16-
# EMSCRIPTEN_VERSION=$(pyodide config get emscripten_version)
17-
RUN cd emsdk && \
18-
./emsdk install 4.0.9 ccache-git-emscripten-64bit && \
19-
./emsdk activate 4.0.9 ccache-git-emscripten-64bit && \
15+
RUN git clone --recursive https://github.com/pyodide/pyodide && \
16+
cd pyodide && \
17+
git checkout 0.29.0 && \
18+
git submodule update --init && \
19+
pip install -r requirements.txt && \
20+
touch src/core/jsproxy.h && \
21+
EXTRA_CFLAGS="-D DEBUG_F" EXTRA_LDFLAGS="-s ASSERTIONS=2" PYODIDE_SOURCEMAPS=1 make && \
22+
EXTRA_CFLAGS="-D DEBUG_F" EXTRA_LDFLAGS="-s ASSERTIONS=2" PYODIDE_SOURCEMAPS=1 make -C cpython rebuild-all && \
23+
EXTRA_CFLAGS="-D DEBUG_F" EXTRA_LDFLAGS="-s ASSERTIONS=2" PYODIDE_SOURCEMAPS=1 make all-but-packages && \
2024
cd ..
21-
RUN echo 'source "/emsdk/emsdk_env.sh"' >> $HOME/.bashrc
25+
26+
RUN . "/venv/bin/activate" && pip install /pyodide/pyodide-build
27+
28+
RUN /pyodide/emsdk/emsdk/emsdk install ccache-git-emscripten-64bit && \
29+
/pyodide/emsdk/emsdk/emsdk activate ccache-git-emscripten-64bit
30+
RUN echo 'source "/pyodide/emsdk/emsdk/emsdk_env.sh"' >> $HOME/.bashrc
31+
32+
# has to be after emscripten ccache because that build for some reason fails with 4.2.0
33+
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

scripts/llvm_wasm/build_llvm_wasm.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,4 @@ if [ -x "$(command -v $EMSDK/ccache/git-emscripten_64bit/bin/ccache)" ]; then
4040
export CMAKE_CXX_COMPILER_LAUNCHER="$CCACHE"
4141
fi
4242

43-
pyodide build $TD -o wheelhouse --compression-level 10
43+
PYODIDE_SOURCEMAPS=1 PYODIDE_BUILD_EXPORTS=whole_archive pyodide build $TD -o wheelhouse --compression-level 10

scripts/llvm_wasm/llvm_wasm_cache.cmake

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@ set(LLVM_ENABLE_RTTI ON CACHE BOOL "")
1212
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 "")
15-
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 "")
1915
# for ExecutionEngine
2016
set(LLVM_ENABLE_PIC ON CACHE BOOL "")
2117

scripts/llvm_wasm/pyproject.toml

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ Discussions = "https://discourse.llvm.org/"
2323
requires = [
2424
"scikit-build-core==0.10.7",
2525
"typing_extensions==4.12.2",
26-
"nanobind>=2.4, <3.0",
26+
# https://github.com/wjakob/nanobind/commit/dd350fe81931a1b362196cb415d188c36422766e#diff-8599263e788c107944d356ce118965942735cfbe16289ccf98ee5f8a33f0e808
27+
# error: static assertion failed due to requirement 'pyobj_name::total_count * sizeof(_object *) == 96'
28+
"nanobind>=2.4, <=2.9.2",
2729
"pybind11>=2.10.0, <=2.13.6",
2830
]
2931
build-backend = "scikit_build_core.build"
@@ -45,27 +47,15 @@ cmake.args = ["-C", "llvm_wasm_cache.cmake"]
4547
CMAKE_BUILD_TYPE = { env = "CMAKE_BUILD_TYPE", default = "Release" }
4648
CMAKE_C_COMPILER_LAUNCHER = { env = "CMAKE_C_COMPILER_LAUNCHER", default = "" }
4749
CMAKE_CXX_COMPILER_LAUNCHER = { env = "CMAKE_CXX_COMPILER_LAUNCHER", default = "" }
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"
50+
#CMAKE_C_FLAGS = "-sLINKABLE"
51+
#CMAKE_CXX_FLAGS = "-sLINKABLE"
52+
CMAKE_EXE_LINKER_FLAGS = "-sALLOW_TABLE_GROWTH -sASSERTIONS -sWASM_BIGINT "
6353
CMAKE_SHARED_LINKER_FLAGS = "-sALLOW_TABLE_GROWTH -sASSERTIONS -sWASM_BIGINT"
6454
CMAKE_MODULE_LINKER_FLAGS = "-sALLOW_TABLE_GROWTH -sASSERTIONS -sWASM_BIGINT"
55+
CMAKE_VERBOSE_MAKEFILE = "ON"
6556
# De-duplicate libraries on link lines based on linker capabilities.
6657
# minimum cmake version is 3.29
6758
CMAKE_POLICY_DEFAULT_CMP0156 = "NEW"
68-
CMAKE_VERBOSE_MAKEFILE = "ON"
6959

7060
# so that NATIVE doesn't try to get built
7161
LLVM_NATIVE_TOOL_DIR = { env = "LLVM_NATIVE_TOOL_DIR", default = "" }

0 commit comments

Comments
 (0)