From 0bf413649369e32bbd53221b2a7123cdfdf46cf4 Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Thu, 15 Oct 2026 15:05:42 +0000 Subject: [PATCH 1/2] vmprof: add riscv64 wheel build Mirrors upstream's own cibuildwheel.yml: meson-python build of the _vmprof C extension against system libunwind, narrowed to riscv64. Upstream skips free-threaded wheels (vmprof does not support Py_GIL_DISABLED), so this drops cp314t from the matrix the same way. --- .github/workflows/build-vmprof.yml | 110 +++++++++++++++++++++++++++++ docs/packages/vmprof.yaml | 5 ++ 2 files changed, 115 insertions(+) create mode 100644 .github/workflows/build-vmprof.yml create mode 100644 docs/packages/vmprof.yaml diff --git a/.github/workflows/build-vmprof.yml b/.github/workflows/build-vmprof.yml new file mode 100644 index 00000000000..7bc2ea41993 --- /dev/null +++ b/.github/workflows/build-vmprof.yml @@ -0,0 +1,110 @@ +# SPDX-FileCopyrightText: 2026 The RISE Project +# SPDX-License-Identifier: MIT +--- +# Based on: https://github.com/vmprof/vmprof-python/blob/release-0.6.0/.github/workflows/cibuildwheel.yml +name: Build vmprof wheels (riscv64) + +on: + workflow_dispatch: + inputs: + version: + description: 'Version glob to (re)build; empty builds every version of docs/packages/vmprof.yaml not released yet' + required: false + default: '' + pull_request: + branches: [main] + paths: + - '.github/workflows/build-vmprof.yml' + - 'docs/packages/vmprof.yaml' + push: + branches: [main] + paths: + - '.github/workflows/build-vmprof.yml' + - 'docs/packages/vmprof.yaml' + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +permissions: + contents: read # to fetch code (actions/checkout) + +env: + MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64 + +jobs: + setup: + uses: $/.github/workflows/_setup.yml + with: + package: vmprof + version: ${{ inputs.version }} + + build_wheels: + needs: [setup] + if: needs.setup.outputs.versions != '[]' + name: Build vmprof ${{ matrix.version }} ${{ matrix.python }}-manylinux_riscv64 + runs-on: ubuntu-24.04-riscv + timeout-minutes: 60 + strategy: + fail-fast: false + matrix: + version: ${{ fromJSON(needs.setup.outputs.versions) }} + # Upstream's own CIBW_SKIP drops cp3*t-*: vmprof does not support + # free-threaded CPython. + python: ["cp312", "cp313", "cp314"] + + env: + VMPROF_VERSION: ${{ matrix.version }} + + steps: + - name: Checkout vmprof ${{ env.VMPROF_VERSION }} + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + repository: vmprof/vmprof-python + ref: ${{ env.VMPROF_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_BEFORE_BUILD_LINUX: dnf install -y libunwind-devel + CIBW_TEST_GROUPS: test + CIBW_TEST_COMMAND: cd {package} && pytest vmprof jitlog -vv + + - name: Check the wheel ships the extension and licence + run: | + python3 - wheelhouse/*.whl <<'EOF' + import sys, zipfile + for whl in sys.argv[1:]: + names = zipfile.ZipFile(whl).namelist() + assert any(n.startswith("vmprof/") and n.endswith(".so") for n in names), whl + assert any(n.endswith(".dist-info/licenses/LICENSE") for n in names), whl + print(whl, "ok") + EOF + + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: vmprof-${{ env.VMPROF_VERSION }}-${{ matrix.python }}-manylinux_riscv64 + path: ./wheelhouse/*.whl + if-no-files-found: error + + publish: + name: Publish vmprof ${{ 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: vmprof-${{ matrix.version }}-*-manylinux_riscv64 diff --git a/docs/packages/vmprof.yaml b/docs/packages/vmprof.yaml new file mode 100644 index 00000000000..a3cb560c423 --- /dev/null +++ b/docs/packages/vmprof.yaml @@ -0,0 +1,5 @@ +package-name: vmprof +source-code: https://github.com/vmprof/vmprof-python +license: MIT +versions: +- version: 0.6.0 From 1914acb8b098685c31a1d3021c1982263e95f1c6 Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Sun, 25 Oct 2026 18:02:46 +0000 Subject: [PATCH 2/2] vmprof: build libunwind from source on riscv64 manylinux_2_39_riscv64 is RHEL 10-based, which moved libunwind to EPEL; manylinux enables no EPEL on riscv64 (gotcha 140), so upstream's `dnf install -y libunwind-devel` before-build fails with 'No match for argument: libunwind-devel' on all three build legs. Build libunwind 1.8.3 from source instead, same as build-memray.yml. --- .github/workflows/build-vmprof.yml | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-vmprof.yml b/.github/workflows/build-vmprof.yml index 7bc2ea41993..fa588ed3d45 100644 --- a/.github/workflows/build-vmprof.yml +++ b/.github/workflows/build-vmprof.yml @@ -31,6 +31,7 @@ permissions: env: MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64 + LIBUNWIND_VERSION: '1.8.3' jobs: setup: @@ -71,7 +72,22 @@ jobs: only: ${{ matrix.python }}-manylinux_riscv64 env: CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - CIBW_BEFORE_BUILD_LINUX: dnf install -y libunwind-devel + # Upstream's before-build is a plain `dnf install -y libunwind-devel`, which + # works on their manylinux_2_28 (AlmaLinux 8) images. RHEL 10 (what + # manylinux_2_39 riscv64 is built on) dropped libunwind to EPEL, and manylinux + # enables no EPEL on riscv64, so the package simply doesn't exist here + # (CLAUDE.md gotcha 140). Build it from source instead: 1.8.3 has riscv64 + # support since 1.7.0 and `--libdir=/usr/lib64` is load-bearing since + # autotools otherwise installs to /usr/lib, off the riscv64 linker/pkg-config + # path. + CIBW_BEFORE_BUILD_LINUX: >- + cd /tmp && + curl -fsSLO https://github.com/libunwind/libunwind/releases/download/v${{ env.LIBUNWIND_VERSION }}/libunwind-${{ env.LIBUNWIND_VERSION }}.tar.gz && + tar xf libunwind-${{ env.LIBUNWIND_VERSION }}.tar.gz && + cd libunwind-${{ env.LIBUNWIND_VERSION }} && + ./configure --prefix=/usr --libdir=/usr/lib64 --disable-documentation + --disable-tests --disable-minidebuginfo --disable-zlibdebuginfo && + make -j"$(nproc)" install CIBW_TEST_GROUPS: test CIBW_TEST_COMMAND: cd {package} && pytest vmprof jitlog -vv