I have been trying to install YouCompleteMe
for a long time. At first, I failed because I need to build Vim
having python support. Now I have it solved, but I always fail at building YouCompleteMe
itself because of various kinds of problems (if you guys want to help me on this, that's okay too :-)). The build log of YouCompleteMe
is this (using only ./install.py
):
./install.py
-- The C compiler identification is GNU 5.3.1
...... Successful Detects ......
-- Detecting CXX compile features - done
Your C++ compiler supports C++11, compiling in that mode.
-- Found PythonLibs: /usr/local/lib/libpython2.7.a (found suitable version "2.7.10", minimum required is "2.6")
-- Found PythonInterp: /usr/local/bin/python2 (found suitable version "2.7.10", minimum required is "2.6")
NOT using libclang, no semantic completion for C/C++/ObjC will be available
-- Found PythonInterp: /usr/local/bin/python2 (found version "2.7.10")
-- Looking for include file pthread.h
-- Looking for include file pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/ycm_build.jmI4vO
Scanning dependencies of target BoostParts
[ 0%] [ 2%] [ 2%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/atomic/src/lockpool.cpp.o
...... Successfully Builds ......
[ 92%] Building CXX object ycm/CMakeFiles/ycm_client_support.dir/PythonSupport.cpp.o
In file included from /home/bunny/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/BoostParts/boost/type_traits/ice.hpp:15:0,
from /home/bunny/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/BoostParts/boost/python/detail/def_helper.hpp:9,
from /home/bunny/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/BoostParts/boost/python/class.hpp:29,
from /home/bunny/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/BoostParts/boost/python.hpp:18,
from /home/bunny/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/PythonSupport.h:21,
from /home/bunny/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/ycm_client_support.cpp:19:
/home/bunny/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/BoostParts/boost/type_traits/detail/ice_or.hpp:17:71: note: #pragma message: NOTE: Use of this header (ice_or.hpp) is deprecated
# pragma message("NOTE: Use of this header (ice_or.hpp) is deprecated")
^
...... Some similar messages ......
In file included from /home/bunny/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/BoostParts/boost/type_traits/ice.hpp:18:0,
from /home/bunny/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/BoostParts/boost/python/detail/def_helper.hpp:9,
from /home/bunny/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/BoostParts/boost/python/class.hpp:29,
from /home/bunny/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/BoostParts/boost/python.hpp:18,
from /home/bunny/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/PythonSupport.h:21,
from /home/bunny/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/ycm_core.cpp:19:
/home/bunny/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/BoostParts/boost/type_traits/detail/ice_eq.hpp:17:71: note: #pragma message: NOTE: Use of this header (ice_eq.hpp) is deprecated
# pragma message("NOTE: Use of this header (ice_eq.hpp) is deprecated")
^
[ 96%] Building CXX object ycm/CMakeFiles/ycm_client_support.dir/CustomAssert.cpp.o
[ 97%] Building CXX object ycm/CMakeFiles/ycm_client_support.dir/Result.cpp.o
[ 98%] [100%] Building CXX object ycm/CMakeFiles/ycm_core.dir/CustomAssert.cpp.o
Building CXX object ycm/CMakeFiles/ycm_core.dir/Result.cpp.o
Linking CXX shared library /home/bunny/.vim/bundle/YouCompleteMe/third_party/ycmd/ycm_client_support.so
/usr/bin/ld: /usr/local/lib/libpython2.7.a(abstract.o): relocation R_X86_64_32S against `_Py_NotImplementedStruct' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libpython2.7.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
ycm/CMakeFiles/ycm_client_support.dir/build.make:387: recipe for target '/home/bunny/.vim/bundle/YouCompleteMe/third_party/ycmd/ycm_client_support.so' failed
make[3]: *** [/home/bunny/.vim/bundle/YouCompleteMe/third_party/ycmd/ycm_client_support.so] Error 1
CMakeFiles/Makefile2:130: recipe for target 'ycm/CMakeFiles/ycm_client_support.dir/all' failed
make[2]: *** [ycm/CMakeFiles/ycm_client_support.dir/all] Error 2
make[2]: *** Waiting for unfinished jobs....
Linking CXX shared library /home/bunny/.vim/bundle/YouCompleteMe/third_party/ycmd/ycm_core.so
/usr/bin/ld: /usr/local/lib/libpython2.7.a(abstract.o): relocation R_X86_64_32S against `_Py_NotImplementedStruct' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libpython2.7.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
ycm/CMakeFiles/ycm_core.dir/build.make:387: recipe for target '/home/bunny/.vim/bundle/YouCompleteMe/third_party/ycmd/ycm_core.so' failed
make[3]: *** [/home/bunny/.vim/bundle/YouCompleteMe/third_party/ycmd/ycm_core.so] Error 1
CMakeFiles/Makefile2:165: recipe for target 'ycm/CMakeFiles/ycm_core.dir/all' failed
make[2]: *** [ycm/CMakeFiles/ycm_core.dir/all] Error 2
CMakeFiles/Makefile2:209: recipe for target 'ycm/CMakeFiles/ycm_support_libs.dir/rule' failed
make[1]: *** [ycm/CMakeFiles/ycm_support_libs.dir/rule] Error 2
Makefile:148: recipe for target 'ycm_support_libs' failed
make: *** [ycm_support_libs] Error 2
Traceback (most recent call last):
File "/home/bunny/.vim/bundle/YouCompleteMe/third_party/ycmd/build.py", line 372, in <module>
Main()
File "/home/bunny/.vim/bundle/YouCompleteMe/third_party/ycmd/build.py", line 361, in Main
BuildYcmdLibs( args )
File "/home/bunny/.vim/bundle/YouCompleteMe/third_party/ycmd/build.py", line 275, in BuildYcmdLibs
subprocess.check_call( build_command )
File "/usr/local/lib/python2.7/subprocess.py", line 540, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--target', 'ycm_support_libs', '--', '-j', '4']' returned non-zero exit status 2
Traceback (most recent call last):
File "./install.py", line 32, in <module>
Main()
File "./install.py", line 21, in Main
subprocess.check_call( [ python_binary, build_file ] + sys.argv[1:] )
File "/usr/local/lib/python2.7/subprocess.py", line 540, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/usr/local/bin/python', '/home/bunny/.vim/bundle/YouCompleteMe/third_party/ycmd/build.py']' returned non-zero exit status 1
. So I install the package vim-youcompleteme
by apt
successfully. So how can I use YouCompleteMe
now?
EDIT: I used vam
to install YouCompleteMe
, no problem, but when I open vi
, it gives me this error:
Error detected while processing function youcompleteme#Enable.. <SNR>30_SetUpPython:
line 29:
Traceback (most recent call last):
Press ENTER or type command to continue
Error detected while processing function youcompleteme#Enable..<SNR>30_SetUpPython:
line 29:
File "<string>", line 25, in <module>
Press ENTER or type command to continue
Error detected while processing function youcompleteme#Enable..<SNR>30_SetUpPython:
line 29:
File "/usr/share/vim-youcompleteme/python/ycm/youcompleteme.py", line 34, in <module>
Press ENTER or type command to continue
Error detected while processing function youcompleteme#Enable..<SNR>30_SetUpPython:
line 29:
from ycm.client.ycmd_keepalive import YcmdKeepalive
Press ENTER or type command to continue
Error detected while processing function youcompleteme#Enable..<SNR>30_SetUpPython:
line 29:
File "/usr/share/vim-youcompleteme/python/ycm/client/ycmd_keepalive.py", line 22, in <module>
Press ENTER or type command to continue
Error detected while processing function youcompleteme#Enable..<SNR>30_SetUpPython:
line 29:
from ycm.client.base_request import BaseRequest
Press ENTER or type command to continue
Error detected while processing function youcompleteme#Enable..<SNR>30_SetUpPython:
line 29:
File "/usr/share/vim-youcompleteme/python/ycm/client/base_request.py", line 20, in <module>
Press ENTER or type command to continue
Error detected while processing function youcompleteme#Enable..<SNR>30_SetUpPython:
line 29:
import requests
Press ENTER or type command to continue
Error detected while processing function youcompleteme#Enable..<SNR>30_SetUpPython:
line 29:
ImportError: No module named requests
Press ENTER or type command to continue
vi --version
output:
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Feb 11 2016 19:19:30)
Compiled by Vostro-3400
Normal version with GTK2 GUI. Features included (+) or not (-):
-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 +viminfo
-cscope +lispindent -python3 +vreplace
+cursorbind +listcmds +quickfix +wildignore
+cursorshape +localmap +reltime +wildmenu
+dialog_con_gui -lua -rightleft +windows
+diff +menu -ruby +writebackup
+digraphs +mksession +scrollbind +X11
+dnd +modify_fname +signs -xfontset
-ebcdic +mouse +smartindent +xim
-emacs_tags +mouseshape -sniff +xsmp_interact
+eval -mouse_dec +startuptime +xterm_clipboard
+ex_extra -mouse_gpm +statusline -xterm_save
+extra_search -mouse_jsbterm -sun_workshop
-farsi -mouse_netterm +syntax
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
user exrc file: "$HOME/.exrc"
system gvimrc file: "$VIM/gvimrc"
user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "~/.vim/gvimrc"
system menu file: "$VIMRUNTIME/menu.vim"
fall-back for $VIM: "/usr/local/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK -pthread -I/usr/include/gtk-2.0 -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/gio-unix-2.0/ -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/libpng12 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng12 -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/freetype2 -I/usr/local/include -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc -L/usr/local/lib -Wl,--as-needed -o vim -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lfontconfig -lfreetype -lSM -lICE -lXpm -lXt -lX11 -lXdmcp -lSM -lICE -lm -ltinfo -lnsl -lselinux -ldl -L/usr/lib/python2.7/config-x86_64-linux-gnu -lpython2.7 -lpthread -ldl -lutil -lm -Xlinker -export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions
:version
output/usr/local/lib/python2.7
is python built from source. That can lead to any number of python problems. Why do you have it?