Windows Installer

I’m trying to install LLVM-3.6.0-r218288-win32.exe on Windows 7 Ultimate x64. The install doesn’t complain, but the toolset doesn’t show up in either Visual Studio 2013 or Visual Studio 2010. Also I selected the choices to add LLVM to the path for every user and put an LLVM icon on the desktop. Neither of this happened. Can anyone tell me how to get this to work?

Regards,
Eric Mader

I’m not sure about the Windows installer, but if you build and install LLVM for Windows from the source code, you should be able to go to the installation folder, find a subfolder named “tools/msbuild” and run the “install.bat” script. This should make your LLVM toolset appear in VS.

I was hoping to not have to build LLVM myself, especially on Windows. Can anybody help me with the Windows installer?

Failing that, I find the directions for how to compile on Windows hard to follow? Can I build using Cygwin?

Regards,
Eric

I was not necessarily asking you to build, but just to check your installation folder and see whether you have “tools/msbuild/install.bat” there because I don’t know if the Windows installer puts this there. However, if you want to build outside VS, I recommend mingw-w64. If you have any difficulties about the VS build process though, feel free to ask questions :slight_smile:

Usually, to build LLVM on a Windows system from scratch (with VS installed), I would just install git for windows, which already installs a lot of important GNU tools, and ask to put everything in my path. Then I would install CMake and put this in my path. Afterwards, open a shell with VS paths, create a build folder, run CMake -G"Visual Studio …" and then "msbuild ". A lot of people prefer to use ninja instead of msbuild, though, but you must install ninja and use CMake -GNinja instead.

Just follow the instructions in http://clang.llvm.org/get_started.html under “Using Visual Studio”.

I copied the x64 toolsets by hand and now when I try to compile a file, I get an error message saying that the build tools for llvm-2013 cannot be found. I guess that this is because the installer didn’t correctly add the LLVM tools to $PATH. How can I correctly add the LLVM tools to the path?

Regards,
Eric

Open the file toolset-vs2013.props and you’ll understand what’s happening and where the path is set. It tries to fetch the LLVM installation path from the Windows registry. Just fix this (maybe editing your registry or editing the .props file, whatever suits you best).

I changed tooset-vs2013.props to this:

<Project xmlns=> C:\Program Files (x86)\LLVM “$(LLVMInstallDir)\msbuild-bin”;$(ExecutablePath) $(LLVMInstallDir)\lib\clang\3.6.0\lib\windows;$(LibraryPath) -m64 -fmsc-version=1800 %(AdditionalOptions) It still doesn’t work… Is there something else I need to change? Regards, Eric

Your install dir has a whitespace. Have you tried quoting? e.g. “C:\Program Files (x86)\LLVM”

Best regards,
Rafael Auler

Quoting doesn’t seem to make a difference. Strangely, the Win32 toolset seems to work. (Where “work” means that clang runs and produces a bunch of strange errors :wink:

The only difference I see between the two .props files is that one passes “-m86” to the compiler and the other one passes “-m64”.

They both reference $(Platform), so I wonder if maybe $(Platform) isn’t getting set correctly? The platform name in the project is “x64” which seems right…

Regards,
Eric

I replaced all instances of “$(Platform)” with “x64” for the x64 .props file and it still fails, so it looks like that guess was wrong as well.

Regards,
Eric

Which strange errors? If you are trying to build a C++ project, remember that Clang does not yet support exception handling and you should disable them. To do this, you should go to Project Properties and navigate to Configuration Properties, C/C++, Command Line, Additional Options and put /GR- /D_HAS_EXCEPTIONS=0 there.

If it builds a 32-bit binary, it should succeed with 64-bit, since the toolset is exactly the same, with the difference of the parameters passed to clang-cl.exe.

Thanks for all the help. Comments inline below.

Regards,
Eric

The errors I’m seeing look like this: 1> In file included from C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\algorithm:6: 1> In file included from C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xmemory:6: 1> In file included from C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xmemory0:909: 1> In file included from C:\Program Files (x86)\LLVM\msbuild-bin…\lib\clang\3.6.0\include\intrin.h:34: 1> In file included from C:\Program Files (x86)\LLVM\msbuild-bin…\lib\clang\3.6.0\include\x86intrin.h:29: 1> In file included from C:\Program Files (x86)\LLVM\msbuild-bin…\lib\clang\3.6.0\include\immintrin.h:28: 1>C:\Program Files (x86)\LLVM\msbuild-bin…\lib\clang\3.6.0\include\mmintrin.h(52,40): error : cannot initialize a parameter of type ‘attribute((vector_size(2 * sizeof(int)))) int’ (vector of 2 ‘int’ values) with an rvalue of type ‘__v2si’ (aka ‘int’) 1> return __builtin_ia32_vec_ext_v2si((__v2si)__m, 0); 1> ^~~~~~~~~~~ I’m porting a bunch of code from MacOS X (using Xcode) to Windows. I suppose it’s possible I haven’t set some preprocessor variable correctly, but looking at the LLVM include files in the chain, they don’t seem to depend on any preprocessor variables. D’oh! Just worked out that when I hand-installed the x64 toolset, I didn’t rename the .props and .targets files to “toolset.props” and “toolset.targets” per install.bat. Now I get the same compilation errors I that I saw for Win32. (Progress!) On Mon, Sep 29, 2014 at 9:26 PM, Eric Mader wrote:

Hmm, your set-up sounds very similar to mine (Win 7, x64, a couple of
visual studios), and I build the installer and it works for me.

I wouldn't be too surprised if install.bat fails to find your Visual
Studio installation. Can you share the paths where it's installed and
where the existing toolsets reside?

Not being able to install the desktop icon and set the PATH is more surprising.

Did the installer run as administrator? It should, and it should pop
up the UAC when it runs.

Thanks,
Hans

Hi Hans,

I think installer.bat found my visual Studio installation because it installed the Win32 toolsets but not the x64 ones. (It took me a while to work this out :wink: I installed the x64 toolsets by hand and they seem to work.

I think the installer ran as administrator. I explicitly ran it that way again (asking it to uninstall first) just to be sure. It didn't seem to make any difference. IIRC, it did pop up the UAC when it ran.

Regards,
Eric

Hi Hans,

I think installer.bat found my visual Studio installation because it
installed the Win32 toolsets but not the x64 ones. (It took me a while to
work this out :wink: I installed the x64 toolsets by hand and they seem to
work.

Hmm, that's interesting. Is your x64 toolset path different besides
substituting the Win32 dir with x64?

Could you share the output from install.bat with "@echo off" removed?

I hadn't tried the desktop icon option in a while, and now it seems to
fail on my machine too. I'll try to figure out what's going on.

Thanks,
Hans

Hi Hans,

Answers inline below.

Regards,
Eric

Hi Hans,

I think installer.bat found my visual Studio installation because it
installed the Win32 toolsets but not the x64 ones. (It took me a while to
work this out :wink: I installed the x64 toolsets by hand and they seem to
work.

Hmm, that's interesting. Is your x64 toolset path different besides
substituting the Win32 dir with x64?

They're the same except for Win32 / x64.

Could you share the output from install.bat with "@echo off" removed?

I hadn't tried the desktop icon option in a while, and now it seems to
fail on my machine too. I'll try to figure out what's going on.

I looked at the script some more. It seems that it only loops back to try x64 if VS 2014 is installed - i.e. at the end of the :Found_V140 section it does:
   set SUCCESS = 1
   GOTO START

Since I don't have VS 2014 installed, :TRY_V140 falls through to :LOOPEND which does:
   Set SUCCESS = 1
   GOTO DONE

I added:
   set SUCCESS = 1
   GOTO START

at the end of :TRY_V140 and now the script installs the x64 toolsets too.

I looked at the script some more. It seems that it only loops back to try
x64 if VS 2014 is installed - i.e. at the end of the :Found_V140 section it
does:
  set SUCCESS = 1
  GOTO START

Since I don't have VS 2014 installed, :TRY_V140 falls through to :LOOPEND
which does:
  Set SUCCESS = 1
  GOTO DONE

I added:
  set SUCCESS = 1
  GOTO START

at the end of :TRY_V140 and now the script installs the x64 toolsets too.

Thanks for figuring this out!

I've committed a fix in r218712. I'll try to push a new snapshot build
that includes it soon.

Thanks,
Hans

I looked at the script some more. It seems that it only loops back to try
x64 if VS 2014 is installed - i.e. at the end of the :Found_V140 section it
does:
  set SUCCESS = 1
  GOTO START

Since I don't have VS 2014 installed, :TRY_V140 falls through to :LOOPEND
which does:
  Set SUCCESS = 1
  GOTO DONE

I added:
  set SUCCESS = 1
  GOTO START

at the end of :TRY_V140 and now the script installs the x64 toolsets too.

Thanks for figuring this out!

I've committed a fix in r218712. I'll try to push a new snapshot build
that includes it soon.

This is now available at
http://llvm.org/builds/downloads/LLVM-3.6.0-r218712-win32.exe

If you have time to try it out, please let me know if this fixes the
toolset install problem for you.

I'm still not sure about the "add to desktop" option, and I'm starting
to think maybe it never worked? The option to add LLVM to PATH seems
to work for me.

Thanks,
Hans