fix: inject macOS SDK sysroot and improve build failure diagnostics - #32
Merged
Conversation
Two changes:
1. Inject --with-sysroot on macOS (configure stage)
On modern macOS, system headers are inside the SDK, not /usr/include.
GCC needs --with-sysroot to find them when building runtime libraries
(libgcc, libstdc++). Detect SDK path via xcrun --sdk macosx --show-sdk-path.
Skip if mold already specifies --with-sysroot.
2. Upload build logs on failure
- Save make output to make.log via tee (was discarded by tail -20)
- On configure/make failure, copy logs to stage artifact directory
- Print last 50 lines of log for immediate visibility
- Add failure-only artifact upload steps in ingot-cast.yml for
both configure and make stages
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
Two fixes to unblock GCC source builds on macOS and improve future debugging.
1. macOS SDK sysroot injection
On modern macOS, system headers live inside the SDK (not /usr/include).
GCC needs
--with-sysrootto find them when building runtime libraries(libgcc, libstdc++). Auto-detect via
xcrun --sdk macosx --show-sdk-pathand inject into configure_args. Skip if mold already specifies it.
2. Build failure log upload
Previously, make output was piped through
tail -20and the full log waslost. Now:
make.logviateeBackground
GCC 15.2.0 make stage failed on macos-14 within 43 seconds. The actual
error was hidden by tail truncation. Root cause: missing SDK sysroot
causes immediate header-not-found errors when building GCC sub-components.
Test plan
molds/gcc/15.2.0— macOS make should proceed