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?

valiano
  • 16,433
  • 7
  • 64
  • 79
Andreas Loanjoe
  • 2,205
  • 10
  • 26
  • 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 '19 at 03:41

2 Answers2

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

Albert Einstein
  • 7,472
  • 8
  • 36
  • 71
xudon9
  • 76
  • 1
  • 4
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.

Kerry Seitz
  • 43
  • 1
  • 6
  • 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 04 '19 at 14:30