您好,登錄后才能下訂單哦!
支持折騰!!!
編譯安裝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]$ 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 支持 [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]$ 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---------------------============= [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 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---------------------============= [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]$ 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---------------------============= [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]$ 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 支持 [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 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 找不到編譯器-------------============= [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 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". [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 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 解決 [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.log Press ENTER or type command to continue [chunli@CentOS ~]$ 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 <Bram@vim.org> "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相關信息 [chunli@CentOS ~]$ which python /usr/bin/python [chunli@CentOS ~]$ python --version Python 2.6.6 [chunli@CentOS ~]$ /usr/bin/python --version Python 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/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 [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 --version python: 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 --version Python 2.7.13 [chunli@CentOS Python-2.7.13]$ 發現yum報錯: [chunli@CentOS 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. 解決辦法 [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/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
[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.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 [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.15 GLIBCXX_3.4.20 GLIBCXX_3.4.21 CXXABI_1.3.9 [chunli@CentOS ~]$ 查看原庫的連接 [chunli@CentOS ~]$ 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 修改到新的連接 [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.6 lrwxrwxrwx. 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 --version cmake version 3.8.0-rc2 cmake 安裝完成!
安裝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 urllib3 YouCompleteMe unavailable: No module named urllib3 解決 [chunli@CentOS bin]$ sudo yum list | grep urllib3 python-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 太煩了..............
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。