[PATCH] D45639: [Driver] Support default libc++ library location on Darwin

Petr Hosek via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 15 22:39:20 PDT 2021


phosek added a comment.

In D45639#2692142 <https://reviews.llvm.org/D45639#2692142>, @ldionne wrote:

> In D45639#2383754 <https://reviews.llvm.org/D45639#2383754>, @smeenai wrote:
>
>> Just following up on this, cos I'm curious :) I have 12.1 now, and I still only see the C++ headers in the toolchain and not in any of the SDKs.
>
> Look in Xcode 12.5 beta 3, you should see libc++ headers in the SDK. You'll also see headers alongside Clang, however those are not being used. They are just there for some internal reasons but eventually we'll have only one copy of the headers, and they'll be in the SDK.
>
> As I explained in https://reviews.llvm.org/D45639#2360267, I think this is the right way forward. We want LLVM Clang to prefer the libc++.dylib (and headers) shipped in the toolchain if those are present, since that's the most consistent approach.
>
> Just one question: with this patch, do we prefer the library in the SDK or the one in the toolchain if both are present? Can we get into trouble if we have both paths on the `-L` list? I'm trying to think of subtle issues like:
>
>   <toolchain>/lib/libc++.a
>   <sysroot>/lib/libc++.dylib
>
> Which one would we pick here?

It's depends on the order: whichever comes first wins. The default order of paths that the driver uses is (1) toolchain library paths, (2) library paths specified explicitly using `-L`, (3) sysroot library paths. So if `<toolchain>/lib/libc++.a` exists, it'd be picked up, otherwise `<sysroot>/lib/libc++.dylib` would be used.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D45639/new/

https://reviews.llvm.org/D45639



More information about the cfe-commits mailing list