I'm bringing to your attention a question I tackled with for a few days and no issue could solve for me, in the hope that it'll save some other people time.
I try to compile LLVM from sources on macOS Catalina (10.15).
To do so, I used the following commands (after following the LLVM build manual):
git clone https://github.com/llvm/llvm-project
cd llvm-project
mkdir build && cd build
cmake -G "Ninja" -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra" -DCMAKE_BUILD_TYPE="Debug" ../llvm
ninja
Now you should have a working clang compiler under build/bin.
However, given /tmp/program.c with this contents:
#include <stdio.h>
int main() {
printf("Hello, world!\n");
return 0;
}
I got the following output:
/tmp/program.c:1:10: fatal error: 'stdio.h' file not found
#include <stdio.h>
^~~~~~~~~
1 error generated.```
I tried a lot of solutions, including setting `CPATH`, `CFLAGS`, `CXXFLAGS`, `LDFLAGS` etc but none worked.