zephyr-cp: stop non-English builds from linking the English translation objects - #11422
Merged
Merged
Conversation
`cpbuild.archive()` updated the archive with `ar rvs`, which replaces the members named on the command line and keeps every other member. After the en_US build of a release job, each later language added its own `translations-<lang>.o` and `autogen_display_resources-<lang>.o` but the en_US members stayed in the archive ahead of them, and the linker used the English ones. Every non-en_US zephyr-cp firmware shipped this way has the English compressed strings with another language's decompression tables; on a Feather RP2040 the 10.3.1 fr build has an unresponsive REPL. Delete the archive before running `ar rcs`. The archive is now rebuilt on every build, under a second for ~450 objects. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
mikeysklar
approved these changes
Sep 20, 2026
mikeysklar
left a comment
Collaborator
There was a problem hiding this comment.
Tested this PR with 10.3.x and main, building adafruit_feather_nrf52840_zephyr en_US then fr in one directory. On a Feather nRF52840, unpatched 10.3.x fr never enumerates on USB. With this change both fr builds boot with a French REPL. Should this also go into 10.3.x?
Collaborator
Author
Probably anyone using the zephyr builds is going to be willing to use the alpha builds, since the zephyr port is alpha anyway. So I would say not worth it. |
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.
Claude found and fixed this, reviewed and tested on hardware by @dhalbert.
Every non-
en_USzephyr-cp firmware built by CI contains the English compressed strings together with the other language's decompression tables. This breaks the firmware: @dhalbert tested the 10.3.1 fr build on a Feather RP2040. It enumeratesCIRCUITPYbut its REPL never responds because of the scrambled compressed strings;en_USworks.The cause
cpbuild.archive()updatedlibcircuitpython.awithar rvs, which replaces the members named on the command line and keeps every other member. The release build reuses one build directory for all 17 languages, so after en_US each later language added its owntranslations-<lang>.oandautogen_display_resources-<lang>.o, but the en_US members stayed in the archive ahead of them and the linker took those.translate.c, which holds the decompression tables, is recompiled per language, so strings and tables no longer match.Evidence from the artifacts of today's main run for
adafruit_feather_nrf52840_zephyr: all 516 compressed translation symbols in the de_DE and ja ELFs have exactly the sizes they have in en_US, while a clean local de_DE build differs in 426 of them. The linker map of an incremental de_DE build showslibcircuitpython.a(translations-en_US.o).Fix
Delete the archive, and then use
ar rcs, so it only ever contains the current build's objects. Thecinar rcsprevents a warning that the archive had to be created.The archive is now rebuilt on every build, which is under a second for ~450 objects.
Verification
adafruit_feather_nrf52840_zephyris now byte-identical to a clean de_DE build at the same path; ja matches the clean ja size, and the map shows only the current language's objects.adafruit_feather_rp2040_zephyr: en_US, then fr, then ja built in one directory and flashed in turn; the fr and ja REPLs work and show their languages.Affects every zephyr-cp release with translations, so this has been broken for a while.