I am trying to build llvm from source on mac. The build works fine unless I include some c library when compiling using the source built clang.
This is the command I am using:
$(CLANG) $(name).c -O0 -Xclang -disable-O0-optnone -S -emit-llvm -o $(name).ll
/Users/th3_st4rk/compiler/llvm-project/build/bin/clang test.c -O0 -Xclang -disable-O0-optnone -S -emit-llvm -o test.ll test.c:1:10: fatal error: 'stdio.h' file not found 1 | #include "stdio.h" | ^~~~~~~~~ 1 error generated. make: *** [compile] Error 1
I am not sure if this is something related to Mac. However, I have checked the output with
-print-resource-dir. The source built clang has
resource_dir/include/llvm_libc_wrappers. While the system’s clang has no such directory.