[clang] [compiler-rt] [clang][Darwin] Prefer the toolchain-provided libc++.dylib if there is one (PR #170303)

Louis Dionne via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 5 10:08:12 PST 2025


ldionne wrote:

Just for posterity, here are my changes to the Homebrew formula:

```
diff --git a/Formula/l/llvm.rb b/Formula/l/llvm.rb
index 74373c08297..49c174df36f 100644
--- a/Formula/l/llvm.rb
+++ b/Formula/l/llvm.rb
@@ -9,6 +9,12 @@ class Llvm < Formula
     url "https://github.com/llvm/llvm-project/releases/download/llvmorg-21.1.7/llvm-project-21.1.7.src.tar.xz"
     sha256 "e5b65fd79c95c343bb584127114cb2d252306c1ada1e057899b6aacdd445899e"
 
+    # Apply https://github.com/llvm/llvm-project/pull/170303
+    patch do
+      url "https://github.com/llvm/llvm-project/pull/170303.diff"
+      # sha256 ""
+    end
+
     # Fix triple config loading for clang-cl
     # https://github.com/llvm/llvm-project/pull/111397
     patch do
@@ -168,16 +174,13 @@ class Llvm < Formula
       args << "-DFFI_INCLUDE_DIR=#{macos_sdk}/usr/include/ffi"
       args << "-DFFI_LIBRARY_DIR=#{macos_sdk}/usr/lib"
 
-      libcxx_install_libdir = lib/"c++"
       libunwind_install_libdir = lib/"unwind"
-      libcxx_rpaths = [loader_path, rpath(source: libcxx_install_libdir, target: libunwind_install_libdir)]
+      libcxx_rpaths = [loader_path, rpath(source: lib, target: libunwind_install_libdir)]
 
       args << "-DLLVM_BUILD_LLVM_C_DYLIB=ON"
       args << "-DLLVM_ENABLE_LIBCXX=ON"
       args << "-DLIBCXX_PSTL_BACKEND=libdispatch"
-      args << "-DLIBCXX_INSTALL_LIBRARY_DIR=#{libcxx_install_libdir}"
       args << "-DLIBUNWIND_INSTALL_LIBRARY_DIR=#{libunwind_install_libdir}"
-      args << "-DLIBCXXABI_INSTALL_LIBRARY_DIR=#{libcxx_install_libdir}"
       runtimes_cmake_args << "-DCMAKE_INSTALL_RPATH=#{libcxx_rpaths.join("|")}"
 
       # Disable builds for OSes not supported by the CLT SDK.

```

I'll create a patch to propose these changes once this change has settled down.

https://github.com/llvm/llvm-project/pull/170303


More information about the llvm-commits mailing list