Skip to content

Commit e306a45

Browse files
committed
Merge branch 'feat/macos-static-libcxx' into test/macos14-support
# Conflicts: # .github/workflows/release.yml
2 parents 53189b2 + e5b877a commit e306a45

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

src/build/flags.cppm

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,11 @@ CompileFlags compute_flags(const BuildPlan& plan) {
347347
// archives are absent.
348348
// 2. deployment target — mirror MACOSX_DEPLOYMENT_TARGET onto the
349349
// link command line so it doesn't depend on env propagation.
350+
// 3. linker — use LLVM's own lld (same as the Linux clang path)
351+
// instead of Xcode's ld: the system ld's version floats with
352+
// the host Xcode (observed: Xcode 15.4's ld aborting at launch
353+
// on macos-14 CI when its libc++ resolution was diverted), and
354+
// lld ships with the exact toolchain doing the compile.
350355
std::string stdlib_link = " -lc++";
351356
if (f.staticStdlib && !llvmRootForStdlib.empty()) {
352357
auto libcxxA = llvmRootForStdlib / "lib" / "libc++.a";
@@ -361,8 +366,8 @@ CompileFlags compute_flags(const BuildPlan& plan) {
361366
if (const char* dt = std::getenv("MACOSX_DEPLOYMENT_TARGET"); dt && *dt) {
362367
version_min = std::string(" -mmacosx-version-min=") + dt;
363368
}
364-
f.ld = std::format("{}{}{}{}{}{}{}", full_static, static_stdlib, b_flag,
365-
version_min, stdlib_link, user_ldflags, link_extra);
369+
f.ld = std::format("{}{}{} -fuse-ld=lld{}{}{}{}", full_static, static_stdlib,
370+
b_flag, version_min, stdlib_link, user_ldflags, link_extra);
366371
} else {
367372
f.ld = std::format("{}{}{}{}{}{}{}{}", full_static, static_stdlib, link_toolchain_flags, b_flag,
368373
runtime_dirs, payload_ld, user_ldflags, link_extra);

0 commit comments

Comments
 (0)