Skip to content

Commit 5ca8125

Browse files
ax3lclaude
andcommitted
CI: install wasm zlib + HDF5 into the Emscripten sysroot
The Emscripten/WASM jobs were red: HDF5's own static build failed with "Could NOT find ZLIB ... non-existent target ZLIB::ZLIB". Emscripten restricts find_package() to CMAKE_FIND_ROOT_PATH (= the sysroot), so a custom-prefix -DZLIB_ROOT / CMAKE_PREFIX_PATH is silently ignored (the same static-HDF5 packaging gap #1894 works around downstream). Install the static zlib + HDF5 into the active Emscripten sysroot (em-config CACHE), as library_builders.sh does, so find_package(ZLIB)/find_package(HDF5) locate them with no extra hints -- in the HDF5 dep build, the openPMD configure, and the Pyodide wheel build alike. Also pin setup-emsdk to 'latest' ('5.0.3' is Pyodide's fork tag and silently fell back to emsdk main). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent cea3eae commit 5ca8125

2 files changed

Lines changed: 10 additions & 9 deletions

File tree

.github/ci/wasm_deps.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,18 @@
55
# License: LGPLv3+
66
#
77
# Cross-compile openPMD-api's static C/C++ dependencies (zlib + HDF5) for
8-
# wasm32-emscripten into the prefix given as $1 (put on CMAKE_PREFIX_PATH).
8+
# wasm32-emscripten and install them into the active Emscripten sysroot, where a
9+
# later find_package() locates them: Emscripten restricts find_package to
10+
# CMAKE_FIND_ROOT_PATH (= the sysroot), so a custom prefix is silently ignored.
911
# Flags mirror the Pyodide wheel builder (library_builders.sh) so the test build
1012
# matches the shipped wheel; the co-load-only -fvisibility=hidden is omitted here
1113
# (the test executables are standalone, not side modules).
1214
#
13-
# Requires an active Emscripten SDK on PATH (emcmake/emcc).
15+
# Requires an active Emscripten SDK on PATH (emcmake/emcc/em-config).
1416

1517
set -eu -o pipefail
1618

17-
PREFIX="${1:?usage: wasm_deps.sh <install-prefix>}"
19+
PREFIX="$(em-config CACHE)/sysroot"
1820
ZLIB_VERSION="${ZLIB_VERSION:-1.3.1}"
1921
HDF5_VERSION="${HDF5_VERSION:-1.14.6}"
2022

.github/workflows/wasm.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,16 @@ jobs:
2323
with:
2424
node-version: '22'
2525

26-
# Keep the Emscripten version aligned with Pyodide's as it advances.
26+
# Latest stable Emscripten (the standalone C++ suite is version-tolerant;
27+
# Pyodide's exact toolchain is exercised by the pyodide-python job below).
2728
- name: Emscripten SDK
2829
uses: mymindstorm/setup-emsdk@v14
2930
with:
30-
version: '5.0.3'
31+
version: 'latest'
3132
actions-cache-folder: 'emsdk-cache'
3233

3334
- name: Static wasm dependencies (zlib + HDF5)
34-
run: bash .github/ci/wasm_deps.sh "${GITHUB_WORKSPACE}/wasm-deps"
35+
run: bash .github/ci/wasm_deps.sh
3536

3637
# CMAKE_CROSSCOMPILING_EMULATOR=node -> ctest runs each test binary via node.
3738
# NODERAWFS gives the test binaries the real filesystem (HDF5/JSON file I/O);
@@ -47,7 +48,6 @@ jobs:
4748
-DopenPMD_BUILD_EXAMPLES=OFF \
4849
-DHDF5_USE_STATIC_LIBRARIES=ON \
4950
-DZLIB_USE_STATIC_LIBS=ON \
50-
-DCMAKE_PREFIX_PATH="${GITHUB_WORKSPACE}/wasm-deps" \
5151
-DCMAKE_CROSSCOMPILING_EMULATOR=node \
5252
-DCMAKE_C_FLAGS="-sSUPPORT_LONGJMP=wasm" \
5353
-DCMAKE_CXX_FLAGS="-fwasm-exceptions -sSUPPORT_LONGJMP=wasm" \
@@ -92,14 +92,13 @@ jobs:
9292
env:
9393
CIBW_BUILD: "cp314-pyodide_wasm32"
9494
CIBW_TEST_SKIP: "*"
95-
CIBW_BEFORE_BUILD_PYODIDE: "bash .github/ci/wasm_deps.sh /tmp/wasm-deps"
95+
CIBW_BEFORE_BUILD_PYODIDE: "bash .github/ci/wasm_deps.sh"
9696
CIBW_ENVIRONMENT_PYODIDE: >
9797
openPMD_CMAKE_openPMD_USE_HDF5='ON'
9898
openPMD_CMAKE_openPMD_USE_ADIOS2='OFF'
9999
openPMD_USE_MPI='OFF'
100100
HDF5_USE_STATIC_LIBRARIES='ON'
101101
ZLIB_USE_STATIC_LIBS='ON'
102-
CMAKE_PREFIX_PATH='/tmp/wasm-deps'
103102
104103
# Load the wheel in a Pyodide venv (runs Python in node) and execute the full
105104
# unittest suite. Test.py reads sample data from ../samples relative to its

0 commit comments

Comments
 (0)