CMake fails to build Clang for Visual C++ / Windows 7 - 32-bit

Hi,

I am a newbie wishing to use Clang. I have followed instructions here:

http://clang.llvm.org/get_started.html

I used “Visual Studio 11 Win32” as the value for “-G” option (as I saw “Visual Studio 11 Win64” option in the docs). However, whether I specify this option or not, I get the following error:

Hi Asif,

What is your Python version? You can test with

$ python -V

LLVM/Clang runs on Python 2, so if you have Python 3 you need install
Python 2.x and put it ahead in your PATH before running CMake.

- Kim

Clang can’t parse VC11 headers, so you are much better off compiling it with mingw (using VC11 to compile clang and using stdlibc++ headers afterwards is a PITA).
Grab a mingw build from here: http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/rubenvb/ (tested with gcc-4-6-dw2).

Then configure cmake with cmake -G “MinGW Makefiles” -DCMAKE_BUILD_TYPE=Release <path_to_llvm>.

Then use mingw32-make to compile and off you go.

Clang works fine with stdlibc++ with gcc up to 4.8, but will only link with with 4.6.3 according to my own experience.

Hi Asif,

Hi Asif,

Now it emits another set of errors:

---------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------
-- Clang version: 3.4
-- Found Subversion: C:/Program Files/TortoiseSVN/bin/svn.exe (found version
"1.7.9")
-- Expecting header to go in
C:/llvm_clang/build/tools/clang/lib/Basic/SVNVersion.inc
CMake Error at C:/Program Files/CMake
2.8/share/cmake-2.8/Modules/FindSubversion.cmake:83 (message):
  Command "C:/Program Files/TortoiseSVN/bin/svn.exe info C:/llvm_clang/llvm"
  failed with output:

  svn: E155036: Please see the 'svn upgrade' command

  svn: E155036: Working copy 'C:\llvm_clang\llvm' is too old (format 10,
  created by Subversion 1.6)

It looks like the working copy was created by an older SVN than the
one used by CMake.

Either use SVN 1.7.9 to check out the working copy or put SVN 1.6 in
the PATH so that CMake uses it.

Could you or anybody else help me on this?

Please keep the cfe-users list in CC, because I will soon be out of my depth :slight_smile:

- K

Hi Kim,

Hi Asif,

It looks like a test failure.

I don't know enough about LLVM or Clang at larget to understand the
details, but I guess a 100% functioning llvm-mc isn't necessary for
Clang to do its work.

Please keep questions on the list and you might get replies from
people who know what they're talking about.

- Kim