Skip to content

Fix macOS 27 SDK linking with Apple ld - #388

Merged
tameware merged 1 commit into
dds-bridge:developfrom
tameware:fix-macos-build
Sep 19, 2026
Merged

tameware merged 1 commit into
dds-bridge:developfrom
tameware:fix-macos-build

Conversation

@tameware

@tameware tameware commented Sep 17, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • LLVM 21's ld64.lld cannot parse MacOSX 27 SDK TBD stubs that list arm64e.x1, so native Darwin links fail with a cascade of missing libc++/libSystem symbols.
  • Native Darwin links now use Apple's /usr/bin/ld via llvm.toolchain.extra_link_flags, scoped to the LLVM toolchain so wasm still uses wasm-ld.
  • Disable Bazel's supports_start_end_lib on macOS hosts because Apple ld rejects LLD's --start-lib/--end-lib.

Test plan

  • blaze build //library/tests/heuristic_sorting:minimal_new_test (previously failed at link)
  • blaze test //library/tests/heuristic_sorting:minimal_new_test
  • blaze aquery confirms wasm CppLink still uses emcc_link.sh (no /usr/bin/ld)
  • CI ci_macos.yml on macos-26 (bazelisk build //... and bazelisk test //...)

Made with Cursor

LLVM 21's ld64.lld rejects TBD stubs that list arm64e.x1, so native
macOS links fail with a cascade of missing libc++/libSystem symbols.
Keep the override on the LLVM toolchain so wasm still uses wasm-ld.

Co-authored-by: Cursor <cursoragent@cursor.com>

Copilot AI 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.

🟡 Changes recommended

The MODULE.bazel change lacks the required regenerated MODULE.bazel.lock update.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Updates macOS LLVM linking to use Apple’s linker for MacOSX 27 SDK compatibility while preserving WASM’s wasm-ld.

Changes:

  • Adds Darwin-specific /usr/bin/ld flags.
  • Disables unsupported --start-lib/--end-lib usage on macOS.
  • Documents the workaround and removal conditions.
File summaries
File Description
MODULE.bazel Configures Apple’s linker for Darwin LLVM toolchains.
.bazelrc Disables supports_start_end_lib on macOS.
docs/BUILD_SYSTEM.md Documents SDK and linker compatibility.
Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread MODULE.bazel
@tameware tameware self-assigned this Sep 17, 2026
@tameware tameware added the Clean Copilot review Copilot reviewed and had neither new comments nor new suppressed comments. label Sep 17, 2026
@tameware
tameware requested review from zzcgumn and a lite review from Copilot September 17, 2026 10:39
@tameware
tameware marked this pull request as draft September 17, 2026 11:01
@tameware
tameware marked this pull request as ready for review September 17, 2026 11:04

This comment was marked as resolved.

This comment was marked as resolved.

Copilot AI 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.

🟢 Approval recommended

The linker workaround is correctly scoped and supported by the documented macOS and wasm behavior.

Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@zzcgumn zzcgumn left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I saw some of these problems for a beta version but I did not think it made sense to fix them for before the official version was out.

@tameware
tameware merged commit c50fe76 into dds-bridge:develop Sep 19, 2026
24 checks passed
@tameware
tameware deleted the fix-macos-build branch September 19, 2026 00:27
@tameware
tameware restored the fix-macos-build branch September 19, 2026 00:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Clean Copilot review Copilot reviewed and had neither new comments nor new suppressed comments.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants