Skip to content

packmol: Add version 21.2.3 - #4249

Merged
luhenry merged 11 commits into
mainfrom
packmol
Nov 9, 2026
Merged

luhenry merged 11 commits into
mainfrom
packmol

Conversation

@luhenry

@luhenry luhenry commented Nov 2, 2026 •

Copy link
Copy Markdown
Member

Compiles the Packmol Fortran executable with gfortran (via a hatchling build hook running the upstream Makefile) and ships it inside the wheel behind a packmol console script. Upstream publishes no riscv64 wheel, only manylinux/musllinux x86_64/aarch64, macOS and Windows.

Mirrors upstream's build-wheels.yaml.

Differs from upstream

  • Makefile FLAGS overridden without -march=native - GCC rejects it on riscv64, and it ties the binary to the build host
  • musllinux dropped, manylinux_2_39 riscv64 image only

Testing

  • same as upstream

License: Wheel bundles the image's libgfortran (GPL-3.0 with the GCC Runtime Library Exception), with its gcc sources published as gpl-sources.tar; packmol itself is MIT.

Not built locally; CI pending.

luhenry added a commit that referenced this pull request Nov 2, 2026
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.
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.
-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.
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.
@luhenry
luhenry marked this pull request as ready for review November 9, 2026 06:36
@luhenry
luhenry merged commit 8c11f95 into main Nov 9, 2026
18 checks passed
@luhenry
luhenry deleted the packmol branch November 9, 2026 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant