bootstrap: Add Apple Silicon toolchain support - #5255
Open
boinger wants to merge 2 commits into
Open
Conversation
The existing Darwin URL fetches the x86_64 toolchain, which fails on Apple Silicon hosts under Rosetta due to hardcoded Intel-Homebrew dylib paths in cc1. Add Darwin-arm64 URL for ARM's native arm64 build; bootstrap.py's per-architecture selection logic picks it up automatically.
boinger
force-pushed
the
macos-arm64-toolchain
branch
from
July 2, 2026 19:34
4b8c460 to
f9c47c3
Compare
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.
Problem
On Apple Silicon Macs,
python utils/build.py --preset coreone --build-type releasefails during cmake configure:The bootstrapped
gcc-arm-none-eabi-13.2.1is the Intel macOS build (darwin-x86_64). On Apple Silicon it runs under Rosetta, and itscc1has hardcoded dylib references to/usr/local/opt/zstd/lib/(Intel Homebrew path). This path doesn't exist on arm64 systems — Homebrew installs under/opt/homebrew/— and even symlinking can't help because Rosetta requires x86_64 libraries while Homebrew's zstd is native arm64.Fix
Two changes to
utils/bootstrap.py:(1) Add a native arm64 Darwin toolchain URL.
bootstrap.pyalready supports per-architecture URLs (Linux-aarch64is present). The selection logic atbootstrap.py:244-248resolvesplatform.system()-platform.machine()first, falling back toplatform.system()if absent. On Apple Silicon,platform.machine()returnsarm64, so the lookup producesDarwin-arm64— which has no entry, falling back toDarwin(the Intel binary). Adding theDarwin-arm64entry lets the lookup resolve to ARM's native arm64 build.(2) Fix a typo in the existing
DarwinURL. The URL ends with.tar.xzg(extrag). The file at that URL is not something ARM actually hosts directly —curl -Ishows ARM's developer.arm.com returns302and silently redirects.tar.xzgto the canonical.tar.xzon their Azure Blob CDN. So the current URL "works" only because of ARM's lenient URL routing. The extraction code atbootstrap.py:177-179has accommodated the typo by including'tar.xzg'in the valid-extension list for the endswith check. This is a latent bug: if ARM ever tightens URL routing, the Darwin build would break on both Intel and arm64 hosts.'gcc-arm-none-eabi': { 'version': '13.2.1', 'url': { 'Linux': 'https://developer.arm.com/-/media/Files/downloads/gnu/13.2.rel1/binrel/arm-gnu-toolchain-13.2.rel1-x86_64-arm-none-eabi.tar.xz', 'Linux-aarch64': 'https://developer.arm.com/-/media/Files/downloads/gnu/13.2.rel1/binrel/arm-gnu-toolchain-13.2.rel1-aarch64-arm-none-eabi.tar.xz', 'Windows': 'https://developer.arm.com/-/media/Files/downloads/gnu/13.2.rel1/binrel/arm-gnu-toolchain-13.2.rel1-mingw-w64-i686-arm-none-eabi.zip', - 'Darwin': 'https://developer.arm.com/-/media/Files/downloads/gnu/13.2.rel1/binrel/arm-gnu-toolchain-13.2.rel1-darwin-x86_64-arm-none-eabi.tar.xzg', + 'Darwin': 'https://developer.arm.com/-/media/Files/downloads/gnu/13.2.rel1/binrel/arm-gnu-toolchain-13.2.rel1-darwin-x86_64-arm-none-eabi.tar.xz', + 'Darwin-arm64': 'https://developer.arm.com/-/media/Files/downloads/gnu/13.2.rel1/binrel/arm-gnu-toolchain-13.2.rel1-darwin-arm64-arm-none-eabi.tar.xz', } },No changes needed downstream: the extraction logic (
find_single_subdir+shutil.move) normalizes the archive's top-level directory togcc-arm-none-eabi-13.2.1/regardless of the archive name, so cmake and other consumers are arch-agnostic.Verified end-to-end
Tested on macOS 26.5 beta (Build 25F5042g, Apple Silicon M4 Max) from a pristine state:
upstream/master(no other changes).dependencies/gcc-arm-none-eabi-*andbuild/DYLD_*env vars, no Intel Homebrew, no workaroundsResult:
Produced
coreone_release_boot.bbf(4.1MB). Cross-compiled output is equivalent to an x86_64 host build (136-byte.textdelta, expected compiler-host noise).