ycmd server is not runing,












用irony 在msys2中编译, windows下完美运行, 编译方式:

Building the server binary

Two options for building the server binary are described here: Msys2, or natively using the Visual Studio compiler.

MSys2 Build

Prerequisites: Msys2, and MinGW packages.

clang and cmake were installed through Msys2/MinGW’s pacman and are at standard locations. These are the steps taken to get irony-mode to work.

  1. git clone https://github.com/Sarcasm/irony-mode.git ~/irony-mode

  2. Open a mingw{32, 64} shell. cd into the irony-mode server sub-directory, mkdir build as the project requires out of source build.

  3. The find module that comes with this project should be able to find libclang, which is called clang.dll in MinGW Packages.

    cd build
    cmake -G "MSYS Makefiles" ..
    make -j 4

In case it finds the static libclang.a, also distributed with the clang package, and fails to build, you’ve to make it point to the clang.dll available in the /mingw{32, 64}/bin directory.

cmake -DLIBCLANG_LIBRARY=/mingw64/bin/clang.dll -G 'MSYS Makefiles' ..
  1. Make sure the path to clang.dll is in emacs’ exec_path and shell PATH. Note that the emacs here is Windows native. Following is what is in my site-start.el:

    (setenv "PATH"
             "C:\\alt\\msys32\\usr\\bin" ";"
             "C:\\alt\\msys32\\mingw32\\bin" ";"
             (getenv "PATH")
    (setq exec-path (append '("c:/alt/msys32/usr/bin" "c:/alt/msys32/mingw32/bin")

Building using Visual studio

  1. Install the native windows version of clang and cmake, choosing 32 bit or 64 bit versions as appropriate. Ensure that they’re on the PATH (the installers will offer to do this for you). Verify at a fresh command prompt using where libclang and cmake --help

  2. Install the Visual C++ Build Tools 2015 (link). These provide the command line tools such as the compiler and Visual Studio build system, without needed a full Visual Studio install. If you already have VS installed, then you can use that.

  3. git clone https://github.com/Sarcasm/irony-mode.git ~/irony-mode

  4. Open “Visual C++ 2015 x64 Native Build Tools Command Prompt” - a start menu/screen shortcut will have been created by the installer.

  5. Change directory to the server subdirectory of your irony mode checkout

  6. md build then cd build

  7. cmake -G "Visual Studio 14 2015 Win64" ..

  8. MSBuild IronyMode.sln /p:Configuration=Release

  9. The output will be found in bin/Release/irony-server.exe

Setting up emacs

This guide assumes a Windows native version of emacs.

  1. Move the built executable to the new directory .emacs.d/irony/bin/irony-server.exe

  2. Install irony-mode through MELPA.

  3. It appears that libclang (clang.dll) does not get the same default include paths as clang executables. clang++ -E -x c++ - -v < NUL will give you a list of the include paths that clang knows by default. Add them to .clang_complete if they are not already there so libclang knows them too.

  4. While last item might now give one great completion candidates, the more likely outcome is that one will cry over the delay (30+ seconds is common) in getting these suggestions. Read issue #131 for the sordid details. The tl;dr is: (setq w32-pipe-read-delay 0) will take out the bulk of the delay and make Irony again a happy experience on Windows. I have not observed any deleterious effects from the new settings but there is no guarantee these settings won’t break something else on one’s system.

For the curious: the two Emacs related bugs are reported here: the important one and the less so. It is possible the imminent 24.4 release will set these defaults to better values as the current settings seem to be leftover from Windows 9x days! The reason this bites Irony particularly hard is that the completer often returns multi-megabyte results to Emacs. The default delay is set at 50ms, and the pipe buffer size is 4K. That means with default settings Emacs adds at least an additional delay of 2M/4K*50ms = 25 seconds to transfer 2M bytes of data from the completer on Windows.

In addition the 24.3 version of Emacs will freeze often while using irony-mode. For details see the same issue #131 thread. Emacs 24.4 works correctly and official Windows binary release is expected to be out soon.