ycm-core / YouCompleteMe

A code-completion engine for Vim
http://ycm-core.github.io/YouCompleteMe/
GNU General Public License v3.0
25.36k stars 2.8k forks source link

Compile Error in Windows with VS2010. Does YCM support MSVC10( Visual Studio 2010)? #2340

Closed metalmac closed 7 years ago

metalmac commented 7 years ago

Issue Prelude

Please complete these steps and check these boxes (by putting an x inside the brackets) before filing your issue:

Thank you for adhering to this process! It ensures your issue is resolved quickly and that neither your nor our time is needlessly wasted.

Issue Details

[If filing a bug report, please include a list of steps that describe how to reproduce the bug you are experiencing. Also include test code if relevant.]

1. Issue Brief

I tried to compile the ycm plugin for my Vim 8.0in Windows, and I followed the Windows Intallation Guide .Following are the step I tried to do.

1) Already downloaded gvim80.exe from this link and installed my Vim 8.0 to C:\Vim; 2) Downloaded the latest YCM respos from here and did git submodule update --init --recursive; 3) Copied the ycm toC:\Vim\vimfiles\bundle and Installed the ycm in Vim with Vundle; 4) Raninstall.py --all inC:\Vim\vimfiles\bundle\YouCompleteMe;

Unfortunately, it failed at install.py, please check the > Section4. to see the details.

2. OS Environment

Windows 7 Ultimate X64

C:\Vim\vimfiles\bundle\YouCompleteMe>ver
Microsoft Windows [版本 6.1.7600]

3. Relevant Software informations

C:\Vim\vimfiles\bundle\YouCompleteMe>vim --version
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Sep 12 2016 18:17:48)
MS-Windows 32 位控制台版本
包含补丁: 1-2
编译者 mool@tororo
巨型版本 无图形界面。  可使用(+)与不可使用(-)的功能:
+acl             +ex_extra        -mouseshape      +tag_old_static
+arabic          +extra_search    +multi_byte      -tag_any_white
+autocmd         +farsi           +multi_lang      -tcl
-balloon_eval    +file_in_path    -mzscheme        +termguicolors
-browse          +find_in_path    -netbeans_intg   -tgetent
++builtin_terms  +float           +num64           -termresponse
+byte_offset     +folding         +packages        +textobjects
+channel         -footer          +path_extra      +timers
+cindent         +gettext/dyn     -perl            +title
+clientserver    -hangul_input    +persistent_undo -toolbar
+clipboard       +iconv/dyn       -postscript      +user_commands
+cmdline_compl   +insert_expand   +printer         +vertsplit
+cmdline_hist    +job             +profile         +virtualedit
+cmdline_info    +jumplist        -python          +visual
+comments        +keymap          -python3         +visualextra
+conceal         +lambda          +quickfix        +viminfo
+cryptv          +langmap         +reltime         +vreplace
+cscope          +libcall         +rightleft       +wildignore
+cursorbind      +linebreak       -ruby            +wildmenu
+cursorshape     +lispindent      +scrollbind      +windows
+dialog_con      +listcmds        +signs           +writebackup
+diff            +localmap        +smartindent     -xfontset
+digraphs        -lua             +startuptime     -xim
-dnd             +menu            +statusline      -xpm_w32
-ebcdic          +mksession       -sun_workshop    -xterm_save
+emacs_tags      +modify_fname    +syntax
+eval            +mouse           +tag_binary
     系统 vimrc 文件: "$VIM\vimrc"
     用户 vimrc 文件: "$HOME\_vimrc"
 第二用户 vimrc 文件: "$HOME\vimfiles\vimrc"
 第三用户 vimrc 文件: "$VIM\_vimrc"
      用户 exrc 文件: "$HOME\_exrc"
  第二用户 exrc 文件: "$VIM\_exrc"
       defaults file: "$VIMRUNTIME\defaults.vim"
编译方式: cl -c /W3 /nologo  -I. -Iproto -DHAVE_PATHDEF -DWIN32  -DFEAT_CSCOPE
-DFEAT_JOB_CHANNEL      -DWINVER=0x0501 -D_WIN32_WINNT=0x0501  /Fo.\ObjCi386/ /O
x /GL -DNDEBUG  /Zl /MT -DDYNAMIC_ICONV -DDYNAMIC_GETTEXT -DFEAT_HUGE /Fd.\ObjCi
386/ /Zi
链接方式: link /RELEASE /nologo /subsystem:console /LTCG:STATUS oldnames.lib ker
nel32.lib advapi32.lib shell32.lib gdi32.lib  comdlg32.lib ole32.lib uuid.lib /m
achine:i386  /nodefaultlib libcmt.lib  user32.lib          WSock32.lib  /PDB:vim
.pdb -debug
C:\Vim\vimfiles\bundle\YouCompleteMe>python --version
Python 2.7.8
C:\Vim\vimfiles\bundle\YouCompleteMe>cmake --version
cmake version 3.6.2

CMake suite maintained and supported by Kitware (kitware.com/cmake).

4. Error Details

Please check the install log below:

C:\Vim\vimfiles\bundle\YouCompleteMe>
C:\Vim\vimfiles\bundle\YouCompleteMe>install.py --all
Searching Python 2.7 libraries...
Found Python library: C:\Python27\libs\python27.lib
Found Python headers folder: C:\Python27\include
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:26 (project):
  No CMAKE_C_COMPILER could be found.

CMake Error at CMakeLists.txt:26 (project):
  No CMAKE_CXX_COMPILER could be found.

-- Configuring incomplete, errors occurred!
See also "C:/Users/metalmac/AppData/Local/Temp/ycm_build.p32mpv/CMakeFiles/CMake
Output.log".
See also "C:/Users/metalmac/AppData/Local/Temp/ycm_build.p32mpv/CMakeFiles/CMake
Error.log".
Traceback (most recent call last):
  File "C:\Vim\vimfiles\bundle\YouCompleteMe\third_party\ycmd\build.py", line 35
9, in BuildYcmdLib
    subprocess.check_call( [ 'cmake' ] + full_cmake_args )
  File "C:\Python27\lib\subprocess.py", line 540, in check_call
    raise CalledProcessError(retcode, cmd)
CalledProcessError: Command '['cmake', '-G', 'Visual Studio 14', '-DPYTHON_LIBRA
RY=C:\\Python27\\libs\\python27.lib', '-DPYTHON_INCLUDE_DIR=C:\\Python27\\includ
e', '-DUSE_CLANG_COMPLETER=ON', '-DUSE_PYTHON2=ON', 'C:\\Vim\\vimfiles\\bundle\\
YouCompleteMe\\third_party\\ycmd\\cpp']' returned non-zero exit status 1

ERROR: The build failed.

NOTE: It is *highly* unlikely that this is a bug but rather
that this is a problem with the configuration of your system
or a missing dependency. Please carefully read CONTRIBUTING.md
and if you're sure that it is a bug, please raise an issue on the
issue tracker, including the entire output of this script
and the invocation line used to run it.

Traceback (most recent call last):
  File "C:\Vim\vimfiles\bundle\YouCompleteMe\install.py", line 44, in <module>
    Main()
  File "C:\Vim\vimfiles\bundle\YouCompleteMe\install.py", line 33, in Main
    subprocess.check_call( [ python_binary, build_file ] + sys.argv[1:] )
  File "C:\Python27\lib\subprocess.py", line 540, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['C:\\Python27\\python.exe', u'C:\\Vim\\
vimfiles\\bundle\\YouCompleteMe\\third_party\\ycmd\\build.py', '--all']' returne
d non-zero exit status 1

C:\Vim\vimfiles\bundle\YouCompleteMe>

After that , I rechecked the Windows Intallation Guide and found this , does it mean that I can not compile ycm with MSVC10 (Visual Studio 2010) due to YCM may not support?

To simply compile with everything enabled, there's a --all flag. So, to install with all language features, ensure msbuild, go, tsserver, node, npm, and cargo tools are installed and in your PATH, then simply run:

cd %USERPROFILE%/vimfiles/bundle/YouCompleteMe python install.py --all You can specify the Microsoft Visual C++ (MSVC) version using the --msvc option. YCM officially supports MSVC 11 (Visual Studio 2012), 12 (2013), and 14 (2015).

So I tried to specify MSVC 10 mannually to install, like this, it poped out another error below

C:\Vim\vimfiles\bundle\YouCompleteMe>install.py --msvc 10 --all
usage: build.py [-h] [--clang-completer] [--system-libclang]
                [--omnisharp-completer] [--gocode-completer]
                [--racer-completer] [--system-boost] [--msvc {11,12,14}]
                [--tern-completer] [--all] [--enable-debug]
build.py: error: argument --msvc: invalid choice: 10 (choose from 11, 12, 14)
Traceback (most recent call last):
  File "C:\Vim\vimfiles\bundle\YouCompleteMe\install.py", line 44, in <module>
    Main()
  File "C:\Vim\vimfiles\bundle\YouCompleteMe\install.py", line 33, in Main
    subprocess.check_call( [ python_binary, build_file ] + sys.argv[1:] )
  File "C:\Python27\lib\subprocess.py", line 540, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['C:\\Python27\\python.exe', u'C:\\Vim\\
vimfiles\\bundle\\YouCompleteMe\\third_party\\ycmd\\build.py', '--msvc', '10', '
--all']' returned non-zero exit status 2

Anyway, I want to know two things: 1 ) Does YCM supports MSVC 10 ? 2 ) If ycm supports MSVC10 ,how can I use it ? Maybe I used it in the wrong way(like specify the MSVC10)

Thanks for all the advice :) Have a Nice Day!

metalmac commented 7 years ago

Although, I did note raninstall.py successfully, it still poped out ycm debuginfos as I open gvimlike images below ycm_windows 2016-09-16_175959

ycm_windows 2016-09-16_180819

micbou commented 7 years ago

From the documentation:

You can specify the Microsoft Visual C++ (MSVC) version using the --msvc option. YCM officially supports MSVC 11 (Visual Studio 2012), 12 (2013), and 14 (2015).

If you still want to use MSVC 10, you'll need to follow the full instructions but there is no guarantee that it will compile without errors. I recommend to install Visual Studio Community as mentioned in the documentation.

Although, I did note raninstall.py successfully, it still poped out ycm debuginfos as I open gvimlike below image

See the error message on your first screenshot (you can see the full message with the :messages command):

The ycmd server SHUT DOWN (restart with ':YcmRestartServer'). YCM core library not detected; you need to compile YCM before using it. Follow the instructions in the documentation.

If you still have issues or questions on building YCM, you should ask them on the ycm-users Google group. The issue tracker is not for technical support.

metalmac commented 7 years ago

@micbou , Ok Thank you though. I already installed the VisualStudio 2010 Ultimate,I will try to compile ycm again follow your advice.

Microsoft Visual Studio 2010 版本 10.0.30319.1 RTMRel Microsoft .NET Framework 版本 4.5.50709 RTMRel

已安装的版本: Ultimate

Microsoft Office Developer Tools 01019-532-2002102-70605 Microsoft Office Developer Tools

Microsoft Visual C# 2010 01019-532-2002102-70605 Microsoft Visual C# 2010

Microsoft Visual C++ 2010 01019-532-2002102-70605 Microsoft Visual C++ 2010

Microsoft Visual Studio 2010 代码分析拼写检查器 01019-532-2002102-70605 Microsoft Visual Studio 2010 代码分析拼写检查器

International CorrectSpell(TM) spelling correction system(C) 1993 部分版权归 Lernout & Hauspie Speech Products N.V. 所有。保留所有权利。

The American Heritage(R) Dictionary of the English Language, Third Edition。版权所有(C) 1992 Houghton Mifflin Company。电子版由 Lernout & Hauspie Speech Products N.V. 颁发许可。保留所有权利。

Microsoft Visual Studio 2010 体系结构和建模工具 01019-532-2002102-70605 Microsoft Visual Studio 2010 体系结构和建模工具

UML® 和 Unified Modeling Language™ 是 Object Management Group, Inc. 在美国和其他国家/地区的商标或注册商标。

Microsoft Visual Studio 2010 团队资源管理器 01019-532-2002102-70605 Microsoft Visual Studio 2010 团队资源管理器

Microsoft Visual Web Developer 2010 01019-532-2002102-70605 Microsoft Visual Web Developer 2010

.NET Reflector Visual Studio Extension 9.0.1.374 Integrates .NET Reflector into Visual Studio to allow you to seamlessly debug into third-party code and assemblies, even if you don't have the source code for them.

Visit www.reflector.net for more information.

Copyright (c) 2009-2012 Red Gate Software Inc.

Crystal Reports Templates for Microsoft Visual Studio 2010
Crystal Reports Templates for Microsoft Visual Studio 2010

ESRI ArcGIS 1.0 Visual Studio 2010 Integration Framework for ESRI ArcGIS Developers

Microsoft Visual Studio 2010 SharePoint 开发人员工具 10.0.30319 Microsoft Visual Studio 2010 SharePoint 开发人员工具

NuGet Package Manager 1.4.20701.9038 NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

PowerCommands for Visual Studio 2010 1.0 A set of power commands for Visual Studio 2010

Visual Assist X
For more information about Visual Assist X, see the Whole Tomato Software website at http://www.WholeTomato.com. Copyright (c) 1997-2011 Whole Tomato Software, Inc.

VsVim 2.0.1.0 VsVim is a Vim emulator for Visual Studio

What's more, I could not use the Google Group from China because of GFW, if it is possible to discuss it on ycm Gitter channel?

micbou commented 7 years ago

What's more, I could not use the Google Group from China because of GFW, if it is possible to discuss it on ycm Gitter channel?

Yes, of course.