LLVM 3.6: problems building on Windows using MSVC 2013


I have been using LLVM+Clang in my project for some time and it has been working just fine up to now (I am currently using version 3.5.1).

However, with version 3.6 having just been released, I thought I would give it a try and update my code to use MCJIT rather than the now discontinued JIT. Well, this proved to be a relatively smooth process, and everything is now working fine on Linux and OS X. However, on Windows, I am having problems building LLVM+Clang. Actually, Clang itself, it would seem.

I guess it’s worth mentioning that I don’t build LLVM+Clang the ‘normal’ way. Instead, LLVM+Clang is part of my project repository and I build it as part of my project. Now, as mentioned above, I am having problems building version 3.6 on Windows, this using MSVC 2013. I am basically getting things like:

When you say you build it “as part of your project” what does that mean exactly? Are you using CMake + ninja? MSBuild? Something else?

Sorry, I am using CMake+JOM or CMake+Ninja, if Ninja is available on the developer’s machine. Either way, it fails in both cases with a message similar to the one I included below (which was obtained using CMake+Ninja).

Just in case, my (current) CMakeLists.txt file can be found at here (and some other CMake related stuff here).


Can you go to the build directory of the build that works (i.e. the normal LLVM/Clang build), open your build.ninja file, find the line for clang/lib/Driver/Compilation.cpp, and it should show you the exact command line. Compare this command line to the one you’re running above that fails. It might give you a hint about what’s going wrong.

Yes, I did try that and noticed a few differences that were expected (i.e. some definitions and include directories that are specific to my project), as well as a few flags that were unset in the ‘normal’ build while not in mine (namely /GR /EHsc in my case while /GR- /EHs-c- in the ‘normal’ build). Anyway, just to be certain, I did configure my CMake file in such a way that it would generate exactly the same command lines (besides my project specific definitions and include directories), but to no avail.

I think I might try to create a CMake project from scratch with the view of building LLVM/Clang in a way that is similar to what I need for my project. Hopefully, that will result in a positive build, which will then help me to identify what is ‘wrong’ with my project’s LLVM/Clang build (which I am sure there must be since a ‘normal’ build works fine).