Sarcasm / irony-mode

A C/C++ minor mode for Emacs powered by libclang
GNU General Public License v3.0
906 stars 99 forks source link

compile the irony-mode failed #464

Open emacsun opened 6 years ago

emacsun commented 6 years ago

Hi @Sarcasm I am desperate to compile the iron-server.exe. However, after around one hundread of failure. I need your help. thanks in advance.

the environment is listed as bellow:

OS: windows 10: LLVM: 5.0.1 cmake: 3.10.2

mainly because "Detecting Clang resource directore --fail"

and "Cannot open include file: 'clang-c/Index.h': No such file or directory"

the command and the message is listed as bellow: c:\Users\cliyh\AppData\Roaming.emacs.d\elpa\irony-20180104.1109\server\build>cmake -DLIBCLANG_LIBRARY=c:\tools\LLVM\lib\libclang.lib -DLIBCLANG_INCLUDE_DIR=c:\tools\LLVM\lib -G "Visual Studio 14 2015 Win64" .. -- Selecting Windows SDK version to target Windows 10.0.16299. -- The C compiler identification is MSVC 19.0.24210.0 -- The CXX compiler identification is MSVC 19.0.24210.0 -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe -- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Found LibClang: C:/tools/LLVM/lib/libclang.lib -- Detecting Clang resource directory -- Detecting Clang resource directory -- fail CMake Warning at cmake/CheckClangResourceDir.cmake:77 (message): CheckClangResourceDir: failed to compile checker, please report.

Compile output:
  Change Dir: C:/Users/cliyh/AppData/Roaming/.emacs.d/elpa/irony-20180104.1109/server/build/CMakeFiles/CMakeTmp

Run Build Command:"C:/Program Files (x86)/MSBuild/14.0/bin/MSBuild.exe" "cmTC_e8b70.vcxproj" "/p:Configuration=Debug" "/p:VisualStudioVersion=14.0"

Microsoft (R) Build Engine version 14.0.25420.1

Copyright (C) Microsoft Corporation. All rights reserved.

Build started 1/25/2018 12:00:28 AM.

Project "C:\Users\cliyh\AppData\Roaming.emacs.d\elpa\irony-20180104.1109\server\build\CMakeFiles\CMakeTmp\cmTC_e8b70.vcxproj" on node 1 (default targets).

PrepareForBuild:

Creating directory "cmTC_e8b70.dir\Debug\".
Creating directory "C:\Users\cliyh\AppData\Roaming\.emacs.d\elpa\irony-20180104.1109\server\build\CMakeFiles\CMakeTmp\Debug\".
Creating directory "cmTC_e8b70.dir\Debug\cmTC_e8b70.tlog\".

InitializeBuildStatus:

Creating "cmTC_e8b70.dir\Debug\cmTC_e8b70.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.

ClCompile:

C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64\CL.exe /c /IC:\tools\LLVM\lib /Zi /W3 /WX- /Od /Ob0 /D WIN32 /D _WINDOWS /D _HAS_EXCEPTIONS=0 /D "CMAKE_INTDIR=\"Debug\"" /D _MBCS /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /GR /Fo"cmTC_e8b70.dir\Debug\\" /Fd"cmTC_e8b70.dir\Debug\vc140.pdb" /Gd /TP /errorReport:queue  /EHs-c- "C:\Users\cliyh\AppData\Roaming\.emacs.d\elpa\irony-20180104.1109\server\build\CMakeFiles\CMakeTmp\LibClangDiagnosticsChecker.cpp"
Microsoft (R) C/C++ Optimizing Compiler Version 19.00.24210 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

LibClangDiagnosticsChecker.cpp
cl /c /IC:\tools\LLVM\lib /Zi /W3 /WX- /Od /Ob0 /D WIN32 /D _WINDOWS /D _HAS_EXCEPTIONS=0 /D "CMAKE_INTDIR=\"Debug\"" /D _MBCS /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /GR /Fo"cmTC_e8b70.dir\Debug\\" /Fd"cmTC_e8b70.dir\Debug\vc140.pdb" /Gd /TP /errorReport:queue  /EHs-c- "C:\Users\cliyh\AppData\Roaming\.emacs.d\elpa\irony-20180104.1109\server\build\CMakeFiles\CMakeTmp\LibClangDiagnosticsChecker.cpp"

cl : Command line warning D9025: overriding '/EHs' with '/EHs-' [C:\Users\cliyh\AppData\Roaming.emacs.d\elpa\irony-20180104.1109\server\build\CMakeFiles\CMakeTmp\cmTC_e8b70.vcxproj]

cl : Command line warning D9025: overriding '/EHc' with '/EHc-' [C:\Users\cliyh\AppData\Roaming.emacs.d\elpa\irony-20180104.1109\server\build\CMakeFiles\CMakeTmp\cmTC_e8b70.vcxproj]

C:\Users\cliyh\AppData\Roaming.emacs.d\elpa\irony-20180104.1109\server\build\CMakeFiles\CMakeTmp\LibClangDiagnosticsChecker.cpp(9): fatal error C1083: Cannot open include file: 'clang-c/Index.h': No such file or directory [C:\Users\cliyh\AppData\Roaming.emacs.d\elpa\irony-20180104.1109\server\build\CMakeFiles\CMakeTmp\cmTC_e8b70.vcxproj]

Done Building Project "C:\Users\cliyh\AppData\Roaming.emacs.d\elpa\irony-20180104.1109\server\build\CMakeFiles\CMakeTmp\cmTC_e8b70.vcxproj" (default targets) -- FAILED.

Build FAILED.

"C:\Users\cliyh\AppData\Roaming.emacs.d\elpa\irony-20180104.1109\server\build\CMakeFiles\CMakeTmp\cmTC_e8b70.vcxproj" (default target) (1) ->

(ClCompile target) ->

cl : Command line warning D9025: overriding '/EHs' with '/EHs-' [C:\Users\cliyh\AppData\Roaming\.emacs.d\elpa\irony-20180104.1109\server\build\CMakeFiles\CMakeTmp\cmTC_e8b70.vcxproj]
cl : Command line warning D9025: overriding '/EHc' with '/EHc-' [C:\Users\cliyh\AppData\Roaming\.emacs.d\elpa\irony-20180104.1109\server\build\CMakeFiles\CMakeTmp\cmTC_e8b70.vcxproj]

"C:\Users\cliyh\AppData\Roaming.emacs.d\elpa\irony-20180104.1109\server\build\CMakeFiles\CMakeTmp\cmTC_e8b70.vcxproj" (default target) (1) ->

(ClCompile target) ->

C:\Users\cliyh\AppData\Roaming\.emacs.d\elpa\irony-20180104.1109\server\build\CMakeFiles\CMakeTmp\LibClangDiagnosticsChecker.cpp(9): fatal error C1083: Cannot open include file: 'clang-c/Index.h': No such file or directory [C:\Users\cliyh\AppData\Roaming\.emacs.d\elpa\irony-20180104.1109\server\build\CMakeFiles\CMakeTmp\cmTC_e8b70.vcxproj]

  2 Warning(s)
  1 Error(s)

Time Elapsed 00:00:00.85

Call Stack (most recent call first): src/CMakeLists.txt:8 (check_clang_resource_dir)

-- Irony package version is '1.2.0' -- Found emacs: C:/Emacs64/bin/emacs.exe -- Configuring done -- Generating done -- Build files have been written to: C:/Users/cliyh/AppData/Roaming/.emacs.d/elpa/irony-20180104.1109/server/build

Dapuva76 commented 6 years ago

Think I got the same, came here by googling for "CMake Warning at cmake/CheckClangResourceDir.cmake:77 (message): CheckClangResourceDir: failed to compile checker, please report."

nelder-san commented 6 years ago

i have the same trouble, don't know how to solve it.

OS: windows 10; clang version 6.0.0 cmake: 3.11.0

Visual Studio 15 2017 Win64

Dapuva76 commented 6 years ago

I got it working by using the following command

https://imgur.com/a/HUH2LkO

(yeah I took a screenshot because I was too tired to google "copy from mini-buffer" at this point :P )

nelder-san commented 6 years ago

Thanks, Dapuva76,

Message "cmake/CheckClangResourceDir.cmake:77 (message):" appears only with cmake-gui, when i select path to "source code" and path to "build the binaries", then push Configure button and configuration process fails with "...cmake:77 ..." message.

But if i use console cmake command mentioned at https://github.com/Sarcasm/irony-mode/wiki/Setting-up-irony-mode-on-Windows all right. This behavior quite surprized for me.

cmake -G "Visual Studio 15 2017 Win64" ..
-- The C compiler identification is MSVC 19.13.26131.1
-- The CXX compiler identification is MSVC 19.13.26131.1
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.13.26128/bin/Hostx86/x64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.13.26128/bin/Hostx86/x64/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.13.26128/bin/Hostx86/x64/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.13.26128/bin/Hostx86/x64/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found LibClang: C:/Program Files/LLVM/lib/libclang.lib
-- Detecting Clang resource directory
-- Detecting libclang builtin headers directory -- success
-- Irony package version is '1.2.0'
-- Found emacs: C:/emacs/bin/emacs.exe
-- Configuring done
-- Generating done
-- Build files have been written to: C:/develop/emacs-irony/irony-mode-master/server/build
Hi-Angel commented 5 years ago

To sum up solution by @Dapuva76 : when irony-install-server prompts for command, you need to add to the already existing text a -DCLANG_RESOURCE_DIR that points out to clang libs.

E.g. for me on Archlinux it was -DCLANG_RESOURCE_DIR=/usr/lib.

(no idea why this dir was not detected, though worth noting that I used clang-svn package instead of plain clang until today)