Skip to content

fix: inject macOS SDK sysroot and improve build failure diagnostics - #32

Merged
skipbit merged 1 commit into
mainfrom
fix-macos-sysroot-and-build-logs
Mar 22, 2026
Merged

fix: inject macOS SDK sysroot and improve build failure diagnostics#32
skipbit merged 1 commit into
mainfrom
fix-macos-sysroot-and-build-logs

Conversation

@skipbit

@skipbit skipbit commented Mar 22, 2026

Copy link
Copy Markdown
Owner

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-sysroot to find them when building runtime libraries
(libgcc, libstdc++). Auto-detect via xcrun --sdk macosx --show-sdk-path
and inject into configure_args. Skip if mold already specifies it.

2. Build failure log upload

Previously, make output was piped through tail -20 and the full log was
lost. Now:

  • Full make output saved to make.log via tee
  • On failure: last 50 lines printed inline + logs copied to stage artifacts
  • Failure-only artifact upload steps added for configure and make stages

Background

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

  • Re-run workflow_dispatch with molds/gcc/15.2.0 — macOS make should proceed
  • If make fails, build logs should be downloadable as artifacts
  • Linux builds unaffected
  • PR validation passes

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
@skipbit
skipbit merged commit 234887f into main Mar 22, 2026
5 checks passed
@skipbit
skipbit deleted the fix-macos-sysroot-and-build-logs branch March 22, 2026 02:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant