Skip to content

macos_arm64: exec build script link 'library not found for -lm' (rules_rust_prost parking_lot_core) #9339

Open

Description

@TrapsterDK

Found while planning #5152 (PR #9332).

On macos_arm64, an exec-config Rust build script failed to link once and has not been reproduced since:

@@rules_rust_prost++rust_ext+rrprd__parking_lot_core-0.9.10//:_bs_ [for tool]
ld64.lld: error: library not found for -lm

Where

  • Run 42378289008, job 128420338072 (main 46d4b4a). Configuration darwin_arm64-fastbuild-exec-ST-c0d0db156624. The link line has --sysroot=external/llvm++osx+macos_sdk/sysroot, then -lSystem -lc -lm. Only -lm was not found.
  • In the same run the profile shows the same _bs_ linking fine in three other exec configs, and dozens of other rrprd__* and dx_crates__* build scripts linking -lm in darwin-sandbox.
  • In runs 42380520765 and 42381013335 the action was a remote cache hit, so the failure is hidden, not fixed.
  • llvm 0.8.26 extensions/osx.bzl includes usr/lib/libm.tbd. In the SDK that file is a symlink to libSystem.tbd. patches/llvm/libunwind_copy.patch fixed a similar dangling-symlink problem (llvm: libunwind.a is a dangling symbolic link in reused output bases #7781).

Fix

  1. Reproduce: dispatch .github/workflows/evidence.yml on main with platforms=macos_arm64, task=build, scope=//quality/testdata:real_result_gotype_clean, flags=--noremote_accept_cached. Repeat once with relocate=true.
  2. If it fails, run bazel aquery in the evidence step on the failing _bs_ and check that sysroot/usr/lib/libm.tbd is among its inputs. Also check whether the file in the output base is a dangling symlink after a repo contents cache restore.
  3. Fix it in patches/llvm/ so the macOS SDK repo holds .tbd files as real files instead of symlinks, following libunwind_copy.patch. Add it to MODULE.bazel, cli/adopt/src/overrides.rs and patches/README.md, then file it upstream at hermeticbuild/hermetic-llvm.
  4. If two forced-local runs pass, close this issue as not reproduced and link both runs.

Activity

  1. added
    P2Improve and finish existing features
    model:sonnetAgent lane: scoped change with stated design, Sonnet
    on Nov 7, 2026
  2. TrapsterDK commented on Nov 7, 2026

    @TrapsterDK
    CollaboratorAuthor

    Reproduction attempt on main 681c1fa (scope //quality/testdata:real_result_gotype_clean, which reaches @@rules_rust_prost++rust_ext+rrprd__parking_lot_core-0.9.10//:_bs_ via the prost toolchain per cquery somepath). evidence.yml rejects --noremote_accept_cached in flags, so both runs use relocate=true; the relocated build runs with --disk_cache= --noremote_accept_cached in a fresh output base, giving two forced-local builds:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Improve and finish existing featuresmodel:sonnetAgent lane: scoped change with stated design, Sonnet

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions