Repository navigation
fix: keep ARMv7 wheels out of the arm/v6 image - #429
Merged
Merged
Conversation
The arm/v6 image is built under QEMU, whose default CPU is ARMv7 and reports armv7l, so pip installed musllinux armv7l wheels for charset-normalizer, markupsafe and websockets. Their compiled modules use ARMv7 instructions and crash on real ARMv6 hardware (Raspberry Pi Zero and Pi 1). On v6 only, build those packages from source so Alpine's gcc targets ARMv6. CI now loads every compiled file in the published arm/v6 image on QEMU's arm1176 CPU model, so a new dependency with the same problem fails the build instead of shipping. Fixes #424 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Replace the hand-kept PIP_NO_BINARY list with the root cause: under QEMU's default ARMv7 CPU the arm/v6 build reports armv7l, so pip picks armv7l wheels. Exporting QEMU_CPU=arm1176 for the v6 pip install makes the build report armv6l, so pip rejects every armv7l wheel on its own and falls back to a pure-Python wheel or a source build with Alpine's gcc, which targets ARMv6. Native builds ignore the variable, and it is exported in the RUN rather than set with ENV so the image does not carry it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With pip now running on QEMU's ARMv6 model in the v6 build, the installed wheels' tags say what pip chose: armv6l when it worked, armv7l when an ARMv7 wheel got in or the QEMU_CPU export stopped working. A grep over the WHEEL files catches both in one line, in place of loading each compiled file on an emulated ARMv6 CPU. grep exits 1 only when it read the files and found no match, so a missing site-packages fails the step instead of passing it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #424.
Problem
The
linux/arm/v6image crashes on real ARMv6 hardware (Raspberry Pi Zero and Pi 1). The arm/v6 build runs under QEMU, whose default CPU is ARMv7 and reportsarmv7l. So pip installedmusllinux_1_2_armv7lwheels, and their compiled modules use ARMv7 instructions. The currentlatestarm/v6 image ships four of them:charset_normalizer/cdcharset_normalizer/mdmarkupsafe/_speedupswebsockets/speedupsCI never caught this because it only ever runs the amd64 image.
Fix
Dockerfile: on v6 only, the pip install step exports
QEMU_CPU=arm1176, QEMU's model of the Pi Zero's ARMv6 core. The build then reportsarmv6l, so pip rejects every armv7l wheel by itself. It falls back to a pure-Python wheel or a source build with Alpine's gcc, which targets ARMv6.RUNstep rather than set withENV, so the image doesn't carry it.CI: a new step runs after the push on merges and tags. It greps the published arm/v6 image's
.dist-info/WHEELfiles forarmv7l.QEMU_CPUexport silently not working, because then every package compiled during the build would be taggedarmv7lagain.The commits show how this got here: the first used a hand-kept
PIP_NO_BINARYlist and a long check that loaded every compiled file on an emulated ARMv6 CPU. Later commits replaced the list withQEMU_CPUand the check with the grep, so review the combined diff.Tested locally (Docker Desktop, QEMU)
QEMU_CPU=arm1176latestarm/v6I ran the loading test above with the earlier, longer check. The new grep check was tested separately:
latestarm/v6python:3.15.2-alpine3.24(no armv7l wheels)alpine:3.24(no Python)This branch's image has no armv7l tags, so the grep check would pass on it.
On the
arm1176CPU model, this branch's image also:/healthzin about 9 secondsffmpeg -versionandnode --versionQEMU_CPUin its environmentHow each affected package now installs:
markupsafe,brotli,pycryptodomexlinux_armv6lcharset-normalizer,websocketsFor reviewers
RUNline clears the cached pip layer, so every platform reinstalls once and resolves its unpinned dependencies afresh. The local build gotcharset-normalizer3.5.3, one release newer than today's image's 3.5.2.libdav1dandlibtheora, Alpine libraries marked ARMv7, cause trouble when ffmpeg actually uses them on a Pi. This fix doesn't touch them.🤖 Generated with Claude Code