[cfe-dev] clang built from source in Mac OSX 10.14 with apple-clang/Xcode missing stdlib from include search path

Jens Jorgensen via cfe-dev cfe-dev at lists.llvm.org
Tue Oct 1 03:32:34 PDT 2019


On 9/30/19 4:28 AM, Jacob Carlborg via cfe-dev wrote:

> On 2019-09-25 14:49, Hans Wennborg via cfe-dev wrote:
>> I'm always confused when trying to get locally-built Clang to find
>> stdlib headers on my Mac.
>>
>> Last time, after upgrading to Mojave, following the TL;DR advice from
>> this answer made it work for me: https://stackoverflow.com/a/52530212
>>
>> It would certainly be nice if this could somehow work out of the box.
>
> When building Clang the build system could run "xcrun --show-sdk-path"
> to identify the SDK path. Or to be even more flexible: when running
> Clang it could run the above code and it will avoid the need for hard
> coding the path to the SDK.
>
Yeah, there are lots of ways it /could/ be solved but I guess what I'm
proposing is that if there exists a default SDK that goes with the
compiler you're using to build clang and we know about it, shouldn't we
be providing the mechanism internally to find it (only in the case where
it cannot be found in the obvious places eg. /usr/include)? In the
ordinary case (where it is installed in /usr/include) the compiler would
already pick it up, so it's not like we're injecting strange behavior
right? Or I'm crazy? I don't know, but ending up with a good compiler
that cannot find the std lib, even though the previous compiler did, is
just kicking the problem "upstream". It seems a reasonable minimal
requirement that running clang++ without extra include paths should be
able to find the standard library.

-- 
Jens B. Jorgensen
jbj1 at ultraemail.net




More information about the cfe-dev mailing list