Missing stdio.h?

I just built clang and then I was following a simple helloworld guide on Getting Started with the LLVM System — LLVM 17.0.0git documentation. But the
compilation failed because clang said 'stdio.h' file not found.

I couldn’t even find this header file in my build directory build/lib/clang/16/include, although it looks like full of header files.

The command I used to build the toolchain is

cmake -G Ninja -S ../llvm-project-llvmorg-16.0.6/llvm \

I then tried another simple source file without the stdio.h:

int main(void)
  return 0;

Then lld reported a whole bunch of errors saying unable to find library -l...

lld: error: unable to find library -lmingw32
lld: error: unable to find library -lgcc
lld: error: unable to find library -lgcc_eh

Can someone tell me what’s going on?

BYW, turning on the -v switch tells me that the toolchain is looking for headers and libraries in a build/x86_64-w64-mingw32 directory, but that directory is not built with the command I used.

LLVM doesn’t ship the system SDK for any platforms. You need to supply that yourself. If you are targeting MinGW you need to build and install that somewhere as well.

Maybe the llvm-mingw project is something for you? GitHub - mstorsjo/llvm-mingw: An LLVM/Clang/LLD based mingw-w64 toolchain


I used MSYS2. The mingw64 build with gcc succeeded but it was full of warnings, the helloworld worked on that platform though.

The clang64 build was free of warnings, but I had the problem of missing headers and libs.

Maybe you need the --gcc-toolchain option or --sysroot. But I am no expert with msys2.