2

I'm trying to build the LLVM install with cmake but it is giving me an error about the LLVM_ENABLE_DIA_SDK. I managed to build LLVM before without PDB's but I am trying to get started with libclang so I need the PDB. Cmake gives me the following error:

CMake Error at cmake/config-ix.cmake:482 (message):
DIA SDK not found. If you have both VS 2012 and 2013 installed, you may
need to uninstall the former and re-install the latter afterwards.
Call Stack (most recent call first):
CMakeLists.txt:575 (include)

I have VS 2014 installed (2015 with update 3) which does have a DIA folder. Could anyone tell me how to point it to the right DIA SDK location?

1
  • I just had to run cmake in a visual studio command prompt for this to work. I am using Visual Studio 2017
    – Damian
    Jan 15, 2019 at 3:41

2 Answers 2

2

I ran into the same problem today, and Kerry Seitz's answer does work.

Actually, the environment variable VSINSTALLDIR doesn't have to be set manually -- Instead, open the Developer Command Prompt for VS. It will execute a batch script and create the VSINTALLDIR properly. Run CMake within that prompt, then everything will be OK.

Inspect the VSINSTALLDIR variable

1

It looks like LLVM's CMake files assume an environment variable called VSINSTALLDIR.

See: https://github.com/llvm-mirror/llvm/blob/master/cmake/config-ix.cmake#L475

I'm not sure the right way to set this environment variable, but I manually created said environment variable for my user account and set it to the root of my Visual Studio install directory (e.g., C:\Program Files (x86)\Microsoft Visual Studio 14.0\). That fixed the issue for me.

Note: I included a trailing \ in the variable, but I am not sure if it is necessary.

1
  • The trailing \ is indeed mandatory. For me, this worked: set VSINSTALLDIR=c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\. Also, must not use "" around the path. Any of these will cause set(MSVC_DIA_SDK_DIR "$ENV{VSINSTALLDIR}DIA SDK") in config-ix.cmake to fail.
    – valiano
    Feb 4, 2019 at 14:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.