[llvm-dev] Build on macOS Catalina

379 views
Skip to first unread message

Luca Ciciriello via llvm-dev

unread,
Feb 18, 2020, 12:35:21 PM2/18/20
to llvm...@lists.llvm.org
Hi all.

I’ve built and installed llvm+clang from git repository on macOS Catalina. My problem now is that I get the following error building my cpp file:

clang++ -std=c++17 testcpp.cpp -o test
In file included from testcpp.cpp:1:
In file included from /usr/local/clang_llvm/bin/../include/c++/v1/iostream:37:
In file included from /usr/local/clang_llvm/bin/../include/c++/v1/ios:214:
In file included from /usr/local/clang_llvm/bin/../include/c++/v1/iosfwd:95:
/usr/local/clang_llvm/bin/../include/c++/v1/wchar.h:118:15: fatal error: 'wchar.h' file not found
#include_next <wchar.h>
              ^~~~~~~~~
1 error generated. 

I get this error only on macOS and not on Linux. I’ve followed the same procedure on Linux and MacOS

On macOS I’ve created the links: 

ln -s /usr/local/clang_llvm/include/c++ /usr/local/include/c++

but this doesn’t solve the problem. Any idea?

Best regards

Luca Ciciriello

Dmitry Babokin via llvm-dev

unread,
Feb 18, 2020, 1:12:51 PM2/18/20
to Luca Ciciriello, llvm...@lists.llvm.org
Hi Luca,

You need C and C++ library headers.

C headers come as part of macOS SDK. To let compiler know about its location you need to add -DDEFAULT_SYSROOT=`xcrun --show-sdk-path` to CMake configuration.

C++ headers come from the toolchain. I.e. they are part of clang distribution, so you can either link to existing clang location or build libc++ to your clang build (I think this is better option): -DLLVM_ENABLE_PROJECTS=libcxx;libcxxabi

Dmitry.

_______________________________________________
LLVM Developers mailing list
llvm...@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Reply all
Reply to author
Forward
0 new messages