Skip to content

google-crc32c: add build-google-crc32c.yml for riscv64 wheels - #313

Merged
luhenry merged 3 commits into
mainfrom
google-crc32c
Aug 24, 2026
Merged

google-crc32c: add build-google-crc32c.yml for riscv64 wheels#313
luhenry merged 3 commits into
mainfrom
google-crc32c

Conversation

@luhenry

@luhenry luhenry commented Aug 24, 2026

Copy link
Copy Markdown
Member

Adds a riscv64 wheel build for google-crc32c 1.8.0, published to pypi.riseproject.dev. PyPI ships no riscv64 wheel for this package.

What it builds

google-crc32c is a thin C extension (google_crc32c._crc32c) wrapping Google's external crc32c C library. That library is not bundled in the sdist — upstream vendors it as the google_crc32c/ git submodule (github.com/google/crc32c). The workflow follows upstream's scripts/manylinux/build_on_centos.sh:

  • build-from-checkout with submodules: true, then pypa/cibuildwheel directly.
  • CIBW_BEFORE_ALL builds libcrc32c once via CMake (shared lib, into the container's default prefix); auditwheel then vendors libcrc32c.so into each wheel.
  • CRC32C_PURE_PYTHON=0 forces the C extension. Upstream's setup.py silently falls back to a pure-Python build on any compile/link failure (gotcha 20) — this flag makes it hard-fail instead, so a broken build can't ship a mislabeled pure-Python wheel.
  • Matrix [cp312, cp313, cp314, cp314t] — plain per-interpreter C extension (PyPI shows cp3x-cp3x, no abi3).
  • Tests run the bundled pytest suite plus an explicit implementation == 'c' assertion.

Local validation (QEMU riscv64 on aarch64)

  • cp312 wheel built; contains _crc32c.cpython-312-riscv64-linux-gnu.so + vendored libcrc32c-*.so.1.1.0 (confirmed a real C-ext wheel, not the pure-Python fallback).
  • In-container: implementation = c, value(b'123456789') = 0xe3069283 (canonical CRC32C check value), 42 tests passed.

🤖 Generated with Claude Code

luhenry and others added 2 commits August 24, 2026 17:04
Builds riscv64 wheels for google-crc32c 1.8.0. The C extension links the
external google/crc32c C library (vendored as the google_crc32c/ submodule),
built once via CMake in CIBW_BEFORE_ALL and vendored into each wheel by
auditwheel. CRC32C_PURE_PYTHON=0 forces the C build so a compile/link failure
hard-fails instead of silently shipping a pure-Python wheel.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The crc32c CMake pulls in third_party/glog via add_subdirectory when
CRC32C_USE_GLOG is on (the default), but glog is a nested submodule and
actions/checkout submodules:true is not recursive, so its directory is empty
and configure fails. glog is only used by crc32c's own tests/benchmarks (both
disabled here), so -DCRC32C_USE_GLOG=no drops it — leaner build, no recursive
submodule fetch needed. Verified under QEMU riscv64 on a non-recursive checkout:
42 tests pass, wheel ships _crc32c.so + vendored libcrc32c.so.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

@threexc threexc left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. We'll have to note that we disable the glog stuff for testing.

@luhenry luhenry linked an issue Aug 24, 2026 that may be closed by this pull request
…glog

The crc32c C library has nested submodules (glog etc.) that its CMake pulls in
via add_subdirectory. Rather than disabling the feature (-DCRC32C_USE_GLOG=no)
to dodge the fetch under a non-recursive submodules:true checkout, use
submodules: recursive — the upstream-faithful path (upstream builds with
git submodule update --init --recursive) and self-documenting.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@luhenry
luhenry merged commit f437f27 into main Aug 24, 2026
8 checks passed
@luhenry
luhenry deleted the google-crc32c branch August 24, 2026 16:51
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.

google-crc32c riscv64 support

2 participants