Precompiled mac os clang 10 doesn't work out of box on Catalina

Hi! I have downloaded precompiled clang 10 on a virgin Mac OS Catalina installation. My attempt to compile C++ code fails with error:

/Users/stepan/Downloads/clang+llvm-10.0.0-x86_64-apple-darwin/bin/…/include/c++/v1/wchar.h:118:15: fatal error:
‘wchar.h’ file not found
#include_next <wchar.h>
^~~~~~~~~
1 error generated.

This is kind of know error end was described in stack overflow:
https://stackoverflow.com/questions/26185978/macos-wchar-h-file-not-found

The reason is a wrong configuration of sysroot or include directories.

And yet I have a question. As long a it is a precompiled clang for macos, isn’t it possible to fix it and make it working out of box?

BTW: clang-9 works without any issues.

Thanks!
Stepan

My bad. Clang-9 also fails.

Last night, I solved this issue, but partially.
Starting from Mojave “/usr/include” was removed from Mac OS. You should either install headers explicitly, or pass “–sysroot” parameter during compilation.
I say “partially”, because imho it breaks default use-case. Since this moment you can’t use clang out of box just like that: “clang++ test.cpp”. I love Apple because you can use things out of the box. But, alas, this is not about clang anymore.

I think we should either update guidelines, or improve sysroot computation in Driver.

Anybody? Any thoughts on that?

-Stepan

There’s an open bug for this, or at least there was… maybe autoclosed?

https://bugs.llvm.org/show_bug.cgi?id=45880

Exactly as you say an ‘out of the box’ clang build in recent mac os will fail to find the “system” headers. You can read the thread here:

https://lists.llvm.org/pipermail/cfe-dev/2019-September/063394.html