Skip to content

Attempt to fix macOS runner native build#8348

Merged
andrewlock merged 2 commits into
masterfrom
steven/make-macos-build
Mar 20, 2026
Merged

Attempt to fix macOS runner native build#8348
andrewlock merged 2 commits into
masterfrom
steven/make-macos-build

Conversation

@bouwkast

Copy link
Copy Markdown
Collaborator

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

@bouwkast bouwkast requested a review from a team as a code owner March 19, 2026 21:07

@link04 link04 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🍀

@pr-commenter

pr-commenter Bot commented Mar 19, 2026

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2026-03-19 21:48:29

Comparing candidate commit b90b4d5 in PR branch steven/make-macos-build with baseline commit a9e4caf in branch master.

Found 13 performance improvements and 9 performance regressions! Performance is the same for 252 metrics, 14 unstable metrics.

Explanation

This is an A/B test comparing a candidate commit's performance against that of a baseline commit. Performance changes are noted in the tables below as:

  • 🟩 = significantly better candidate vs. baseline
  • 🟥 = significantly worse candidate vs. baseline

We compute a confidence interval (CI) over the relative difference of means between metrics from the candidate and baseline commits, considering the baseline as the reference.

If the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD), the change is considered significant.

Feel free to reach out to #apm-benchmarking-platform on Slack if you have any questions.

More details about the CI and significant changes

You can imagine this CI as a range of values that is likely to contain the true difference of means between the candidate and baseline commits.

CIs of the difference of means are often centered around 0%, because often changes are not that big:

---------------------------------(------|---^--------)-------------------------------->
                              -0.6%    0%  0.3%     +1.2%
                                 |          |        |
         lower bound of the CI --'          |        |
sample mean (center of the CI) -------------'        |
         upper bound of the CI ----------------------'

As described above, a change is considered significant if the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD).

For instance, for an execution time metric, this confidence interval indicates a significantly worse performance:

----------------------------------------|---------|---(---------^---------)---------->
                                       0%        1%  1.3%      2.2%      3.1%
                                                  |   |         |         |
       significant impact threshold --------------'   |         |         |
                      lower bound of CI --------------'         |         |
       sample mean (center of the CI) --------------------------'         |
                      upper bound of CI ----------------------------------'

scenario:Benchmarks.Trace.ActivityBenchmark.StartStopWithChild netcoreapp3.1

  • 🟩 execution_time [-106.664ms; -104.941ms] or [-53.831%; -52.961%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleMoreComplexBody net6.0

  • 🟥 execution_time [+14.451ms; +17.746ms] or [+7.209%; +8.853%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorMoreComplexBody netcoreapp3.1

  • 🟩 execution_time [-16.080ms; -10.622ms] or [-7.655%; -5.057%]

scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeLegacyArgs netcoreapp3.1

  • 🟥 execution_time [+22.164ms; +23.857ms] or [+12.197%; +13.129%]

scenario:Benchmarks.Trace.AspNetCoreBenchmark.SendRequest net6.0

  • 🟥 execution_time [+99.380ms; +100.461ms] or [+101.763%; +102.870%]

scenario:Benchmarks.Trace.AspNetCoreBenchmark.SendRequest netcoreapp3.1

  • 🟩 allocated_mem [-1.565KB; -1.561KB] or [-6.982%; -6.967%]

scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces net472

  • 🟥 execution_time [+14.962ms; +19.834ms] or [+7.533%; +9.986%]

scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces net6.0

  • 🟥 execution_time [+34.857ms; +40.415ms] or [+18.107%; +20.994%]

scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces netcoreapp3.1

  • 🟩 execution_time [-78.804ms; -73.562ms] or [-37.307%; -34.825%]
  • 🟩 throughput [+119.970op/s; +160.915op/s] or [+7.901%; +10.597%]

scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool net6.0

  • 🟥 execution_time [+56.132µs; +62.468µs] or [+5.481%; +6.099%]
  • 🟥 throughput [-56.206op/s; -50.645op/s] or [-5.756%; -5.187%]

scenario:Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync netcoreapp3.1

  • 🟥 throughput [-41477.805op/s; -28845.558op/s] or [-8.874%; -6.171%]

scenario:Benchmarks.Trace.ILoggerBenchmark.EnrichedLog netcoreapp3.1

  • 🟩 execution_time [-15.788ms; -10.608ms] or [-7.527%; -5.057%]

scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark net6.0

  • 🟩 allocated_mem [-17.906KB; -17.868KB] or [-6.512%; -6.498%]

scenario:Benchmarks.Trace.NLogBenchmark.EnrichedLog netcoreapp3.1

  • 🟩 execution_time [-102.341ms; -100.308ms] or [-49.140%; -48.164%]

scenario:Benchmarks.Trace.RedisBenchmark.SendReceive netcoreapp3.1

  • 🟩 throughput [+23998.871op/s; +35510.344op/s] or [+5.930%; +8.774%]

scenario:Benchmarks.Trace.SingleSpanAspNetCoreBenchmark.SingleSpanAspNetCore net6.0

  • 🟩 allocated_mem [-8.088KB; -8.085KB] or [-32.017%; -32.005%]

scenario:Benchmarks.Trace.SingleSpanAspNetCoreBenchmark.SingleSpanAspNetCore netcoreapp3.1

  • 🟩 throughput [+15190578.907op/s; +16585148.479op/s] or [+6.735%; +7.353%]

scenario:Benchmarks.Trace.SpanBenchmark.StartFinishSpan net6.0

  • 🟩 execution_time [-20.537ms; -15.776ms] or [-9.429%; -7.244%]

scenario:Benchmarks.Trace.SpanBenchmark.StartFinishSpan netcoreapp3.1

  • 🟩 execution_time [-16.312ms; -10.980ms] or [-7.654%; -5.152%]

scenario:Benchmarks.Trace.SpanBenchmark.StartFinishTwoScopes netcoreapp3.1

  • 🟥 execution_time [+11.106ms; +15.907ms] or [+5.590%; +8.006%]

@andrewlock andrewlock left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean, it builds, so I'll take it 😅 :blindfold:

@andrewlock andrewlock merged commit b0dc7b1 into master Mar 20, 2026
139 of 140 checks passed
@andrewlock andrewlock deleted the steven/make-macos-build branch March 20, 2026 07:47
@github-actions github-actions Bot added this to the vNext-v3 milestone Mar 20, 2026
andrewlock added a commit that referenced this pull request Mar 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants