daniel's blog

YCM and MSYS2


on blog

MSYS2 is a fantastic project for running ported GNU/Linux software on MS Windows natively, but unfortunately YouCompleteMe does not build cleanly with msys2-x86_64. If we try to run python2 install.py, it fails with errors in LONG_BIT definitions and object linking. Examining the files under third-party/ycmd sources, it seems that there are misconfigured build options: 1) SIZEOF_LONG is defined as 4, which is incorrect in a 64-bit environment; 2) there are no checks for MSYS environment, and because cmake defines MSYS as an “UNIX” environment instead of a “WIN32” one, some of the necessary definitions (dllimport, BOOST_PYTHON_SOURCE and others) will be missing. All we need to do is fix the wrong definition and put a few checks in the ycmd’s CMakeLists. Here is the patch file.

pacman -S git cmake gcc python2
cd ~/.vim/plugged/YouCompleteMe
git pull && git submodule update --init --recursive
patch -p1 -d third-party/ycmd < ~/Downloads/msys2-ycm.patch
python2 install.py

I left Clang out because it is still buggy, but at least we have YCM up and running! :]

Daniel Lima