CentOS 6.5 安装YouCompleteMe 报错汇总

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CentOS 6.5 安装YouCompleteMe 报错汇总相关的知识,希望对你有一定的参考价值。


支持折腾!!!



编译安装clang 3.6.0   编译器版本低

====-----编译安装clang 3.6.0   编译器版本低---------------==============
[[email protected] llvm-3.6.0]$ tar xf cfe-3.6.0.src.tar.xz 
[[email protected] llvm-3.6.0]$ tar xf clang-tools-extra-3.6.0.src.tar.xz 
[[email protected] llvm-3.6.0]$ tar xf compiler-rt-3.6.0.src.tar.xz 
[[email protected] llvm-3.6.0]$ tar xf llvm-3.6.0.src.tar.xz 
[[email protected] llvm-3.6.0]$ mv cfe-3.6.0.src llvm-3.6.0.src/tools/clang
[[email protected] llvm-3.6.0]$ mv clang-tools-extra-3.6.0.src llvm-3.6.0.src/tools/clang/tools/extra
[[email protected] llvm-3.6.0]$ mv compiler-rt-3.6.0.src llvm-3.6.0.src/projects/compiler-rt
[[email protected] llvm-3.6.0]$ cd llvm-3.6.0.src
[[email protected] llvm-3.6.0.src]$ ./configure --enable-optimized --enable-targets=host-only
[[email protected] llvm-3.6.0.src]$ echo $?
[[email protected] llvm-3.6.0.src]$ make
cc1plus: error: unrecognized command line option "-std=c++11"
cc1plus: warning: unrecognized command line option "-Wno-maybe-uninitialized"
解决办法,安装gcc 4.8


编译安装clang 3.6.2  编译器自身BUG

=====--------------编译安装clang 3.6.2  编译器自身BUG---------------------=============
需要C++11标准支持
需要Python2.7 支持
[[email protected] llvm3.6.2]$ tar xf cfe-3.6.2.src.tar.xz 
[[email protected] llvm3.6.2]$ tar xf clang-tools-extra-3.6.2.src.tar.xz 
[[email protected] llvm3.6.2]$ tar xf compiler-rt-3.6.2.src.tar.xz 
[[email protected] llvm3.6.2]$ tar xf llvm-3.6.2.src.tar.xz 
[[email protected] llvm3.6.2]$ mv cfe-3.6.2.src llvm-3.6.2.src/tools/clang
[[email protected] llvm3.6.2]$ mv compiler-rt-3.6.2.src llvm-3.6.2.src/projects/compiler-rt
[[email protected] llvm3.6.2]$ mv clang-tools-extra-3.6.2.src llvm-3.6.2.src/tools/clang/extra
[[email protected] llvm3.6.2]$ mkdir build
[[email protected] llvm3.6.2]$ cd build
[[email protected] build]$ ../llvm-3.6.2.src/configure --enable-optimized --enable-targets=host-only
[[email protected] build]$ echo $?
[[email protected] build]$ make
llvm[4]: Linking Release+Asserts executable clang-check (without symbols)
/tmp/tools/llvm3.6.2/build/tools/clang/tools/clang-check/Release+Asserts/ClangCheck.o: In function `std::unique_ptr<clang::tooling::FrontendActionFactory, std::default_delete<clang::tooling::FrontendActionFactory> > clang::tooling::newFrontendActionFactory<(anonymous namespace)::ClangCheckActionFactory>((anonymous namespace)::ClangCheckActionFactory*, clang::tooling::SourceFileCallbacks*)::FrontendActionFactoryAdapter::create()‘:
ClangCheck.cpp:(.text._ZZN5clang7tooling24newFrontendActionFactoryIN12_GLOBAL__N_123ClangCheckActionFactoryEEESt10unique_ptrINS0_21FrontendActionFactoryESt14default_deleteIS5_EEPT_PNS0_19SourceFileCallbacksEEN28FrontendActionFactoryAdapter6createEv+0x40): undefined reference to `vtable for std::unique_ptr<clang::tooling::FrontendActionFactory, std::default_delete<clang::tooling::FrontendActionFactory> > clang::tooling::newFrontendActionFactory<(anonymous namespace)::ClangCheckActionFactory>((anonymous namespace)::ClangCheckActionFactory*, clang::tooling::SourceFileCallbacks*)::FrontendActionFactoryAdapter::ConsumerFactoryAdaptor‘
collect2: error: ld returned 1 exit status `
看起来像是gcc的bug


编译安装clang 3.8.1

=====--------------编译安装clang 3.8.1---------------------=============
[[email protected] llvm3.8.1]$ tar xf cfe-3.8.1.src.tar.xz 
[[email protected] llvm3.8.1]$ tar xf clang-tools-extra-3.8.1.src.tar.xz 
[[email protected] llvm3.8.1]$ tar xf compiler-rt-3.8.1.src.tar.xz 
[[email protected] llvm3.8.1]$ tar xf llvm-3.8.1.src.tar.xz 
[[email protected] llvm3.8.1]$ mv cfe-3.8.1.src llvm-3.8.1.src/tools/clang
[[email protected] llvm3.8.1]$ mv compiler-rt-3.8.1.src llvm-3.8.1.src/projects/compiler-rt
[[email protected] llvm3.8.1]$ mv clang-tools-extra-3.8.1.src llvm-3.8.1.src/tools/clang/extra  #!
[[email protected] llvm3.8.1]$ mkdir build && cd build/
[[email protected] build]$ ../llvm-3.8.1.src/configure --enable-optimized --enable-targets=host-only
checking for python >= 2.7... not found
configure: error: found python 2.6.6 (/usr/bin/python); required >= 2.7
解决办法 去安装编译安装Python2.7


编译安装clang 3.8.1

=====--------------编译安装clang 3.8.1---------------------=============
[[email protected] llvm3.8.1]$ tar xf cfe-3.8.1.src.tar.xz 
[[email protected] llvm3.8.1]$ tar xf clang-tools-extra-3.8.1.src.tar.xz 
[[email protected] llvm3.8.1]$ tar xf compiler-rt-3.8.1.src.tar.xz 
[[email protected] llvm3.8.1]$ tar xf llvm-3.8.1.src.tar.xz 
[[email protected] llvm3.8.1]$ mv cfe-3.8.1.src llvm-3.8.1.src/tools/clang
[[email protected] llvm3.8.1]$ mv compiler-rt-3.8.1.src llvm-3.8.1.src/projects/compiler-rt
[[email protected] llvm3.8.1]$ mv clang-tools-extra-3.8.1.src llvm-3.8.1.src/tools/clang/extra  #!
[[email protected] llvm3.8.1]$ mkdir build && cd build/
[[email protected] build]$ ../llvm-3.8.1.src/configure --enable-optimized --enable-targets=host-only
[[email protected] build]$ echo $?
[[email protected] build]$ make
llvm[4]: Linking Release+Asserts executable clang-check (without symbols)
/home/chunli/tools/llvm3.8.1/build/tools/clang/tools/clang-check/Release+Asserts/ClangCheck.o: In function `std::unique_ptr<clang::tooling::FrontendActionFactory, std::default_delete<clang::tooling::FrontendActionFactory> > clang::tooling::newFrontendActionFactory<(anonymous namespace)::ClangCheckActionFactory>((anonymous namespace)::ClangCheckActionFactory*, clang::tooling::SourceFileCallbacks*)::FrontendActionFactoryAdapter::create()‘:
ClangCheck.cpp:(.text._ZZN5clang7tooling24newFrontendActionFactoryIN12_GLOBAL__N_123ClangCheckActionFactoryEEESt10unique_ptrINS0_21FrontendActionFactoryESt14default_deleteIS5_EEPT_PNS0_19SourceFileCallbacksEEN28FrontendActionFactoryAdapter6createEv+0x40): undefined reference to `vtable for std::unique_ptr<clang::tooling::FrontendActionFactory, std::default_delete<clang::tooling::FrontendActionFactory> > clang::tooling::newFrontendActionFactory<(anonymous namespace)::ClangCheckActionFactory>((anonymous namespace)::ClangCheckActionFactory*, clang::tooling::SourceFileCallbacks*)::FrontendActionFactoryAdapter::ConsumerFactoryAdaptor‘
collect2: error: ld returned 1 exit status`
编译器缺陷? ld连接报错 , 更换为gcc 4.8.5解决


编译安装clang 3.8.1

=====--------------编译安装clang 3.8.1---------------------=============
[[email protected] llvm3.8.1]$ tar xf cfe-3.8.1.src.tar.xz 
[[email protected] llvm3.8.1]$ tar xf clang-tools-extra-3.8.1.src.tar.xz 
[[email protected] llvm3.8.1]$ tar xf compiler-rt-3.8.1.src.tar.xz 
[[email protected] llvm3.8.1]$ tar xf llvm-3.8.1.src.tar.xz 
[[email protected] llvm3.8.1]$ mv cfe-3.8.1.src llvm-3.8.1.src/tools/clang
[[email protected] llvm3.8.1]$ mv compiler-rt-3.8.1.src llvm-3.8.1.src/projects/compiler-rt
[[email protected] llvm3.8.1]$ mv clang-tools-extra-3.8.1.src llvm-3.8.1.src/tools/clang/extra  #!
[[email protected] llvm3.8.1]$ mkdir build && cd build/
[[email protected] build]$ ../llvm-3.8.1.src/configure --enable-optimized --enable-targets=host-only
[[email protected] build]$ echo $?
[[email protected] build]$ make
llvm[4]: Copying runtime library linux/builtins-i386 to build dir
llvm[4]: Copying runtime library linux/profile-i386 to build dir
cp: cannot stat `/home/chunli/tools/llvm3.8.1/build/tools/clang/runtime/compiler-rt/clang_linux/builtins-i386/libcompiler_rt.a‘: No such file or directory
cp: cannot stat `/home/chunli/tools/llvm3.8.1/build/tools/clang/runtime/compiler-rt/clang_linux/profile-i386/libcompiler_rt.a‘: No such file or directory`
这种问题不知道怎么搞.....放弃这个clang版本



编译安装clang 3.9.1

=====--------------编译安装clang 3.9.1---------------------=============
需要C++11标准支持
需要Python2.7 支持
[[email protected] ~]$ cd tools/
[[email protected] tools]$ tar xf cfe-3.9.1.src.tar.xz
[[email protected] tools]$ tar xf compiler-rt-3.9.1.src.tar.xz
[[email protected] tools]$ tar xf llvm-3.9.1.src.tar.xz
[[email protected] tools]$ mv cfe-3.9.1.src llvm-3.9.1.src/tools/clang
[[email protected] tools]$ mv compiler-rt-3.9.1.src llvm-3.9.1.src/projects/compiler-rt
[[email protected] tools]$ mkdir llvm_build
[[email protected] tools]$ cd llvm_build
[[email protected] llvm_build]$ cmake -G "Unix Makefiles" ../llvm-3.9.1.src
CMake Error at cmake/modules/CheckCompilerVersion.cmake:12 (message):
  Host GCC version must be at least 4.7!
Call Stack (most recent call first):
  cmake/config-ix.cmake:14 (include)
  CMakeLists.txt:461 (include)
.......................................................
系统自带的编译器没有卸载, 卸载系统自带的编译器,
再次执行cmake  他会提示找不到/usr/bin/cc,/usr/bin/c++
如下:



编译YouCompleteMe 找不到编译器

=====--------------编译YouCompleteMe 找不到编译器-------------=============
[[email protected] ~]$ cd ~
[[email protected] ~]$ mkdir ycm_build/ && cd ycm_build/
[[email protected] ycm_build]$ sudo yum remove gcc     #删除自带的低版本gcc
[[email protected] ycm_build]$ sudo yum remove g++     #删除自带的低版本g++
[[email protected] ycm_build]$ cmake -G "Unix Makefiles" -DEXTERNAL_LIBCLANG_PATH=/usr/local/lib/libclang.so.3.9 . ~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:26 (project):
  The CMAKE_C_COMPILER:

    /usr/bin/cc

  is not a full path to an existing compiler tool.

  Tell CMake where to find the compiler by setting either the environment
  variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
  the compiler, or to the compiler name if it is in the PATH.


CMake Error at CMakeLists.txt:26 (project):
  The CMAKE_CXX_COMPILER:

    /usr/bin/c++

  is not a full path to an existing compiler tool.

  Tell CMake where to find the compiler by setting either the environment
  variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
  to the compiler, or to the compiler name if it is in the PATH.


-- Configuring incomplete, errors occurred!
See also "/home/chunli/ycm_build/CMakeFiles/CMakeOutput.log".
See also "/home/chunli/ycm_build/CMakeFiles/CMakeError.log".
[[email protected] ycm_build]$   
解决办法
/usr/local/bin/gcc

[[email protected] ycm_build]$ sudo ln -s /usr/local/bin/gcc /usr/bin/cc
[[email protected] ycm_build]$ sudo ln -s /usr/local/bin/g++ /usr/bin/c++



编译安装clang 3.9.1, 内存耗尽

=====--------------编译安装clang 3.9.1, 内存耗尽---------------------=============
需要C++11标准支持
需要Python2.7 支持
[[email protected] ~]$ cd tools/
[[email protected] tools]$ tar xf cfe-3.9.1.src.tar.xz
[[email protected] tools]$ tar xf compiler-rt-3.9.1.src.tar.xz
[[email protected] tools]$ tar xf llvm-3.9.1.src.tar.xz
[[email protected] tools]$ mv cfe-3.9.1.src llvm-3.9.1.src/tools/clang
[[email protected] tools]$ mv compiler-rt-3.9.1.src llvm-3.9.1.src/projects/compiler-rt
[[email protected] tools]$ mkdir llvm_build
[[email protected] tools]$ cd llvm_build
[[email protected] llvm_build]$ cmake -G "Unix Makefiles" ../llvm-3.9.1.src
[[email protected] llvm_build]$ make
../../../../lib/libclangStaticAnalyzerCheckers.a: could not read symbols: Memory exhausted
collect2: error: ld returned 1 exit status
make[2]: *** [bin/clang-3.9] Error 1
make[1]: *** [tools/clang/tools/driver/CMakeFiles/clang.dir/all] Error 2
make: *** [all] Error 2

解决
[[email protected] llvm_build]$ cmake -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD="X86" ../llvm-3.9.1.src 
[[email protected] llvm_build]$ make -j 4


启动vim报错

启动vim报错
The ycmd server SHUT DOWN (restart with ‘:YcmRestartServer‘).... code -11. 
Use the ‘:YcmToggleLogs‘ command to check the logs.

:YcmDebugInfo  查看错误

Printing YouCompleteMe debug information...
-- Client logfile: /tmp/ycm_RtQuPY.log
-- Server errored, no debug info from server
-- Server running at: http://127.0.0.1:52237
-- Server process ID: 2947
-- Server logfiles:
--   /tmp/ycmd_52237_stdout_lrHj02.log
--   /tmp/ycmd_52237_stderr_80SRfh.log
Press ENTER or type command to continue



[[email protected] ~]$ vim /tmp/ycm_RtQuPY.log
2017-03-09 18:02:22,569 - ERROR - Unable to connect to server


:YcmDiags
Native filetype completion not supported for current file, cannot force recompilation.


:messages
Messages maintainer: Bram Moolenaar <[email protected]>
"main.c" 5L, 35C
The ycmd server SHUT DOWN (restart with ‘:YcmRestartServer‘). Unexpected exit code 1. Use the ‘:YcmToggleLogs‘ command to check
 the logs.

:YcmRestartServer
Restarting ycmd server...


当时没有被解决





安装Python2.7

观察老版本的python相关信息
[[email protected] ~]$ which python
/usr/bin/python
[[email protected] ~]$ python --version
Python 2.6.6
[[email protected] ~]$ /usr/bin/python --version
Python 2.6.6
[[email protected] Python-2.7.13]$ ll /usr/bin/python
[[email protected] Python-2.7.13]$ ll /usr/bin/python*
lrwxrwxrwx. 1 root root 6088 Nov 22  2013 /usr/bin/python
lrwxrwxrwx. 1 root root    6 Mar  5 23:29 /usr/bin/python2 -> python
-rwxr-xr-x. 1 root root 6088 Nov 22  2013 /usr/bin/python2.6


安装Python2.7.13
[[email protected] ~]$ cd src/
[[email protected] src]$ tar xf Python-2.7.13.tar.xz 
[[email protected] src]$ cd Python-2.7.13
[[email protected] Python-2.7.13]$ ./configure --prefix=/usr/local/python2.7 --enable-shared && make -j 4
[[email protected] Python-2.7.13]$ echo $?
[[email protected] Python-2.7.13]$ sudo make install 
[[email protected] Python-2.7.13]$ echo $?

[[email protected] Python-2.7.13]$ sudo rm -rf /usr/bin/python
[[email protected] Python-2.7.13]$ sudo ln -s /usr/local/python2.7/bin/python2.7 /usr/bin/python

[[email protected] Python-2.7.13]$ python --version
python: error while loading shared libraries: libpython2.7.so.1.0: cannot open shared object file: No such file or directory

[[email protected] Python-2.7.13]$ sudo vim /etc/ld.so.conf
/usr/local/python2.7/lib/

[[email protected] Python-2.7.13]$ sudo ldconfig -v

[[email protected] Python-2.7.13]$ python --version
Python 2.7.13
[[email protected] Python-2.7.13]$ 

发现yum报错:
[[email protected] Python-2.7.13]$ sudo yum clean all
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:

   No module named yum

Please install a package which provides this module, or
verify that the module is installed correctly.

解决办法
[[email protected] Python-2.7.13]$ sudo vim /usr/bin/yum
- #!/usr/bin/python
+ #!/usr/bin/python2.6

[[email protected] Python-2.7.13]$ sudo yum clean all
[[email protected] Python-2.7.13]$ sudo yum list 

记录python2.7的config路径
[[email protected] config]$ ll /usr/local/python2.7/lib/python2.7/config
total 9216
-rw-r--r--. 1 root root    2200 Mar 11 01:13 config.c
-rw-r--r--. 1 root root    1507 Mar 11 01:13 config.c.in
-rwxr-xr-x. 1 root root    7122 Mar 11 01:13 install-sh
-rw-r--r--. 1 root root 9303726 Mar 11 01:13 libpython2.7.a
-rw-r--r--. 1 root root   51793 Mar 11 01:13 Makefile
-rwxr-xr-x. 1 root root    7430 Mar 11 01:13 makesetup
-rw-r--r--. 1 root root   21216 Mar 11 01:13 python.o
-rw-r--r--. 1 root root   18479 Mar 11 01:13 Setup
-rw-r--r--. 1 root root     368 Mar 11 01:13 Setup.config
-rw-r--r--. 1 root root      41 Mar 11 01:13 Setup.local




编译安装cmake

[[email protected] src]$ tar xf cmake-3.8.0-rc2.tar.gz 
[[email protected] src]$ cd cmake-3.8.0-rc2
[[email protected] cmake-3.8.0-rc2]$ ./bootstrap 
/home/chunli/src/cmake-3.8.0-rc2/Bootstrap.cmk/cmake: /usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.20‘ not found (required by /home/chunli/src/cmake-3.8.0-rc2/Bootstrap.cmk/cmake)
/home/chunli/src/cmake-3.8.0-rc2/Bootstrap.cmk/cmake: /usr/lib/libstdc++.so.6: version `CXXABI_1.3.9‘ not found (required by /home/chunli/src/cmake-3.8.0-rc2/Bootstrap.cmk/cmake)
/home/chunli/src/cmake-3.8.0-rc2/Bootstrap.cmk/cmake: /usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.15‘ not found (required by /home/chunli/src/cmake-3.8.0-rc2/Bootstrap.cmk/cmake)
/home/chunli/src/cmake-3.8.0-rc2/Bootstrap.cmk/cmake: /usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.21‘ not found (required by /home/chunli/src/cmake-3.8.0-rc2/Bootstrap.cmk/cmake)

查找,并没有找到
[[email protected] ~]$ strings /usr/lib/libstdc++.so.6 | grep GLIBCXX_3.4
GLIBCXX_3.4
GLIBCXX_3.4.1
GLIBCXX_3.4.2
GLIBCXX_3.4.3
GLIBCXX_3.4.4
GLIBCXX_3.4.5
GLIBCXX_3.4.6
GLIBCXX_3.4.7
GLIBCXX_3.4.8
GLIBCXX_3.4.9
GLIBCXX_3.4.10
GLIBCXX_3.4.11
GLIBCXX_3.4.12
GLIBCXX_3.4.13
[[email protected] ~]$ 

查找新的 库
[[email protected] ~]$ sudo  find /usr/ -name  libstdc++.so.6*
/usr/local/lib/libstdc++.so.6.0.22
/usr/local/lib/libstdc++.so.6
/usr/lib/libstdc++.so.6
/usr/lib/libstdc++.so.6.0.13
[[email protected] ~]$ 

可以发现全找到了
[[email protected] ~]$ strings /usr/local/lib/libstdc++.so.6.0.22 | grep -E ‘GLIBCXX_3.4.20|CXXABI_1.3.9|GLIBCXX_3.4.15|GLIBCXX_3.4.21‘
GLIBCXX_3.4.15
GLIBCXX_3.4.20
GLIBCXX_3.4.21
CXXABI_1.3.9
[[email protected] ~]$ 

查看原库的连接
[[email protected] ~]$ ll /usr/lib/libstdc++.so.6
lrwxrwxrwx. 1 root root 19 Mar 10 21:31 /usr/lib/libstdc++.so.6 -> libstdc++.so.6.0.13

修改到新的连接
[[email protected] ~]$ sudo rm -rf /usr/lib/libstdc++.so.6
[[email protected] ~]$ sudo ln -s /usr/local/lib/libstdc++.so.6.0.22 /usr/lib/libstdc++.so.6

查看新的连接
[[email protected] ~]$ ll /usr/lib/libstdc++.so.6
lrwxrwxrwx. 1 root root 34 Mar 11 02:02 /usr/lib/libstdc++.so.6 -> /usr/local/lib/libstdc++.so.6.0.22
[[email protected] ~]$ 

继续cmake
[[email protected] cmake-3.8.0-rc2]$ ./bootstrap 
[[email protected] cmake-3.8.0-rc2]$ echo $?
[[email protected] cmake-3.8.0-rc2]$ make -j 4
[[email protected] cmake-3.8.0-rc2]$ echo $?
[[email protected] cmake-3.8.0-rc2]$ sudo make install 
[[email protected] cmake-3.8.0-rc2]$ echo $?
[[email protected] cmake-3.8.0-rc2]$ cmake --version
cmake version 3.8.0-rc2

cmake 安装完成!



安装vim 插件

[[email protected] src]$ mv Vundle.vim ~/.vim/bundle/
[[email protected] src]$ mv YouCompleteMe ~/.vim/bundle/
[[email protected] src]$ vim +PluginInstall +qall
报错
ImportError: No module named urllib3
YouCompleteMe unavailable: No module named urllib3

解决
[[email protected] bin]$ sudo yum list | grep urllib3
python-urllib3.noarch                      1.10.2-1.el6                  base   
[[email protected] ~]$ sudo yum install python-urllib3
[[email protected] Python-2.7.13]$ sudo yum install python-devel


[[email protected] python2.7]$ sudo rm -rf /usr/local/python2.7/lib/python2.7/site-packages/
[[email protected] python2.7]$ sudo ln -s /usr/lib/python2.6/site-packages /usr/local/python2.7/lib/python2.7/site-packages

再报错:
YouCompleteMe unavailable: No module named _ssl

太烦了..............



本文出自 “魂斗罗” 博客,请务必保留此出处http://990487026.blog.51cto.com/10133282/1905447

以上是关于CentOS 6.5 安装YouCompleteMe 报错汇总的主要内容,如果未能解决你的问题,请参考以下文章

CentOS 6.5 安装VNC

centos 6.5 安装

CentOS-6.5-saltstack-安装

CentOS 6.5使用 安装ansible

Centos 6.5编译安装LAMP

CentOS-6.5安装配置JDK-7