Fix macOS CI build: only build static re2 library#8347
Closed
bouwkast wants to merge 1 commit into
Closed
Conversation
The macOS runner image updated llvm@15 to an x86_64-only build, breaking the arm64 cross-compile of libre2.dylib which links against libunwind. We only need the static library (libre2.a), so target it explicitly to avoid the shared library link step entirely. See: actions/runner-images#13827 See: actions/runner-images#13816
Collaborator
Author
|
😢 |
andrewlock
pushed a commit
that referenced
this pull request
Mar 20, 2026
## 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) -j` to `$(MAKE) -j obj/libre2.a` for both arm64 and x86_64 re2 builds. The default make target builds both `libre2.a` (static) and `libre2.dylib` (shared). The shared library link fails because the linker picks up the x86_64-only libunwind. We only use the static library (`IMPORTED_LOCATION` and `BUILD_BYPRODUCTS` both reference `obj/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`) - Resolve the macOS SDK path via `xcrun --show-sdk-path` and pass it as `-DCMAKE_OSX_SYSROOT` to cmake. This causes cmake to pass `-Wl,-syslibroot,<path>` to the linker, which prepends the sysroot to all default search directories. `/usr/local/lib` becomes `<sysroot>/usr/local/lib` (doesn't exist in the SDK, so Homebrew's libunwind is never found) while `/usr/lib` becomes `<sysroot>/usr/lib` (contains TBD stubs for the real universal system libunwind). - Clear `LDFLAGS` and `LIBRARY_PATH` environment variables to prevent any additional Homebrew-injected paths from leaking into the build. Applied to both `CompileNativeSrcMacOs` (tracer) and `CompileNativeLoaderOsx` (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
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.
Summary
Our CI is broken on
masteras building on macos is failing due to a runner update.Build only the static re2 library (obj/libre2.a) on macOS instead of the default all target which also builds the shared library (libre2.dylib).
Reason for change
CI is broken.
Implementation details
Some of the related issues associated with this suggested some workarounds, I just instructed Claude to fix, I didn't test it figure if the build works we are good.
Related issues
Test coverage
If the CI passes then we should hopefully be good?
Generated by Claude