`ninja check-libc` : target does not exist on Windows


We configured Phabricator pre-merge testing to be more fine grain in
selecting the tests to run.
As such when a patch touches libc, it'll try to run `ninja check-libc`
instead of `check-all`. This works well on linux, but somehow it does
not on Windows.

Here is one log for example:

The libc project is correctly enabled in CMake:

-- libc project is enabled

But then it fails with:

ninja: error: unknown target 'check-libc', did you mean 'check-lit'?

Does anyone know why? I can find anything Windows specific in the
various CMakeLists.txt in the libc folder of the repo.


The requirements for libc on Windows are similar to libcxx on Windows. As in, you have to additionally pass -DLLVM_FORCE_BUILD_RUNTIME=libc to cmake and we need clang-cl to build. Also, it currently only works for Windows on x86_64. The full instructions on how to get it working on Windows are available here: https://github.com/llvm/llvm-project/tree/main/libc/config/windows

We used to have a bot connected to staging, but I just went looking for it and it has vanished. Very likely it was lost during the outage from a few weeks back. I will work on bringing it back up and hook it up to the production master soon.

Siva Chandra

Does the cmake configure example are valid?

    cmake -G Ninja ../llvm-project/llvm -DCMAKE_C_COMPILER=C:/src/clang-build/bin/clang-cl.exe -DCMAKE_CXX_COMPILER=C:/src/clang-build/bin/clang-cl.exe  -DLLVM_TARGETS_TO_BUILD=X86 -DLLVM_FORCE_BUILD_RUNTIME=libc -DLLVM_ENABLE_PROJECTS=libc -DLLVM_NATIVE_ARCH=x86_64 -DLLVM_HOST_TRIPLE=x86_64-window-x86-gnu

seems the LLVM_HOST_TRIPLE should be -DLLVM_HOST_TRIPLE=x86_64-window-x86-msvc
not gnu

@lygstate - We used to have a builder connected to LLVM staging and it was running llvm-zorg/libc-windows.py at main · llvm/llvm-zorg · GitHub - Its been sometime that someone actually went through the exercise of building and testing on Windows. Can you please start a different topic if you are seeing errors, and share the error messages you are seeing?

I didn’t trigger build error, just point out x86_64-window-x86-gnu is for mingw/gnu abi, not for msvc abi,this looks weried even though it’s build/test/running