Thursday, April 25, 2013

Build LLVM/Clang (3.3) on Windows x64

In order to get clang_complete to work on Windows x64 with Vim x64 and Python x64, libclang.dll must first be compiled from source.


  • Visual Studio 2010 or 2012
  • Recent Vim x64 with Python27 support
  • Python 2.7 x64
  • CMake for Windows


  1. Checkout llvm and clang using subversion. Trunk is version 3.3 at the time of this writing.
    svn co llvm
    cd llvm\tools
    svn co clang
  2. Configure using cmake. Tweak the build command below to suit your system.
    cmake C:\absolute\path\to\llvm -DPYTHON_EXECUTABLE="C:\Python27\python.exe" -DSubversion_SVN_EXECUTABLE="C:\Program Files\SlikSvn\bin\svn.exe" -DCMAKE_INSTALL_PREFIX="C:\clang" -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD=X86;CppBackend -G "Visual Studio 11 Win64"
  3. Build using cmake.
    cmake --build . --config Release
  4. Install using cmake.
    cmake --build . --config Release --target install

Install clang_complete

  1. Use Vundle or Pathogen to install clang_complete.
  2. In your vimrc, point clang_complete to your newly-compiled libclang.dll.
    if has('win64')
        let g:clang_library_path='C:/clang/bin'


  1. My interest was to build the 64 bit version of the libclang.dll. The build was successful but it seems that the 64bit version cannot be used with Python, I got a windows access error. I suspect that it might be possible that clang is not ms friendly (like different calling conventions ).

    1. You need to have 64-bit Python. I tested it and it's working for me.

    2. I have a 64 bit Python installed. Could you share the libclang.dll and the