LLVM Discussion Forums

LLVM not building in Vusual Studio

Am using llvm-10.0.0.src and clang-10.0.0.src, on Windows 10 x86-64, Visual Studio Community 2019 Version 16.6.0 . After moving the clang source to tools/clang in the LLVM source, and setting up with cmake:

cmake -Thost=x64 ..\llvm-10.0.0.src

I load llvm-libraries.vcxproj into VS, and the build fails. Here is an excerpt from the log file:

 Building Attributes.inc...
    llvm-tblgen.exe: Unknown command line argument '-gen-attrs'.  Try: '..\..\..\Debug\bin\llvm-tblgen.exe --help'

I run llvm-tblgen, as suggested, and get:

>.\llvm-tblgen.exe --help
llvm-tblgen.exe: Unknown command line argument '--help'.  Try: '.\llvm-tblgen.exe --help'
llvm-tblgen.exe: Did you mean '--color'?

I have full log files – Normal and Detailed, but don’t see how to attach them. A few months ago I was able to compile the version 10 code fine, although it was with a slightly older version of VS.

I can confirm that this is happening, but only for debug builds. Release builds build without errors. Strange…

The same thing seems to be happening for the 10.0.1-rc1 release, but not for the master branch.
A workaround is to enable LLVM_OPTIMIZED_TABLEGEN in cmake, this will build the release-version of llvm-tblgen.exe in debug-builds.

normvcr, jcmac, You are welcome to the topic https://reviews.llvm.org/D80433. Here is a solution.

Thanks for the pointers. I am 80% done (after 17 hrs) with the build, and no errors! I ended up using


and the llvm-libraries.vcxproj. The GUI cmake was a good idea, too :smile:.

Actually LLVM_OPTIMIZED_TABLEGEN is not a therapy, its just turns off MSVC optimization level(as it would be in Release mode) for tblgen and the bug hides.