Table of Content
To use YouCompleteMe in an MSYS shell, you will need to:
- Install MSYS2
- Install CMake
- build libclang
- Install YCM (and vundle, of course)
- Bulid YCM
Install MSYS2
reference https://www.youtube.com/watch?v=pb6Yb819pF0
http://clang.llvm.org/get_started.html
https://github.com/rust-lang/rust/issues/34489
- Download MSYS2 64bit version is better
- Execute the installer binary, install MSYS2 to C:\msys64
- Run a MSYS2 shell, execute update-core
- Close the MSYS2 shell window
- Run a MINGW64 shell
- Execute pacman -Su
- Close the MINGW64 shell window
- Run a MINGW64 shell
- Execute pacman -Su AGAIN
- Execute pacman --needed -S git mingw-w64-x86_64-gcc base-devel install compiler tool chain
- vim :echo has('python') it should be 1
- gcc -v
- make -v
- cmake should NOT installed, if installed, REMOVE it. Because we don't want MINGW's cmake, but Windows'. Only Windows version can generate "MSYS Makefiles" format, which is what we need.
Install CMake
- Download from here, download the Windows 64 bit version
- Install to C:\CMake
Build libclang
referencehttp://clang.llvm.org/get_started.html
https://github.com/rust-lang/rust/issues/34489
- Get LLVM and Clang source. We don't clone the whole repo, just download the tar file. It's much faster.
- wget http://llvm.org/releases/3.9.0/llvm-3.9.0.src.tar.xz -O llvm.tar.xz
- wget http://llvm.org/releases/3.9.0/cfe-3.9.0.src.tar.xz -O clang.tar.xz
- tar xvfJ llvm.tar.xz
- tar xvfj clang.tar.xz
- mv clang llvm/tools
- Use CMake to generate make file.
- Before run cmake, you need to apply some modification:
- Use Windows version python, not MSYS's python, to generate correct source path. vi llvm/CMakeLists.txt replace COMMAND ${PYTHON_EXECUTABLE} ${LLVMBUILDTOOL} with COMMAND C:/Python27/python.exe ${LLVMBUILDTOOL}
- Add CXX flag --Wa,-mbig-obj otherwise the output .obj file will be too large.
- Add LINK flag -L/usr/lib
- Generate the make file.
- mkdir build-llvm
- cd build-llvm
- /c/CMake/bin/cmake.exe -G "MSYS Makefiles" ../llvm
- Make it
- make
- FAIL. Build fail at last step link the result file liblibclang.dll, the error message is ld.exe: cannot find -ldl but I did not pass -ldl to the linker, and I don't know how to remove it. according to http://discourse.chaiscript.com/t/basic-question-about-compiling-chaiscript-with-mingw-g/170 "dl is only needed in unix". so why my toolchain try to link it? after more search, maybe add a -L/usr/lib can fix that problem. That is weird the toolchain didn't add it at default.