ARM64 build on an Apple Silicon macOS host: toolchain builds after fixes (branch available)
Summary
I attempted an ARM64 build of ravynOS on an Apple Silicon macOS host (macOS + Xcode 26.6, bmake from Homebrew, bmake -j8 NO_ROOT=1 world), since Docs/BUILDING.md lists macOS as a build host and the top-level Makefile already derives BuildArch/CpuArch from MACHINE. As far as I can tell this is the first ARM64 attempt — ARCH_CONFIGS is hardcoded X86_64 upstream.
Result so far: the toolchain (LLVM/clang/lld/tapi, targeting AArch64 with aarch64-apple-darwin triples) builds to completion after the fixes below. The build is continuing into cctools/ld64 and beyond; I'll update if I get further.
Working branch with all fixes as separate commits: https://github.com/MaxLeggieri/ravynos/tree/arm64-build (happy to open PRs for any subset you'd take).
Genuinely ARM64-specific bug
Developer/Default.xctoolchain/include/TargetConditionals.hhas no__aarch64__/__arm64__case — it handles ppc/ppc64/i386/x86_64/arm, so every arm64 compile fails with#error unrecognized GNU C compiler. Fixed by adding aTARGET_CPU_ARM64branch.
macOS-host portability issues found on the way
- Several toolchain Makefiles
chown root:wheelunconditionally — guarded by.if !NO_ROOT, soNO_ROOT=1works, but BUILDING.md doesn't mention it. xar:openssl/evp.h— OpenSSL headers aren't in the macOS SDK (fixed by using Homebrewopenssl@3on Darwin hosts).dtrace_ctf/libctf/qsort.credefinesqsort_r, which conflicts with macOS libc's declaration (different argument order). Guarded with#ifdef __APPLE__.Developer/Default.xctoolchain/llvm/Makefile:-DCMAKE_C_FLAGS=${CFLAGS}is unquoted (the CXX one is quoted), so multi-word flags split and cmake errors withUnknown argument -fno-common.- The ravynOS target include dir is fed to the host stage-1 LLVM build, where it shadows the macOS SDK's
mach/*; sincemach/task.his MIG-generated later, LLVM fails on undeclaredtask_{get,set}_exception_ports. Filtered the include for the Darwin-host stage-1 build. tapi/tools/libtapi/libtapi.exportscontains both libc++ (NSt3__1…) and old-libstdc++ (Ss…) manglings; on a libc++/Darwin host the libstdc++ entries can never resolve and-exported_symbols_listturns each into an<initial-undefines>link error. Used a filtered list on Darwin.cctools/ld64/src/Makefilehardcodeslibtapi.so; on a Darwin host LLVM produceslibtapi.dylib. Parameterized the suffix.
Items 2–7 suggest the macOS-host path hasn't been exercised recently; if that's expected, a one-line note in BUILDING.md would save the next person some time.
Thanks for the project — this came out of evaluating ravynOS for an ARM64-based effort, and I'd be glad to keep pushing the branch along if there's interest.
Source: ravynsoft/ravynos