Install Vim Plugin: YouCompleteMe in CentOS

最近一則fb鬧得沸沸揚揚XD
主要是說我怎麼會用vim編輯php編了兩年…
然後就很多人開始提供說vim才是最好用的~因為有許多plugin可以用….Orz
現在就來安裝一下還蠻多人推的ycm

參考此篇文章Centos下安裝YouCompleteMe
首先要先確認vim版本必須是7.3.584以上
接著安裝vundle

[root@WP ~]# git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle
Initialized empty Git repository in /root/.vim/bundle/vundle/.git/
remote: Reusing existing pack: 2586, done.
Receiving objects: 100% (2586/2586), 774.70 KiB | 304 KiB/s, done.
remote: Total 2586 (delta 0), reused 0 (delta 0)
Resolving deltas: 100% (844/844), done.

接著在/etc/vimrc檔案中添加
filetype off
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()

Bundle 'Valloric/YouCompleteMe'

filetype plugin indent on

接著下載YCM的source

[root@WP ~]# git clone https://github.com/Valloric/YouCompleteMe.git ~/.vim/bundle/YouCompleteMe
Initialized empty Git repository in /root/.vim/bundle/YouCompleteMe/.git/
remote: Counting objects: 28158, done.
remote: Compressing objects: 100% (18973/18973), done.
remote: Total 28158 (delta 8444), reused 28148 (delta 8437)
Receiving objects: 100% (28158/28158), 27.91 MiB | 2.55 MiB/s, done.
Resolving deltas: 100% (8444/8444), done.

之後便開始對ycm進行編譯,但在這之前先透過yum install安裝cmake28、python-devel、gcc、

[root@WP ~]# mkdir ycm_build
[root@WP ~]# cd ycm_build/
[root@WP ycm_build]# cmake28 -G "Unix Makefiles" . ~/.vim/bundle/YouCompleteMe/cpp
-- The C compiler identification is GNU 4.4.7
-- The CXX compiler identification is GNU 4.4.7
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
Your C++ compiler does NOT support C++11, compiling in C++03 mode.
-- Found PythonLibs: /usr/lib/libpython2.6.so (found suitable version "2.6.6", minimum required is "2.6")
NOT using libclang, no semantic completion for C/C++/ObjC will be available
-- Found PythonInterp: /usr/bin/python (found version "2.6.6")
-- 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: /root/ycm_build

[root@WP ycm_build]# cmake28 -G "Unix Makefiles" -DPATH_TO_LLVM_ROOT=~/.vim/bundle/YouCompleteMe/cpp/llvm . ~/.vim/bundle/YouCompleteMe/cpp

Your C++ compiler does NOT support C++11, compiling in C++03 mode.
Using libclang to provide semantic completion for C/C++/ObjC
-- Configuring done
-- Generating done
-- Build files have been written to: /root/ycm_build

[root@WP ycm_build]# make ycm_core
Scanning dependencies of target BoostParts
[  0%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/regex/src/w32_regex_traits.cpp.o
[  1%] Building CXX object BoostParts/CMakeFiles/BoostParts.dir/libs/regex/src/cregex.cpp.o
##省略##
[ 96%] Building CXX object ycm/CMakeFiles/ycm_core.dir/ycm_core.cpp.o
[ 97%] Building CXX object ycm/CMakeFiles/ycm_core.dir/Utils.cpp.o
[ 98%] Building CXX object ycm/CMakeFiles/ycm_core.dir/CandidateRepository.cpp.o
[ 98%] Building CXX object ycm/CMakeFiles/ycm_core.dir/Result.cpp.o
[100%] Building CXX object ycm/CMakeFiles/ycm_core.dir/LetterNode.cpp.o
[100%] Building CXX object ycm/CMakeFiles/ycm_core.dir/LetterNodeListMap.cpp.o
Linking CXX shared library /root/.vim/bundle/YouCompleteMe/python/ycm_core.so
[100%] Built target ycm_core

[root@WP ycm_build]# make
[ 66%] Built target BoostParts
Scanning dependencies of target ycm_client_support
[ 66%] Building CXX object ycm/CMakeFiles/ycm_client_support.dir/IdentifierUtils.cpp.o
[ 67%] Building CXX object ycm/CMakeFiles/ycm_client_support.dir/CustomAssert.cpp.o
##省略##
collect2: ld 回傳 1
make[2]: *** [ycm/tests/ycm_core_tests] Error 1
make[1]: *** [ycm/tests/CMakeFiles/ycm_core_tests.dir/all] Error 2

試了兩次還是一樣的error 慘….
下次再戰…..

This entry was posted in Linux. Bookmark the permalink.