From 5c0c854f6aae850ccfaf0f15c0d03bb44cb6e0eb Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Tue, 13 Oct 2026 10:33:46 +0000 Subject: [PATCH 1/4] Add jxlpy riscv64 wheel build jxlpy (JPEG XL / libjxl Cython bindings) builds a C++ extension that links against a system-installed libjxl, which the manylinux_riscv64 image doesn't ship. Mirror upstream's own packaging.yml: build libjxl from source via CMake in CIBW_BEFORE_ALL (same v0.10.1 tag, same disabled TESTING/BENCHMARK/TOOLS/DEVTOOLS flags), install to /usr/local, and let cibuildwheel's default auditwheel repair bundle the resulting libjxl/libjxl_threads/brotli shared libraries. No SIMD hard requirement: no -march flag is passed anywhere in this build, so vendored highway collapses to its portable EMU128/SCALAR baseline on riscv64 rather than requiring RVV hardware. --- .github/workflows/build-jxlpy.yml | 156 ++++++++++++++++++++++++++++++ docs/packages/jxlpy.yaml | 5 + 2 files changed, 161 insertions(+) create mode 100644 .github/workflows/build-jxlpy.yml create mode 100644 docs/packages/jxlpy.yaml diff --git a/.github/workflows/build-jxlpy.yml b/.github/workflows/build-jxlpy.yml new file mode 100644 index 000000000000..a44eeaec4935 --- /dev/null +++ b/.github/workflows/build-jxlpy.yml @@ -0,0 +1,156 @@ +# SPDX-FileCopyrightText: 2026 The RISE Project +# SPDX-License-Identifier: MIT +--- +# This workflow is based on the `wheels` job of +# https://github.com/olokelo/jxlpy/blob/0.9.5/.github/workflows/packaging.yml +name: Build jxlpy wheels (riscv64) + +on: + workflow_dispatch: + inputs: + version: + description: 'Version glob to (re)build; empty builds every version of docs/packages/jxlpy.yaml not released yet' + required: false + default: '' + pull_request: + branches: [main] + paths: + - '.github/workflows/build-jxlpy.yml' + - 'docs/packages/jxlpy.yaml' + push: + branches: [main] + paths: + - '.github/workflows/build-jxlpy.yml' + - 'docs/packages/jxlpy.yaml' + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +permissions: + contents: read # to fetch code (actions/checkout) + +env: + # Tag that upstream's own packaging.yml pins at the jxlpy 0.9.5 release. + LIBJXL_TAG: v0.10.1 + MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64 + +jobs: + setup: + uses: $/.github/workflows/_setup.yml + with: + package: jxlpy + version: ${{ inputs.version }} + + build_wheels: + needs: [setup] + if: needs.setup.outputs.versions != '[]' + name: Build jxlpy ${{ matrix.version }} ${{ matrix.python }}-manylinux_riscv64 + runs-on: ubuntu-24.04-riscv + timeout-minutes: 90 + strategy: + fail-fast: false + matrix: + version: ${{ fromJSON(needs.setup.outputs.versions) }} + python: ["cp310", "cp311", "cp312", "cp313", "cp314"] + + env: + JXLPY_VERSION: ${{ matrix.version }} + + steps: + - name: Checkout jxlpy v${{ env.JXLPY_VERSION }} + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + repository: olokelo/jxlpy + ref: ${{ env.JXLPY_VERSION }} + persist-credentials: false + + - name: Build wheels + uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 + with: + output-dir: wheelhouse/ + only: ${{ matrix.python }}-manylinux_riscv64 + env: + CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} + CIBW_ENVIRONMENT_PASS_LINUX: LIBJXL_TAG + # setup.py's extra_link_args is a bare `-ljxl -ljxl_threads` with no + # include_dirs/library_dirs, same as upstream's own CIBW_BEFORE_ALL: build + # libjxl from source and install it to the default /usr/local prefix. + # No `-march=`/SIMD flag is passed anywhere in this configure line, so + # highway (vendored, statically linked into libjxl.so) collapses to its + # portable EMU128/SCALAR baseline on riscv64 - same reasoning as + # pillow-jxl-plugin's CIBW_BEFORE_ALL_LINUX comment (gotchas 139/272/279/448). + CIBW_BEFORE_ALL_LINUX: >- + git clone --recursive --shallow-submodules https://github.com/libjxl/libjxl.git /tmp/libjxl && + cd /tmp/libjxl && + git checkout "$LIBJXL_TAG" && + mkdir build && cd build && + cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF + -DJPEGXL_ENABLE_BENCHMARK=OFF -DJPEGXL_ENABLE_TOOLS=OFF -DJPEGXL_ENABLE_DEVTOOLS=OFF .. && + cmake --build . -- -j$(nproc) && + cmake --install . && + cp ./third_party/brotli/*.so* /usr/local/lib && + ldconfig && + cat /tmp/libjxl/LICENSE /tmp/libjxl/PATENTS > {package}/LICENSE.libjxl && + cp /tmp/libjxl/third_party/highway/LICENSE {package}/LICENSE.highway && + cp /tmp/libjxl/third_party/brotli/LICENSE {package}/LICENSE.brotli && + cp /tmp/libjxl/third_party/skcms/LICENSE {package}/LICENSE.skcms + CIBW_ENVIRONMENT: LIBRARY_PATH=/usr/local/lib LD_LIBRARY_PATH=/usr/local/lib + # No formal test suite upstream, only examples/*.py; exercise the same + # encode -> decode round trip as examples/encode_simple.py + + # examples/decode_simple.py through the installed wheel. + CIBW_TEST_COMMAND: >- + python -c " + import jxlpy; + print('jxlpy', jxlpy.__version__, 'libjxl', jxlpy._jxl_version); + size = (64, 64); + data = bytes([0, 188, 212] * (size[0] * size[1])); + enc = jxlpy.JXLPyEncoder(quality=100, colorspace='RGB', size=size, effort=7); + enc.add_frame(data); + payload = enc.get_output(); + assert len(payload) > 0, 'empty encoder output'; + dec = jxlpy.JXLPyDecoder(payload); + info = dec.get_info(); + assert (info['xsize'], info['ysize']) == size, info; + assert dec.get_colorspace() == 'RGB', dec.get_colorspace(); + frame = dec.get_frame(); + assert frame is not None and list(frame[:3]) == [0, 188, 212], frame; + print('jxlpy OK') + " + + - name: Check the wheel contents + run: | + python3 - wheelhouse/*.whl <<'EOF' + import sys, zipfile + for whl in sys.argv[1:]: + names = zipfile.ZipFile(whl).namelist() + assert any(n.startswith("_jxlpy") and n.endswith(".so") for n in names), whl + licenses = sorted(n.rsplit("/", 1)[1] for n in names if ".dist-info/licenses/" in n) + print(whl, "licenses:", licenses) + for expect in ("LICENSE", "LICENSE.libjxl", "LICENSE.highway", "LICENSE.brotli", "LICENSE.skcms"): + assert expect in licenses, (whl, expect, licenses) + print(whl, "ok") + EOF + + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: jxlpy-${{ env.JXLPY_VERSION }}-${{ matrix.python }}-manylinux_riscv64 + path: wheelhouse/*.whl + if-no-files-found: error + + publish: + name: Publish jxlpy ${{ matrix.version }} + needs: [setup, build_wheels] + if: needs.setup.outputs.versions != '[]' + strategy: + fail-fast: false + matrix: + version: ${{ fromJSON(needs.setup.outputs.versions) }} + permissions: + contents: write + pull-requests: write + uses: $/.github/workflows/_publish-wheel.yml + secrets: + app-private-key: ${{ secrets.RISEPROJECT_APP_PRIVATE_KEY }} + with: + artifact-pattern: jxlpy-${{ matrix.version }}-*-manylinux_riscv64 diff --git a/docs/packages/jxlpy.yaml b/docs/packages/jxlpy.yaml new file mode 100644 index 000000000000..52151b7fdfb4 --- /dev/null +++ b/docs/packages/jxlpy.yaml @@ -0,0 +1,5 @@ +package-name: jxlpy +source-code: https://github.com/olokelo/jxlpy +license: MIT +versions: +- version: 0.9.5 From 65a87f5d145aff2bd9096ed8941e191af78a65b9 Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Fri, 16 Oct 2026 01:00:45 +0000 Subject: [PATCH 2/4] build-jxlpy: disable libjxl example executables on riscv64 cp312 and cp314 CI both fail identically at the CIBW_BEFORE_ALL_LINUX libjxl build step: linking examples/encode_oneshot fails with "undefined reference to skcms_private::baseline::run_program" against libjxl_cms.so. This is a libjxl/skcms toolchain issue on riscv64 in the example build, unrelated to jxlpy's cp310/cp311/cp313 (the cancelled legs would have hit it too - it is not interpreter-specific). The three examples (decode_oneshot, decode_progressive, encode_oneshot) are never used: setup.py only links -ljxl -ljxl_threads. Pass -DJPEGXL_ENABLE_EXAMPLES=OFF alongside the existing BENCHMARK/TOOLS/DEVTOOLS=OFF flags to skip building them. --- .github/workflows/build-jxlpy.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-jxlpy.yml b/.github/workflows/build-jxlpy.yml index a44eeaec4935..604994991392 100644 --- a/.github/workflows/build-jxlpy.yml +++ b/.github/workflows/build-jxlpy.yml @@ -80,13 +80,19 @@ jobs: # highway (vendored, statically linked into libjxl.so) collapses to its # portable EMU128/SCALAR baseline on riscv64 - same reasoning as # pillow-jxl-plugin's CIBW_BEFORE_ALL_LINUX comment (gotchas 139/272/279/448). + # -DJPEGXL_ENABLE_EXAMPLES=OFF: the default-on examples/encode_oneshot + # fails to link on riscv64 (undefined reference to + # skcms_private::baseline::run_program - a libjxl/skcms toolchain issue + # unrelated to jxlpy); none of the three examples are needed to build or + # install the libjxl.so/libjxl_threads.so that setup.py links against. CIBW_BEFORE_ALL_LINUX: >- git clone --recursive --shallow-submodules https://github.com/libjxl/libjxl.git /tmp/libjxl && cd /tmp/libjxl && git checkout "$LIBJXL_TAG" && mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF - -DJPEGXL_ENABLE_BENCHMARK=OFF -DJPEGXL_ENABLE_TOOLS=OFF -DJPEGXL_ENABLE_DEVTOOLS=OFF .. && + -DJPEGXL_ENABLE_BENCHMARK=OFF -DJPEGXL_ENABLE_TOOLS=OFF -DJPEGXL_ENABLE_DEVTOOLS=OFF + -DJPEGXL_ENABLE_EXAMPLES=OFF .. && cmake --build . -- -j$(nproc) && cmake --install . && cp ./third_party/brotli/*.so* /usr/local/lib && From 2d94e1a940baef771d89cd267e1090a6d31c4703 Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Fri, 23 Oct 2026 16:04:58 +0000 Subject: [PATCH 3/4] build-jxlpy: fix IndentationError in CIBW_TEST_COMMAND The folded >- scalar turned the newline after python -c " into a leading space before the first statement, which CPython 3.10-3.13 reject with IndentationError. Keep the first statement on the same line as the opening quote. --- .github/workflows/build-jxlpy.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/build-jxlpy.yml b/.github/workflows/build-jxlpy.yml index 604994991392..468cc0d1e1f7 100644 --- a/.github/workflows/build-jxlpy.yml +++ b/.github/workflows/build-jxlpy.yml @@ -106,8 +106,7 @@ jobs: # encode -> decode round trip as examples/encode_simple.py + # examples/decode_simple.py through the installed wheel. CIBW_TEST_COMMAND: >- - python -c " - import jxlpy; + python -c "import jxlpy; print('jxlpy', jxlpy.__version__, 'libjxl', jxlpy._jxl_version); size = (64, 64); data = bytes([0, 188, 212] * (size[0] * size[1])); From 90929fe8a3211e21b9341360d53c851fd9589577 Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Sun, 25 Oct 2026 18:01:10 +0000 Subject: [PATCH 4/4] build-jxlpy: sync libjxl submodules to the pinned tag git checkout only moves the superproject tree; it never re-syncs already-cloned submodules, so --recursive's initial clone leaves third_party/skcms (and the other submodules) pinned to libjxl's default branch instead of v0.10.1. That newer skcms restructured its internal namespacing, so the cp310 build linked libjxl_cms.so against a mismatched skcms and failed at import time with an undefined symbol (skcms_private::baseline::run_program) - riscv64-specific because it's the one path whose linkage shape changed between the two skcms commits. Add `git submodule update --init --recursive` after the tag checkout to fix it. --- .github/workflows/build-jxlpy.yml | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-jxlpy.yml b/.github/workflows/build-jxlpy.yml index 468cc0d1e1f7..410708672356 100644 --- a/.github/workflows/build-jxlpy.yml +++ b/.github/workflows/build-jxlpy.yml @@ -81,14 +81,27 @@ jobs: # portable EMU128/SCALAR baseline on riscv64 - same reasoning as # pillow-jxl-plugin's CIBW_BEFORE_ALL_LINUX comment (gotchas 139/272/279/448). # -DJPEGXL_ENABLE_EXAMPLES=OFF: the default-on examples/encode_oneshot - # fails to link on riscv64 (undefined reference to - # skcms_private::baseline::run_program - a libjxl/skcms toolchain issue - # unrelated to jxlpy); none of the three examples are needed to build or - # install the libjxl.so/libjxl_threads.so that setup.py links against. + # aren't needed to build or install the libjxl.so/libjxl_threads.so + # that setup.py links against. + # + # `git clone --recursive` populates the submodules (incl. + # third_party/skcms) at whatever commit libjxl's *default* branch + # pins them to; `git checkout "$LIBJXL_TAG"` only moves the + # superproject tree - it does not re-sync already-checked-out + # submodules to what that tag pins them to (plain `git checkout` + # never does, with or without --recursive at clone time). Without + # the `git submodule update` below, the build links libjxl_cms.so + # against a skcms commit newer than v0.10.1 actually vendors, which + # restructured its internal namespacing - that produced an + # undefined symbol (skcms_private::baseline::run_program) at import + # time on riscv64 specifically because riscv64 takes skcms's + # generic/portable SIMD-less code path, the one path whose exact + # linkage shape changed between those two skcms commits. CIBW_BEFORE_ALL_LINUX: >- git clone --recursive --shallow-submodules https://github.com/libjxl/libjxl.git /tmp/libjxl && cd /tmp/libjxl && git checkout "$LIBJXL_TAG" && + git submodule update --init --recursive && mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF -DJPEGXL_ENABLE_BENCHMARK=OFF -DJPEGXL_ENABLE_TOOLS=OFF -DJPEGXL_ENABLE_DEVTOOLS=OFF