Skip to content

gemmi: add build-gemmi.yml for riscv64 wheels - #1026

Merged
luhenry merged 6 commits into
mainfrom
gemmi
Sep 6, 2026
Merged

gemmi: add build-gemmi.yml for riscv64 wheels#1026
luhenry merged 6 commits into
mainfrom
gemmi

Conversation

@luhenry

@luhenry luhenry commented Sep 6, 2026

Copy link
Copy Markdown
Member

Compiles gemmi's C++ macromolecular-crystallography library and its nanobind Python bindings. Upstream publishes no riscv64 wheel.

Mirrors upstream's wheels2.yml.

Differs from upstream

  • Nothing beyond the riscv64 image.

Testing

  • same as upstream

License: OK

luhenry and others added 6 commits September 6, 2026 12:54
Mirrors upstream's cibuildwheel + scikit-build-core recipe as-is (no
CIBW_ENVIRONMENT/CIBW_TEST_COMMAND overrides): pyproject.toml already
sets SKBUILD_CMAKE_ARGS (FETCH_ZLIB_NG=ON among others) and the
unittest-based test-command, so cibuildwheel picks both up unmodified
from the checkout. zlib-ng (fetched via CMake FetchContent at build
time) has confirmed riscv64 RVV dispatch support from the in-flight
python-zlib-ng port.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Az13NcXsVZzzxXmaxxUEy7
CMakeLists.txt's find_package(nanobind 2.4.0 CONFIG REQUIRED) rejects
nanobind 3.x as a version mismatch, but pyproject.toml's
build-system.requires carries no upper bound. nanobind 3.x requires
Python >=3.10, so this reproduces on any architecture building
cp310+ - it just never surfaced on upstream's own py3.9 leg. Constrain
both the top-level and isolated build envs via CIBW_BEFORE_ALL +
PIP_CONSTRAINT/PIP_BUILD_CONSTRAINT rather than disabling isolation.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Az13NcXsVZzzxXmaxxUEy7
cibuildwheel parses CIBW_ENVIRONMENT with bashlex; the unquoted
semicolon-separated CMake arg list was read as multiple shell
statements instead of one assignment, so cibuildwheel rejected the
whole option as malformed.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Az13NcXsVZzzxXmaxxUEy7
stb_sprintf.h's stbsp__uintptr allowlist has no riscv64 entry, so it
falls back to a 32-bit unsigned int on a 64-bit-pointer platform;
every (stbsp__uintptr)ptr alignment check then narrows a pointer to
32 bits, which GCC 14 rejects as a hard error rather than a warning.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Az13NcXsVZzzxXmaxxUEy7
CMakeLists.txt enables CMAKE_INTERPROCEDURAL_OPTIMIZATION for Release
builds by default, and already turns it off for the bundled zlib-ng
because "IPO has been reported to mess it up leading to
illegal-instruction crash" on some platforms. gemmi's own code hits
that same crash on riscv64: the wheel builds and installs fine, but
the very first unittest dies with SIGILL. Disable LTO globally rather
than only where upstream anticipated the problem.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Az13NcXsVZzzxXmaxxUEy7
Disabling project-wide LTO did not fix the riscv64 SIGILL (identical
crash, same test, same instruction pointer class) - so that was the
wrong culprit. The crash is in test_align.py's very first test, which
is also the first to read a real file through zlib (a .pdb.gz),
pointing at the fetched zlib-ng's RVV-accelerated chunkset/inflate
kernels instead. Pass -DWITH_RVV=OFF to fall back to zlib-ng's
portable C implementation.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Az13NcXsVZzzxXmaxxUEy7
@luhenry
luhenry marked this pull request as ready for review September 6, 2026 13:27
@luhenry
luhenry merged commit cdf367c into main Sep 6, 2026
13 checks passed
@luhenry
luhenry deleted the gemmi branch September 6, 2026 13:31
@luhenry luhenry linked an issue Sep 6, 2026 that may be closed by this pull request
@luhenry luhenry mentioned this pull request Sep 6, 2026
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.

gemmi riscv64 support

1 participant