ycm-core / YouCompleteMe

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

Can't jump to definition #2686

Closed tianser closed 7 years ago

tianser commented 7 years ago

What did you do? in c++ project; run GoToDefinition command What did you expect to happen? jump the function definition and open the file What actually happened? RuntimeError: Can't jump to definition or declaration 2017-06-15 14:45:45,054 - INFO - Received defined subcommands request 2017-06-15 14:45:51,084 - INFO - Received command request Traceback (most recent call last): File "/root/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/bottle/bottle.py", line 861, in _handle return route.call(args) File "/root/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/bottle/bottle.py", line 1734, in wrapper rv = callback(*a, *ka) File "/root/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/watchdog_plugin.py", line 109, in wrapper return callback( args, kwargs ) File "/root/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/hmac_plugin.py", line 72, in wrapper body = callback( *args, **kwargs ) File "/root/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/handlers.py", line 83, in RunCompleterCommand request_data ) ) File "/root/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/completer.py", line 336, in OnUserCommand return command( self, request_data, arguments[ 1: ] ) File "/root/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/cpp/clang_completer.py", line 125, in self._GoTo( request_data ) ), File "/root/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/cpp/clang_completer.py", line 196, in _GoTo raise RuntimeError( 'Can\'t jump to definition or declaration.' ) RuntimeError: Can't jump to definition or declaration.

vim --version VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Jan 30 2014 10:56:39) +acl +farsi +mouse_netterm +syntax +arabic +file_in_path +mouse_sgr +tag_binary +autocmd +find_in_path -mouse_sysmouse +tag_old_static -balloon_eval +float +mouse_urxvt -tag_any_white -browse +folding +mouse_xterm -tcl ++builtin_terms -footer +multi_byte +terminfo +byte_offset +fork() +multi_lang +termresponse +cindent +gettext -mzscheme +textobjects -clientserver -hangul_input +netbeans_intg +title -clipboard +iconv +path_extra -toolbar +cmdline_compl +insert_expand +perl +user_commands +cmdline_hist +jumplist +persistent_undo +vertsplit +cmdline_info +keymap +postscript +virtualedit +comments +langmap +printer +visual +conceal +libcall +profile +visualextra +cryptv +linebreak +python/dyn +viminfo +cscope +lispindent -python3 +vreplace +cursorbind +listcmds +quickfix +wildignore +cursorshape +localmap +reltime +wildmenu +dialog_con -lua +rightleft +windows +diff +menu +ruby/dyn +writebackup +digraphs +mksession +scrollbind -X11 -dnd +modify_fname +signs -xfontset -ebcdic +mouse +smartindent -xim +emacs_tags -mouseshape -sniff -xsmp +eval +mouse_dec +startuptime -xterm_clipboard +ex_extra +mouse_gpm +statusline -xterm_save +extra_search -mouse_jsbterm -sun_workshop -xpm 系统 vimrc 文件: "/etc/vimrc" 用户 vimrc 文件: "$HOME/.vimrc" 第二用户 vimrc 文件: "~/.vim/vimrc" 用户 exrc 文件: "$HOME/.exrc" $VIM 预设值: "/etc" $VIMRUNTIME 预设值: "/usr/share/vim/vim74" 编译方式: gcc -c -I. -Iproto -DHAVE_CONFIG_H -O2 -g -pipe -Wall -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
链接方式: gcc -L. -Wl,-z,relro -fstack-protector -rdynamic -Wl,-export-dynamic -Wl,--enable-new-dtags -Wl,-rpath,/usr/lib64/perl5/CORE -Wl,-z,relro -L/usr/local/lib -Wl,--as-needed -o vim -lm -lnsl -lselinux -lncurses -lacl -lattr -lgpm -ldl -Wl,--enable-new-dtags -Wl,-rpath,/usr/lib64/perl5/CORE -fstack-protector -L/usr/lib64/perl5/CORE -lperl -lresolv -lnsl -ldl -lm -lcrypt -lutil -lpthread -lc

output of YcmDebugInfo: Printing YouCompleteMe debug information... -- Server has Clang support compiled in: True -- Clang version: clang version 3.8.0 (tags/RELEASE_380/final) -- C-family completer debug information: -- Configuration file found and loaded -- Configuration path: /root/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py -- Flags: ['-Wall', '-Wextra', '-Werror', '-Wc++98-compat', '-Wno-long-long', '-Wno-variadic-macros', '-fexceptions', '-DNDEBUG', '-DUSECLANG COMPLETER', '-std=c++11', '-x', 'c++', '-isystem', '/root/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/../BoostParts', '-isystem', '/System /Library/Frameworks/Python.framework/Headers', '-isystem', '/root/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/../llvm/include', '-isystem' , '/root/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/../llvm/tools/clang/include', '-I', '/root/.vim/bundle/YouCompleteMe/third_party/ycmd /cpp/ycm/.', '-I', '/root/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/./ClangCompleter', '-isystem', '/root/.vim/bundle/YouCompleteMe/thir d_party/ycmd/cpp/ycm/./tests/gmock/gtest', '-isystem', '/root/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/./tests/gmock/gtest/include', '- isystem', '/root/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/./tests/gmock', '-isystem', '/root/.vim/bundle/YouCompleteMe/third_party/ycmd /cpp/ycm/./tests/gmock/include', '-resource-dir=/root/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../clang_includes', '-fspell-checking'] -- Server running at: http://127.0.0.1:56923 -- Server process ID: 26608 -- Server logfiles: -- /tmp/ycm_temp/server_56923_stdout.log -- /tmp/ycm_temp/server_56923_stderr.log

output of YcmToggleLogs: -- /tmp/ycm_temp/server_56923_stderr.log 2017-06-15 18:21:42,528 - INFO - Received event notification 2017-06-15 18:21:42,537 - INFO - Received event notification 2017-06-15 18:21:42,538 - INFO - Adding buffer identifiers for file: /root/chengpeng/ceph/src/ceph_mon.cc 2017-06-15 18:21:44,326 - INFO - Received health request 2017-06-15 18:21:44,333 - INFO - Received debug info request 2017-06-15 18:22:22,055 - INFO - Received event notification 2017-06-15 18:22:22,059 - INFO - Received filetype completion available request 2017-06-15 18:22:22,101 - INFO - Received event notification 2017-06-15 18:22:40,436 - INFO - Received command request Traceback (most recent call last): File "/root/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/bottle/bottle.py", line 861, in _handle return route.call(args) File "/root/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/bottle/bottle.py", line 1734, in wrapper rv = callback(*a, *ka) File "/root/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/watchdog_plugin.py", line 109, in wrapper return callback( args, kwargs ) File "/root/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/hmac_plugin.py", line 72, in wrapper body = callback( *args, **kwargs ) File "/root/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/handlers.py", line 83, in RunCompleterCommand request_data ) ) File "/root/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/completer.py", line 336, in OnUserCommand return command( self, request_data, arguments[ 1: ] ) File "/root/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/cpp/clang_completer.py", line 125, in self._GoTo( request_data ) ), File "/root/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/cpp/clang_completer.py", line 196, in _GoTo raise RuntimeError( 'Can\'t jump to definition or declaration.' ) RuntimeError: Can't jump to definition or declaration. 2017-06-15 18:22:48,406 - INFO - Received event notification 2017-06-15 18:22:48,417 - INFO - Received event notification 2017-06-15 18:22:50,863 - INFO - Received event notification 2017-06-15 18:22:50,921 - INFO - Received event notification -- /tmp/ycm_temp/server_56923_stdout.log: 1 serving on http://127.0.0.1:56923

uname -a

Linux node175 3.10.0-514.6.1.el7.x86_64 #1 SMP Wed Jan 18 13:06:36 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

cat /etc/redhat-release Red Hat Enterprise Linux Server release 7.1 (Maipo)

Output of build/install commands:

!/usr/bin/env python

from future import print_function
from future import division
from future import unicode_literals from future import absolute_import

import os
import subprocess
import sys
import os.path as p
import glob

PY_MAJOR, PY_MINOR = sys.version_info[ 0 : 2 ]
if not ( ( PY_MAJOR == 2 and PY_MINOR >= 6 ) or
( PY_MAJOR == 3 and PY_MINOR >= 3 ) or
PY_MAJOR > 3 ):
sys.exit( 'YouCompleteMe requires Python >= 2.6 or >= 3.3; '
'your version of Python is ' + sys.version )

DIR_OF_THIS_SCRIPT = p.dirname( p.abspath( file ) )
DIR_OF_OLD_LIBS = p.join( DIR_OF_THIS_SCRIPT, 'python' )

def Main():
build_file = p.join( DIR_OF_THIS_SCRIPT, 'third_party', 'ycmd', 'build.py' )

if not p.isfile( build_file ):
sys.exit( 'File ' + build_file + ' does not exist; you probably forgot '
'to run:\n\tgit submodule update --init --recursive\n\n' )

python_binary = sys.executable
subprocess.check_call( [ python_binary, build_file ] + sys.argv[1:] )

# Remove old YCM libs if present so that YCM can start.
old_libs = (
glob.glob( p.join( DIR_OF_OLD_LIBS, 'ycm_core.' ) ) +
glob.glob( p.join( DIR_OF_OLD_LIBS, 'ycm_client_support.' ) ) +
glob.glob( p.join( DIR_OF_OLD_LIBS, 'clang.*') ) )
for lib in old_libs:
os.remove( lib ) if name == "main": Main()

puremourning commented 7 years ago

Please complete the issue template and see CONTRIBUTING.md

tianser commented 7 years ago

@puremourning completed it

vheon commented 7 years ago

in c++ project; run GoToDefinition command

Can you post a minimal reproducible test case?