Fix macOS 27 SDK linking with Apple ld - #388
Merged
Merged
Conversation
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>
Contributor
There was a problem hiding this comment.
🟡 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/ldflags. - Disables unsupported
--start-lib/--end-libusage 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.
tameware
marked this pull request as draft
September 17, 2026 11:01
tameware
force-pushed
the
fix-macos-build
branch
from
September 17, 2026 11:03
198f316 to
deb4460
Compare
tameware
marked this pull request as ready for review
September 17, 2026 11:04
zzcgumn
approved these changes
Sep 18, 2026
zzcgumn
left a comment
Collaborator
There was a problem hiding this comment.
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.
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
ld64.lldcannot parse MacOSX 27 SDK TBD stubs that listarm64e.x1, so native Darwin links fail with a cascade of missing libc++/libSystem symbols./usr/bin/ldviallvm.toolchain.extra_link_flags, scoped to the LLVM toolchain so wasm still useswasm-ld.supports_start_end_libon 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_testblaze aqueryconfirms wasm CppLink still usesemcc_link.sh(no/usr/bin/ld)ci_macos.ymlonmacos-26(bazelisk build //...andbazelisk test //...)Made with Cursor