热门IT资讯网

CentOS 6.5 安装YouCompleteMe 报错汇总

发表于:2024-11-24 作者:热门IT资讯网编辑
编辑最后更新 2024年11月24日,支持折腾!!!编译安装clang 3.6.0 编译器版本低====-----编译安装clang 3.6.0 编译器版本低---------------==============[chunli@C


支持折腾!!!



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

====-----编译安装clang 3.6.0   编译器版本低---------------==============[chunli@CentOS llvm-3.6.0]$ tar xf cfe-3.6.0.src.tar.xz [chunli@CentOS llvm-3.6.0]$ tar xf clang-tools-extra-3.6.0.src.tar.xz [chunli@CentOS llvm-3.6.0]$ tar xf compiler-rt-3.6.0.src.tar.xz [chunli@CentOS llvm-3.6.0]$ tar xf llvm-3.6.0.src.tar.xz [chunli@CentOS llvm-3.6.0]$ mv cfe-3.6.0.src llvm-3.6.0.src/tools/clang[chunli@CentOS llvm-3.6.0]$ mv clang-tools-extra-3.6.0.src llvm-3.6.0.src/tools/clang/tools/extra[chunli@CentOS llvm-3.6.0]$ mv compiler-rt-3.6.0.src llvm-3.6.0.src/projects/compiler-rt[chunli@CentOS llvm-3.6.0]$ cd llvm-3.6.0.src[chunli@CentOS llvm-3.6.0.src]$ ./configure --enable-optimized --enable-targets=host-only[chunli@CentOS llvm-3.6.0.src]$ echo $?[chunli@CentOS llvm-3.6.0.src]$ makecc1plus: 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 支持[chunli@CentOS llvm3.6.2]$ tar xf cfe-3.6.2.src.tar.xz [chunli@CentOS llvm3.6.2]$ tar xf clang-tools-extra-3.6.2.src.tar.xz [chunli@CentOS llvm3.6.2]$ tar xf compiler-rt-3.6.2.src.tar.xz [chunli@CentOS llvm3.6.2]$ tar xf llvm-3.6.2.src.tar.xz [chunli@CentOS llvm3.6.2]$ mv cfe-3.6.2.src llvm-3.6.2.src/tools/clang[chunli@CentOS llvm3.6.2]$ mv compiler-rt-3.6.2.src llvm-3.6.2.src/projects/compiler-rt[chunli@CentOS llvm3.6.2]$ mv clang-tools-extra-3.6.2.src llvm-3.6.2.src/tools/clang/extra[chunli@CentOS llvm3.6.2]$ mkdir build[chunli@CentOS llvm3.6.2]$ cd build[chunli@CentOS build]$ ../llvm-3.6.2.src/configure --enable-optimized --enable-targets=host-only[chunli@CentOS build]$ echo $?[chunli@CentOS build]$ makellvm[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::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::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---------------------=============[chunli@CentOS llvm3.8.1]$ tar xf cfe-3.8.1.src.tar.xz [chunli@CentOS llvm3.8.1]$ tar xf clang-tools-extra-3.8.1.src.tar.xz [chunli@CentOS llvm3.8.1]$ tar xf compiler-rt-3.8.1.src.tar.xz [chunli@CentOS llvm3.8.1]$ tar xf llvm-3.8.1.src.tar.xz [chunli@CentOS llvm3.8.1]$ mv cfe-3.8.1.src llvm-3.8.1.src/tools/clang[chunli@CentOS llvm3.8.1]$ mv compiler-rt-3.8.1.src llvm-3.8.1.src/projects/compiler-rt[chunli@CentOS llvm3.8.1]$ mv clang-tools-extra-3.8.1.src llvm-3.8.1.src/tools/clang/extra  #![chunli@CentOS llvm3.8.1]$ mkdir build && cd build/[chunli@CentOS build]$ ../llvm-3.8.1.src/configure --enable-optimized --enable-targets=host-onlychecking for python >= 2.7... not foundconfigure: error: found python 2.6.6 (/usr/bin/python); required >= 2.7解决办法 去安装编译安装Python2.7


编译安装clang 3.8.1

=====--------------编译安装clang 3.8.1---------------------=============[chunli@CentOS llvm3.8.1]$ tar xf cfe-3.8.1.src.tar.xz [chunli@CentOS llvm3.8.1]$ tar xf clang-tools-extra-3.8.1.src.tar.xz [chunli@CentOS llvm3.8.1]$ tar xf compiler-rt-3.8.1.src.tar.xz [chunli@CentOS llvm3.8.1]$ tar xf llvm-3.8.1.src.tar.xz [chunli@CentOS llvm3.8.1]$ mv cfe-3.8.1.src llvm-3.8.1.src/tools/clang[chunli@CentOS llvm3.8.1]$ mv compiler-rt-3.8.1.src llvm-3.8.1.src/projects/compiler-rt[chunli@CentOS llvm3.8.1]$ mv clang-tools-extra-3.8.1.src llvm-3.8.1.src/tools/clang/extra  #![chunli@CentOS llvm3.8.1]$ mkdir build && cd build/[chunli@CentOS build]$ ../llvm-3.8.1.src/configure --enable-optimized --enable-targets=host-only[chunli@CentOS build]$ echo $?[chunli@CentOS build]$ makellvm[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::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::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---------------------=============[chunli@CentOS llvm3.8.1]$ tar xf cfe-3.8.1.src.tar.xz [chunli@CentOS llvm3.8.1]$ tar xf clang-tools-extra-3.8.1.src.tar.xz [chunli@CentOS llvm3.8.1]$ tar xf compiler-rt-3.8.1.src.tar.xz [chunli@CentOS llvm3.8.1]$ tar xf llvm-3.8.1.src.tar.xz [chunli@CentOS llvm3.8.1]$ mv cfe-3.8.1.src llvm-3.8.1.src/tools/clang[chunli@CentOS llvm3.8.1]$ mv compiler-rt-3.8.1.src llvm-3.8.1.src/projects/compiler-rt[chunli@CentOS llvm3.8.1]$ mv clang-tools-extra-3.8.1.src llvm-3.8.1.src/tools/clang/extra  #![chunli@CentOS llvm3.8.1]$ mkdir build && cd build/[chunli@CentOS build]$ ../llvm-3.8.1.src/configure --enable-optimized --enable-targets=host-only[chunli@CentOS build]$ echo $?[chunli@CentOS build]$ makellvm[4]: Copying runtime library linux/builtins-i386 to build dirllvm[4]: Copying runtime library linux/profile-i386 to build dircp: 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 directorycp: 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 支持[chunli@CentOS ~]$ cd tools/[chunli@CentOS tools]$ tar xf cfe-3.9.1.src.tar.xz[chunli@CentOS tools]$ tar xf compiler-rt-3.9.1.src.tar.xz[chunli@CentOS tools]$ tar xf llvm-3.9.1.src.tar.xz[chunli@CentOS tools]$ mv cfe-3.9.1.src llvm-3.9.1.src/tools/clang[chunli@CentOS tools]$ mv compiler-rt-3.9.1.src llvm-3.9.1.src/projects/compiler-rt[chunli@CentOS tools]$ mkdir llvm_build[chunli@CentOS tools]$ cd llvm_build[chunli@CentOS llvm_build]$ cmake -G "Unix Makefiles" ../llvm-3.9.1.srcCMake 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 找不到编译器-------------=============[chunli@CentOS ~]$ cd ~[chunli@CentOS ~]$ mkdir ycm_build/ && cd ycm_build/[chunli@CentOS ycm_build]$ sudo yum remove gcc     #删除自带的低版本gcc[chunli@CentOS ycm_build]$ sudo yum remove g++     #删除自带的低版本g++[chunli@CentOS 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 unknownCMake 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".[chunli@CentOS ycm_build]$   解决办法/usr/local/bin/gcc[chunli@CentOS ycm_build]$ sudo ln -s /usr/local/bin/gcc /usr/bin/cc[chunli@CentOS ycm_build]$ sudo ln -s /usr/local/bin/g++ /usr/bin/c++



编译安装clang 3.9.1, 内存耗尽

=====--------------编译安装clang 3.9.1, 内存耗尽---------------------=============需要C++11标准支持需要Python2.7 支持[chunli@CentOS ~]$ cd tools/[chunli@CentOS tools]$ tar xf cfe-3.9.1.src.tar.xz[chunli@CentOS tools]$ tar xf compiler-rt-3.9.1.src.tar.xz[chunli@CentOS tools]$ tar xf llvm-3.9.1.src.tar.xz[chunli@CentOS tools]$ mv cfe-3.9.1.src llvm-3.9.1.src/tools/clang[chunli@CentOS tools]$ mv compiler-rt-3.9.1.src llvm-3.9.1.src/projects/compiler-rt[chunli@CentOS tools]$ mkdir llvm_build[chunli@CentOS tools]$ cd llvm_build[chunli@CentOS llvm_build]$ cmake -G "Unix Makefiles" ../llvm-3.9.1.src[chunli@CentOS llvm_build]$ make../../../../lib/libclangStaticAnalyzerCheckers.a: could not read symbols: Memory exhaustedcollect2: error: ld returned 1 exit statusmake[2]: *** [bin/clang-3.9] Error 1make[1]: *** [tools/clang/tools/driver/CMakeFiles/clang.dir/all] Error 2make: *** [all] Error 2解决[chunli@CentOS llvm_build]$ cmake -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD="X86" ../llvm-3.9.1.src [chunli@CentOS 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.logPress ENTER or type command to continue[chunli@CentOS ~]$ vim /tmp/ycm_RtQuPY.log2017-03-09 18:02:22,569 - ERROR - Unable to connect to server:YcmDiagsNative filetype completion not supported for current file, cannot force recompilation.:messagesMessages maintainer: Bram Moolenaar "main.c" 5L, 35CThe ycmd server SHUT DOWN (restart with ':YcmRestartServer'). Unexpected exit code 1. Use the ':YcmToggleLogs' command to check the logs.:YcmRestartServerRestarting ycmd server...当时没有被解决





安装Python2.7

观察老版本的python相关信息[chunli@CentOS ~]$ which python/usr/bin/python[chunli@CentOS ~]$ python --versionPython 2.6.6[chunli@CentOS ~]$ /usr/bin/python --versionPython 2.6.6[chunli@CentOS Python-2.7.13]$ ll /usr/bin/python[chunli@CentOS Python-2.7.13]$ ll /usr/bin/python*lrwxrwxrwx. 1 root root 6088 Nov 22  2013 /usr/bin/pythonlrwxrwxrwx. 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[chunli@CentOS ~]$ cd src/[chunli@CentOS src]$ tar xf Python-2.7.13.tar.xz [chunli@CentOS src]$ cd Python-2.7.13[chunli@CentOS Python-2.7.13]$ ./configure --prefix=/usr/local/python2.7 --enable-shared && make -j 4[chunli@CentOS Python-2.7.13]$ echo $?[chunli@CentOS Python-2.7.13]$ sudo make install [chunli@CentOS Python-2.7.13]$ echo $?[chunli@CentOS Python-2.7.13]$ sudo rm -rf /usr/bin/python[chunli@CentOS Python-2.7.13]$ sudo ln -s /usr/local/python2.7/bin/python2.7 /usr/bin/python[chunli@CentOS Python-2.7.13]$ python --versionpython: error while loading shared libraries: libpython2.7.so.1.0: cannot open shared object file: No such file or directory[chunli@CentOS Python-2.7.13]$ sudo vim /etc/ld.so.conf/usr/local/python2.7/lib/[chunli@CentOS Python-2.7.13]$ sudo ldconfig -v[chunli@CentOS Python-2.7.13]$ python --versionPython 2.7.13[chunli@CentOS Python-2.7.13]$ 发现yum报错:[chunli@CentOS Python-2.7.13]$ sudo yum clean allThere was a problem importing one of the Python modulesrequired to run yum. The error leading to this problem was:   No module named yumPlease install a package which provides this module, orverify that the module is installed correctly.解决办法[chunli@CentOS Python-2.7.13]$ sudo vim /usr/bin/yum- #!/usr/bin/python+ #!/usr/bin/python2.6[chunli@CentOS Python-2.7.13]$ sudo yum clean all[chunli@CentOS Python-2.7.13]$ sudo yum list 记录python2.7的config路径[chunli@CentOS config]$ ll /usr/local/python2.7/lib/python2.7/configtotal 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

[chunli@CentOS src]$ tar xf cmake-3.8.0-rc2.tar.gz [chunli@CentOS src]$ cd cmake-3.8.0-rc2[chunli@CentOS 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)查找,并没有找到[chunli@CentOS ~]$ strings /usr/lib/libstdc++.so.6 | grep GLIBCXX_3.4GLIBCXX_3.4GLIBCXX_3.4.1GLIBCXX_3.4.2GLIBCXX_3.4.3GLIBCXX_3.4.4GLIBCXX_3.4.5GLIBCXX_3.4.6GLIBCXX_3.4.7GLIBCXX_3.4.8GLIBCXX_3.4.9GLIBCXX_3.4.10GLIBCXX_3.4.11GLIBCXX_3.4.12GLIBCXX_3.4.13[chunli@CentOS ~]$ 查找新的 库[chunli@CentOS ~]$ 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[chunli@CentOS ~]$ 可以发现全找到了[chunli@CentOS ~]$ 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.15GLIBCXX_3.4.20GLIBCXX_3.4.21CXXABI_1.3.9[chunli@CentOS ~]$ 查看原库的连接[chunli@CentOS ~]$ ll /usr/lib/libstdc++.so.6lrwxrwxrwx. 1 root root 19 Mar 10 21:31 /usr/lib/libstdc++.so.6 -> libstdc++.so.6.0.13修改到新的连接[chunli@CentOS ~]$ sudo rm -rf /usr/lib/libstdc++.so.6[chunli@CentOS ~]$ sudo ln -s /usr/local/lib/libstdc++.so.6.0.22 /usr/lib/libstdc++.so.6查看新的连接[chunli@CentOS ~]$ ll /usr/lib/libstdc++.so.6lrwxrwxrwx. 1 root root 34 Mar 11 02:02 /usr/lib/libstdc++.so.6 -> /usr/local/lib/libstdc++.so.6.0.22[chunli@CentOS ~]$ 继续cmake[chunli@CentOS cmake-3.8.0-rc2]$ ./bootstrap [chunli@CentOS cmake-3.8.0-rc2]$ echo $?[chunli@CentOS cmake-3.8.0-rc2]$ make -j 4[chunli@CentOS cmake-3.8.0-rc2]$ echo $?[chunli@CentOS cmake-3.8.0-rc2]$ sudo make install [chunli@CentOS cmake-3.8.0-rc2]$ echo $?[chunli@CentOS cmake-3.8.0-rc2]$ cmake --versioncmake version 3.8.0-rc2cmake 安装完成!



安装vim 插件

[chunli@CentOS src]$ mv Vundle.vim ~/.vim/bundle/[chunli@CentOS src]$ mv YouCompleteMe ~/.vim/bundle/[chunli@CentOS src]$ vim +PluginInstall +qall报错ImportError: No module named urllib3YouCompleteMe unavailable: No module named urllib3解决[chunli@CentOS bin]$ sudo yum list | grep urllib3python-urllib3.noarch                      1.10.2-1.el6                  base   [chunli@CentOS ~]$ sudo yum install python-urllib3[chunli@CentOS Python-2.7.13]$ sudo yum install python-devel[chunli@CentOS python2.7]$ sudo rm -rf /usr/local/python2.7/lib/python2.7/site-packages/[chunli@CentOS 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太烦了..............



0