[cfe-dev] Using Clang 5.0.0 RC2 with MSVC dev builds

Stephan T. Lavavej via cfe-dev cfe-dev at lists.llvm.org
Tue Aug 15 14:53:54 PDT 2017


[Reid Kleckner]
> As I read the current code, we search the environment, then we try the
> new setup config API, and then we try the registry. That seems correct.

Agreed.

> I think the change from 4.0 to 5.0 was that when we look at the
> environment, we now try these variables in order:
> 1. VCToolsInstallDir: this is new
> 2. VCINSTALLDIR: we always tried this before PATH
> 3. PATH
> Are either of those first two variables set to point to 2013?

Neither are set:

C:\Temp>set VCToolsInstallDir
Environment variable VCToolsInstallDir not defined

C:\Temp>set VCINSTALLDIR
Environment variable VCINSTALLDIR not defined

[Zachary Turner]
> Since we most likely cannot reproduce this
> without access to this same development environment

I'll try to set up an imitation for you. We have NuGet packages of the toolset (which are basically ZIPs), and extracting them and rearranging the directories should be sufficient to replicate the structure of our dev builds.

> I think the easiest way to figure this out would be for Stephan to
> debug into clang itself. It definitely sounds like a problem, but I
> think only you will be able to figure out exactly what it is.
> Luckily it should be easy to figure out.  Set a breakpoint in the
> constructor of MSVCToolChain in clang/lib/Driver/ToolChains/MSVC.cpp
> and see what's going on in there.  Most likely it's the VCToolsInstallDir
> or VCINSTALLDIR as Reid mentioned.

That'll be my last resort, since I think I'll need to build Clang with debug info, and I haven't gone through the process of building Clang yet.

[don hinton]
> I can't test this since I don't have windows, but I think the problem
> is the additional directory checks in findVCToolChainViaEnvironment()
> which don't match his path to cl.exe, i.e.,
> S:\binaries\x86ret\bin\i386\cl.exe.

I think you're correct (which is why I explained my directory structure). If I had an override option to say "you'll find cl.exe and link.exe on the path, and I've set up INCLUDE and LIB for you, there's no need to inspect the directory structure further", I think that would be sufficient.

Thanks,
STL


More information about the cfe-dev mailing list