Building LLVM on Mac

Hello,

I am trying to build the framework on MacBook but getting errors while compilation; e.g., some are

/Users/abidmalik/Programming/MLIR_target/llvm-project/libcxx/include/wchar.h:137:77: error: use of undeclared identifier ‘wcschr’
wchar_t* __libcpp_wcschr(const wchar_t* __s, wchar_t __c) {return (wchar_t*)wcschr(__s, __c);}
^
/Users/abidmalik/Programming/MLIR_target/llvm-project/libcxx/include/wchar.h:144:87: error: use of undeclared identifier ‘wcspbrk’
wchar_t* __libcpp_wcspbrk(const wchar_t* __s1, const wchar_t* __s2) {return (wchar_t*)wcspbrk(__s1, __s2);}

Certainly, it has to do with the compiler flags related paths given to Cmake. I tried a couple of options but unable to solve the issue.

Hi.

I am trying to build the framework on MacBook but getting errors while compilation; e.g., some are

/Users/abidmalik/Programming/MLIR_target/llvm-project/libcxx/include/wchar.h:137:77: error: use of undeclared identifier 'wcschr'
wchar_t* __libcpp_wcschr(const wchar_t* __s, wchar_t __c) {return (wchar_t*)wcschr(__s, __c);}
                                                                            ^
/Users/abidmalik/Programming/MLIR_target/llvm-project/libcxx/include/wchar.h:144:87: error: use of undeclared identifier 'wcspbrk'
wchar_t* __libcpp_wcspbrk(const wchar_t* __s1, const wchar_t* __s2) {return (wchar_t*)wcspbrk(__s1, __s2);}

I'm building Clang/LLVM on a daily basis on Mac and I get these types of errors when I upgrade/update Xcode. Then I remove the build directory and build everything from scratch.

-DCMAKE_C_FLAGS="-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk" -DCMAKE_CXX_FLAGS="-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk

I do not use option -isysroot. Do these directories exist? I think you do not have to set it.

Boris

> -DCMAKE_C_FLAGS="-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk" -DCMAKE_CXX_FLAGS="-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk

I do not use option -isysroot. Do these directories exist? I think you do not have to set it.

The right way to do this is to set -DCMAKE_OSX_SYSROOT - not to pass
isysroot directly.

-- Tobias

Thanks, Boris and Tobias for the feedback.

The building always stuck at libcxxabi: