Clang unit test failure / Windows

I downloaded clang 3.6 and built on Windows Vista using MinGW 4.8.1 and CMake 3.2.2

1 ran: cmake -G “MSYS Makefiles” …/llvm

2 There are two generated make files which have backslash problems around line 54. These were simple to edit by hand however I believe this should not be required.

(a) tools/lto/CMakeFiles/LTO_exports.dir/build.make
(b) tools/clang/tools/libclang/CMakeFiles/libclang_exports.dir/build.make

3 clang builds, however it must be restarted a few times.

4 After the build was done I ran clang-test and it failed with 269 unexpected failures.

5 Linking libclang with our application appears to work. At run time, calling “clang_parseTranslationUnit2()” returns an extremely large number for the error code.

I am happy to try any suggestions.



1 Use -G “Unix Makefiles”
2 Do not use MSYS 2, lots of the tests fail.


I have seen the export problem. As you say it resolved itself after restarting the make.
You need mingw gcc 4.8 at least. mingw-w64 and all tools versions sounds OK.
compiler-rt not required.

Are you using MSYS2 for the shell functionality?

I am running the clang and LLVM tests. There is also a buildbot running them after every revision.
That MSYS should work. My experience was that you need to run make twice but not edit any file.
My guess is that you may have a non-msys grep or other utility on the PATH before the msys bin dir so it runs instead.
Try to put the msys/bin as the first directory in the PATH and restart the command window.

You can try running one of the failing tests with -v argument and looking into why it fails.

The bug tracker is at

if you can provide a patch (fix) for the build problem please do.

I see no unexpected failures. With that many tests failing, it’s very likely all fail for the same reason, so please try running any of the failing tests with -v argument and looking into why it fails.

The “make clang-test” should have given you a report listing the filenames of the tests that failed.

In the same directory where you find the clang that you just built, there should also be a program named llvm-lit.

If you run that llvm-lit with an argument that is the filename of one of the tests that failed, it should run just that test. With the –v option you will also get more details about why it failed.

(The name you pass to llvm-lit needs to be a proper path relative to your current directory, i.e. if “dir path\to\test” works, then “my-build-dir\llvm-lit path\to\test” should also work.)



The test is expecting clang-cl (the VS-compatible driver) to complain about the /TP option and having a .lib file passed as input, when the command line also specifies /c (compilation only, no linking). But clang-cl is not behaving as expected, it is happily producing a command to run the linker.

Sorry I don’t have any idea what could cause this behavior, I know almost nothing about that driver. Somebody else will have to offer a suggestion.


This is clearly the MSys shell transforming the “/c” argument into “c:/”. The test is listed as “REQUIRES: shell-preserves-root” to prevent running it in such environments.

How are you running things precisely and what are you actually trying to do? If you just want to run the tests, building the ‘check-clang’ target is the easiest and best supported way to do that.