From 3b84ad7f2827635d0c4eab3952694f2636730a27 Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Mon, 2 Nov 2026 12:26:17 +0000 Subject: [PATCH 1/7] packmol: Add version 21.2.3 --- .github/workflows/build-packmol.yml | 125 ++++++++++++++++++++++++++++ docs/packages/packmol.yaml | 5 ++ 2 files changed, 130 insertions(+) create mode 100644 .github/workflows/build-packmol.yml create mode 100644 docs/packages/packmol.yaml diff --git a/.github/workflows/build-packmol.yml b/.github/workflows/build-packmol.yml new file mode 100644 index 000000000000..949731dbbbb1 --- /dev/null +++ b/.github/workflows/build-packmol.yml @@ -0,0 +1,125 @@ +# SPDX-FileCopyrightText: 2026 The RISE Project +# SPDX-License-Identifier: MIT +--- +# This workflow is based on the `build_wheels` job of +# https://github.com/m3g/packmol/blob/v21.2.3/.github/workflows/build-wheels.yaml +name: Build packmol wheels (riscv64) + +on: + workflow_dispatch: + inputs: + version: + description: 'Version glob to (re)build; empty builds every version of docs/packages/packmol.yaml not released yet' + required: false + default: '' + pull_request: + branches: [main] + paths: + - '.github/workflows/build-packmol.yml' + - 'docs/packages/packmol.yaml' + push: + branches: [main] + paths: + - '.github/workflows/build-packmol.yml' + - 'docs/packages/packmol.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: packmol + version: ${{ inputs.version }} + + build_wheels: + needs: [setup] + if: needs.setup.outputs.versions != '[]' + name: Build packmol ${{ 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) }} + python: ["cp312", "cp313", "cp314", "cp314t"] + + env: + PACKMOL_VERSION: ${{ matrix.version }} + + steps: + - name: Checkout packmol v${{ env.PACKMOL_VERSION }} + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + repository: m3g/packmol + ref: v${{ env.PACKMOL_VERSION }} + persist-credentials: false + + - name: Build wheels + uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 + with: + only: ${{ matrix.python }}-manylinux_riscv64 + env: + CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} + # The Makefile's FLAGS hardcode -march=native, which GCC rejects on riscv64 and + # which would tie the binary to the build host anyway; same flags without it. + CIBW_ENVIRONMENT: >- + MAKEFLAGS='FLAGS=-O3\ -funroll-loops' + + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: packmol-${{ env.PACKMOL_VERSION }}-${{ matrix.python }}-manylinux_riscv64 + path: ./wheelhouse/*.whl + if-no-files-found: error + + gpl_sources: + needs: [setup] + if: needs.setup.outputs.versions != '[]' + strategy: + fail-fast: false + matrix: + version: ${{ fromJSON(needs.setup.outputs.versions) }} + # packmol is a gfortran-built executable, so auditwheel vendors its libgfortran runtime. + name: Collect GPL sources (gcc) for packmol ${{ matrix.version }} + runs-on: ubuntu-24.04-riscv + + steps: + - name: Collect gcc source RPM from manylinux_riscv64 + uses: riseproject-dev/python-wheels/actions/collect-gpl-sources@main + with: + image: ${{ env.MANYLINUX_RISCV64_IMAGE }} + packages: gcc + output: gpl-sources.tar + + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: packmol-${{ matrix.version }}-gpl-sources + path: gpl-sources.tar + if-no-files-found: error + + publish: + name: Publish packmol ${{ matrix.version }} + needs: [setup, build_wheels, gpl_sources] + 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: packmol-${{ matrix.version }}-*-manylinux_riscv64 + gpl-sources-artifact: packmol-${{ matrix.version }}-gpl-sources + gpl-sources-description: gcc diff --git a/docs/packages/packmol.yaml b/docs/packages/packmol.yaml new file mode 100644 index 000000000000..e0ab8aa91e27 --- /dev/null +++ b/docs/packages/packmol.yaml @@ -0,0 +1,5 @@ +package-name: packmol +source-code: https://github.com/m3g/packmol +license: MIT +versions: +- version: 21.2.3 From b8877d20ae0c677b160e7950f17d5e3ef2cb1849 Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Tue, 3 Nov 2026 10:06:50 +0000 Subject: [PATCH 2/7] build-packmol: drop to -O2, the built binary segfaulted at -O3 All 4 interpreters failed the same way - the packmol binary itself crashed immediately with no output at all: assert result.returncode == 0 AssertionError: assert -11 == 0 + where -11 = CompletedProcess(args=['packmol'], ...).returncode A SIGSEGV with completely empty stdout/stderr (not even packmol's own startup banner) on every interpreter points at the compiled binary itself, not at the Python/cibuildwheel layer around it. Drop the Makefile's -O3 -funroll-loops override to plain -O2, no unrolling - this is the standard mitigation for a binary that only breaks under aggressive optimization on a comparatively undertested architecture. Not verified against a specific miscompiled routine (no stack trace to work from, nothing printed before the crash); if -O2 still crashes, the next step would be -O1/-O0 to bisect further. --- .github/workflows/build-packmol.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-packmol.yml b/.github/workflows/build-packmol.yml index 949731dbbbb1..e962dd93747d 100644 --- a/.github/workflows/build-packmol.yml +++ b/.github/workflows/build-packmol.yml @@ -70,9 +70,12 @@ jobs: env: CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} # The Makefile's FLAGS hardcode -march=native, which GCC rejects on riscv64 and - # which would tie the binary to the build host anyway; same flags without it. + # which would tie the binary to the build host anyway. The built binary also + # segfaulted immediately (empty stdout/stderr, no diagnostics at all) on every + # interpreter at -O3 -funroll-loops; dropping to the same -O2 gfortran uses + # without any optimization/unroll flags gets a binary that runs. CIBW_ENVIRONMENT: >- - MAKEFLAGS='FLAGS=-O3\ -funroll-loops' + MAKEFLAGS='FLAGS=-O2' - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: From 8061ba419e71fa36da085558e898e0ecd4598da4 Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Thu, 5 Nov 2026 08:25:26 -0800 Subject: [PATCH 3/7] packmol: Record target Python versions --- .github/workflows/build-packmol.yml | 4 +--- docs/packages/packmol.yaml | 1 + 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-packmol.yml b/.github/workflows/build-packmol.yml index e962dd93747d..3eb70188b1e9 100644 --- a/.github/workflows/build-packmol.yml +++ b/.github/workflows/build-packmol.yml @@ -49,9 +49,7 @@ jobs: strategy: fail-fast: false matrix: - version: ${{ fromJSON(needs.setup.outputs.versions) }} - python: ["cp312", "cp313", "cp314", "cp314t"] - + include: ${{ fromJSON(needs.setup.outputs.matrix) }} env: PACKMOL_VERSION: ${{ matrix.version }} diff --git a/docs/packages/packmol.yaml b/docs/packages/packmol.yaml index e0ab8aa91e27..788552a65916 100644 --- a/docs/packages/packmol.yaml +++ b/docs/packages/packmol.yaml @@ -3,3 +3,4 @@ source-code: https://github.com/m3g/packmol license: MIT versions: - version: 21.2.3 + python-versions: ['3.10', '3.11', '3.12', '3.13', '3.14', '3.14t'] From 559ea738e5c60bbbc7baf757541fc8ace5113470 Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Fri, 6 Nov 2026 09:24:06 -0800 Subject: [PATCH 4/7] packmol: Use target file metadata --- docs/packages/packmol.yaml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/docs/packages/packmol.yaml b/docs/packages/packmol.yaml index 788552a65916..ac00654ca7d0 100644 --- a/docs/packages/packmol.yaml +++ b/docs/packages/packmol.yaml @@ -3,4 +3,16 @@ source-code: https://github.com/m3g/packmol license: MIT versions: - version: 21.2.3 - python-versions: ['3.10', '3.11', '3.12', '3.13', '3.14', '3.14t'] + files: + - python: 3.10:manylinux + - python: 3.10:musllinux + - python: 3.11:manylinux + - python: 3.11:musllinux + - python: 3.12:manylinux + - python: 3.12:musllinux + - python: 3.13:manylinux + - python: 3.13:musllinux + - python: 3.14:manylinux + - python: 3.14:musllinux + - python: 3.14t:manylinux + - python: 3.14t:musllinux From a13b9f5ff290f3d10e53627d36b55be705c10386 Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Sun, 8 Nov 2026 16:23:18 +0000 Subject: [PATCH 5/7] build-packmol: link above mmap_min_addr and build per matrix platform The bundled packmol executable is non-PIE, linked at riscv64's 0x10000. auditwheel's patchelf --set-rpath (for the grafted libgfortran) prepends a segment below that base, which the kernel cannot map, so packmol died with SIGSEGV at exec with no output, independent of -O level. Pass -Wl,-Ttext-segment=0x200000 through the Makefile's FLAGS (also used for the link) and restore upstream's -O3 -funroll-loops (minus -march=native). Also select the cibuildwheel target, job name and artifact name by matrix.platform: the musllinux rows of the setup matrix were rebuilding the manylinux wheel under the same artifact name. --- .github/workflows/build-packmol.yml | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build-packmol.yml b/.github/workflows/build-packmol.yml index 3eb70188b1e9..e8adfe42182b 100644 --- a/.github/workflows/build-packmol.yml +++ b/.github/workflows/build-packmol.yml @@ -43,7 +43,7 @@ jobs: build_wheels: needs: [setup] if: needs.setup.outputs.versions != '[]' - name: Build packmol ${{ matrix.version }} ${{ matrix.python }}-manylinux_riscv64 + name: Build packmol ${{ matrix.version }} ${{ matrix.python }}-${{ matrix.platform }}_riscv64 runs-on: ubuntu-24.04-riscv timeout-minutes: 60 strategy: @@ -64,20 +64,18 @@ jobs: - name: Build wheels uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 with: - only: ${{ matrix.python }}-manylinux_riscv64 + only: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 env: CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - # The Makefile's FLAGS hardcode -march=native, which GCC rejects on riscv64 and - # which would tie the binary to the build host anyway. The built binary also - # segfaulted immediately (empty stdout/stderr, no diagnostics at all) on every - # interpreter at -O3 -funroll-loops; dropping to the same -O2 gfortran uses - # without any optimization/unroll flags gets a binary that runs. + # Upstream FLAGS minus -march=native, which GCC rejects on riscv64. packmol links + # non-PIE (FLAGS is also the link line); keep its base above vm.mmap_min_addr once + # auditwheel's patchelf prepends a segment, or it dies silently at exec (gotcha 595). CIBW_ENVIRONMENT: >- - MAKEFLAGS='FLAGS=-O2' + MAKEFLAGS='FLAGS=-O3\ -funroll-loops\ -Wl,-Ttext-segment=0x200000' - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: - name: packmol-${{ env.PACKMOL_VERSION }}-${{ matrix.python }}-manylinux_riscv64 + name: packmol-${{ env.PACKMOL_VERSION }}-${{ matrix.python }}-${{ matrix.platform }}_riscv64 path: ./wheelhouse/*.whl if-no-files-found: error From 627bf117c8162935eccc4a74949fa8b6817ea4bf Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Sun, 8 Nov 2026 17:55:40 +0000 Subject: [PATCH 6/7] build-packmol: link PIE instead of raising the text segment -Wl,-Ttext-segment=0x200000 fixed the manylinux wheel, but every musllinux wheel still died with SIGSEGV and no output. musllinux's Alpine gcc is --enable-default-pie, and ld turns a PIE link with a non-zero text segment into an ET_EXEC that still carries PIE relocations (FLAGS_1 PIE, R_RISCV_RELATIVE). The unrepaired binary runs, but once auditwheel's patchelf --set-rpath rewrites that ET_EXEC (shifting the file and moving .dynamic into a new low segment), it crashes in startup right after the RELRO mprotect. Link PIE explicitly on both platforms instead (-fPIE -pie through FLAGS, which is also the link line). An ET_DYN gets its new segment appended, so nothing lands below vm.mmap_min_addr on manylinux either. --- .github/workflows/build-packmol.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-packmol.yml b/.github/workflows/build-packmol.yml index e8adfe42182b..f0e23884b90a 100644 --- a/.github/workflows/build-packmol.yml +++ b/.github/workflows/build-packmol.yml @@ -67,11 +67,13 @@ jobs: only: ${{ matrix.python }}-${{ matrix.platform }}_riscv64 env: CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} - # Upstream FLAGS minus -march=native, which GCC rejects on riscv64. packmol links - # non-PIE (FLAGS is also the link line); keep its base above vm.mmap_min_addr once - # auditwheel's patchelf prepends a segment, or it dies silently at exec (gotcha 595). + # Upstream FLAGS minus -march=native, which GCC rejects on riscv64. FLAGS is also + # the link line: link packmol PIE so auditwheel's patchelf --set-rpath appends its + # segment instead of prepending one below vm.mmap_min_addr (gotcha 595). Not + # -Wl,-Ttext-segment: musllinux's default-PIE gcc then emits an ET_EXEC that + # still carries PIE relocations, and patchelf's rewrite of it segfaults at start. CIBW_ENVIRONMENT: >- - MAKEFLAGS='FLAGS=-O3\ -funroll-loops\ -Wl,-Ttext-segment=0x200000' + MAKEFLAGS='FLAGS=-O3\ -funroll-loops\ -fPIE\ -pie' - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: From 26b3037973da2612e8cd63b2dafbae67bae85be6 Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Mon, 9 Nov 2026 06:24:40 +0000 Subject: [PATCH 7/7] build-packmol: publish the musllinux wheels too The build matrix and docs/packages/packmol.yaml cover musllinux, but the publish artifact-pattern only matched *-manylinux_riscv64 artifacts, so update_doc.py reported every musllinux file as missing. --- .github/workflows/build-packmol.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-packmol.yml b/.github/workflows/build-packmol.yml index f0e23884b90a..0f56f214a5f8 100644 --- a/.github/workflows/build-packmol.yml +++ b/.github/workflows/build-packmol.yml @@ -121,6 +121,6 @@ jobs: secrets: app-private-key: ${{ secrets.RISEPROJECT_APP_PRIVATE_KEY }} with: - artifact-pattern: packmol-${{ matrix.version }}-*-manylinux_riscv64 + artifact-pattern: packmol-${{ matrix.version }}-*riscv64 gpl-sources-artifact: packmol-${{ matrix.version }}-gpl-sources gpl-sources-description: gcc