I‘ve download the “LLVM source code (.sig)” and “Clang source code (.sig)” and build Clang on Windows/MinGW. After that, I’ve install emacs (25.1) and the following three packages from melpa:
- irony
- company
- company-irony
My init.el file configuration is the next (nothing else):
(require 'package)
(add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/"))
(package-initialize)
(add-hook 'after-init-hook 'global-company-mode)
(eval-after-load 'company
'(add-to-list 'company-backends 'company-irony))
(add-hook 'c++-mode-hook 'irony-mode)
(add-hook 'c-mode-hook 'irony-mode)
(defun my-irony-mode-hook ()
(define-key irony-mode-map [remap completion-at-point]
'irony-completion-at-point-async)
(define-key irony-mode-map [remap complete-symbol]
'irony-completion-at-point-async))
(add-hook 'irony-mode-hook 'my-irony-mode-hook)
(add-hook 'irony-mode-hook 'irony-cdb-autosetup-compile-options)
(when (boundp 'w32-pipe-read-delay)
(setq w32-pipe-read-delay 0))
(when (boundp 'w32-pipe-buffer-size)
(setq irony-server-w32-pipe-buffer-size (* 64 1024)))
After that, I proceed to compile the Irony-server, with these steps:
cd to Irony’s package site.
D:\hh_home\.emacs.d\elpa\irony-20171002.1130\server
create build directory.
mkdir build && cd build
compile with cmake(cmake-3.9.4-win64-x64) typing in cmd these three commands
cmake -DLIBCLANG_LIBRARY=D:\tt_tools\LLVM\5_0_0\llvm\bin\libclang.dll -G "MinGW Makefiles" ..
mingw32-make
"cmake" "-DCMAKE_INSTALL_PREFIX=d:/hh_home/.emacs.d/irony/" "d:/hh_home/.emacs.d/elpa/irony-20171002.1130/server" && "cmake" --build . --use-stderr --config Release --target install
Everything seems OK at this point. I checked that the Cmake placed irony-server.exe in the specified folder.
After that, I run emacs with simple hello.cpp file (at source path D:) and check emacs starts company-mode and irony-mode but irony-server.exe is not running.
Just when I type M-x company-irony is when irony-server.exe starts but doesn’t show anything related apparently with the completion at point that should be and seems that company-irony is deactivated (or switched to another ?) with company-mode and irony-mode active.
Additionally checking other completion tests, i.e: std::vector vec; vec. ¿? doesn’t show anything and when I type M-x company-mode at completion point the buffer says “Cannot complete at point”.
To specify the compilation flags and the system header locations I’m using the following .clang_format file in D:\
-std=c++14
-target
x86_64-w64-mingw32
-Wall
-pedantic
-DDEBUG
-ID:\tt_tools\mingw\distro\15_3\bin\../lib/gcc/x86_64-w64-mingw32/7.2.0/../../../../include/c++/7.2.0
-ID:\tt_tools\mingw\distro\15_3\bin\../lib/gcc/x86_64-w64-mingw32/7.2.0/../../../../include/c++/7.2.0/bits
-ID:\tt_tools\mingw\distro\15_3\bin\../lib/gcc/x86_64-w64-mingw32/7.2.0/../../../../include/c++/7.2.0/x86_64-w64-mingw32
-ID:\tt_tools\mingw\distro\15_3\bin\../lib/gcc/x86_64-w64-mingw32/7.2.0/../../../../include/c++/7.2.0/backward
-ID:\tt_tools\mingw\distro\15_3\bin\../lib/gcc/x86_64-w64-mingw32/7.2.0/include
-ID:\tt_tools\mingw\distro\15_3\bin\../lib/gcc/x86_64-w64-mingw32/7.2.0/include-fixed
-ID:\tt_tools\mingw\distro\15_3\bin\../lib/gcc/x86_64-w64-mingw32/7.2.0/../../../../x86_64-w64-mingw32/include
I’ve obtained the location of my paths typing cpp -xc++ -Wp,-v < NUL
and copying literally from …search stars here. By the way: gcc version 7.2.0 (GCC), Target: x86_64-w64-mingw32 and Thread model: posix.
I’ve made a lot of test to try to enable this feature but nothing… :-( Hope someone can help me litle bit…
Many thanks