Attempt to fix macOS runner native build#8348
Conversation
BenchmarksBenchmark execution time: 2026-03-19 21:48:29 Comparing candidate commit b90b4d5 in PR branch Found 13 performance improvements and 9 performance regressions! Performance is the same for 252 metrics, 14 unstable metrics.
|
andrewlock
left a comment
There was a problem hiding this comment.
I mean, it builds, so I'll take it 😅 :blindfold:
This reverts commit b0dc7b1.
Summary of changes
Attempt to fix macOS native build failure caused by the macos-14 runner image updating llvm@15 to x86_64-only.
Reason for change
CI is broken
The macos-14 runner image (20260316.0303) rebuilt Homebrew's llvm@15 as x86_64-only. This breaks our arm64 cross-compilation because Homebrew's libunwind.dylib shadows the system's universal version in the linker search path. The linker finds the x86_64-only copy, ignores it for arm64, and fails to resolve __Unwind_Resume.
Implementation details
From Claude:
The fix has two layers:
1. Build only the static re2 library on macOS (
build/cmake/FindRe2.cmake)Changed
$(MAKE) -jto$(MAKE) -j obj/libre2.afor both arm64 and x86_64 re2 builds. The default make target builds bothlibre2.a(static) andlibre2.dylib(shared). The shared library link failsbecause the linker picks up the x86_64-only libunwind. We only use the static library (
IMPORTED_LOCATIONandBUILD_BYPRODUCTSboth referenceobj/libre2.a), so the shared library was never needed.2. Isolate macOS builds from Homebrew via SDK sysroot (
Build.Steps.cs,Build.Shared.Steps.cs)xcrun --show-sdk-pathand pass it as-DCMAKE_OSX_SYSROOTto cmake. This causes cmake to pass-Wl,-syslibroot,<path>to the linker, which prepends the sysroot to alldefault search directories.
/usr/local/libbecomes<sysroot>/usr/local/lib(doesn't exist in the SDK, so Homebrew's libunwind is never found) while/usr/libbecomes<sysroot>/usr/lib(contains TBDstubs for the real universal system libunwind).
LDFLAGSandLIBRARY_PATHenvironment variables to prevent any additional Homebrew-injected paths from leaking into the build.Applied to both
CompileNativeSrcMacOs(tracer) andCompileNativeLoaderOsx(native loader).Test coverage
Ran a build and it did work, now to see if this actually works then maybe we are good 🤷
Other details
FWIW I don't really have a great understanding of the macOS build
Re-attempt of #8347
Generated with Claude