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

Ian Anderson via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 2 15:31:11 PST 2025


ian-twilightcoder wrote:

> > It's a problem for the dylibs because you'll end up with a broken executable for rpath reasons.
> 
> That's only the case if you do add e.g. `-lclang` but fail to provide the appropriate `-L path/to/libclang/location` where the `libclang.dylib` you actually intend to link against is located -- which can't happen because that wouldn't link today.

It's not link time that's the problem but load/run time due to the `@loader_path` in its `LC_RPATH`. The same is true for all of the dylibs in Xcode that aren't in SDKs. It allows Xcode to be relocatable but it means that nothing outside of the SDK is usable by anything outside of stuff in Xcode

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


More information about the cfe-commits mailing list