root权限下
mkdir /usr/clang_351
cp -r /learn/clang+llvm-3.5.1-x86_64-fedora2/bin /usr/clang_351
cp -r /learn/clang+llvm-3.5.1-x86_64-fedora2/lib /usr/clang_351 ;libclang.so 在该目录中,后面编译ycm时需要
cp -r /learn/clang+llvm-3.5.1-x86_64-fedora2/lib /usr/clang_351 ;生成ycm_core需要
kk4728权限:
vi ~/.bash_profile 添加
PATH=/usr/clang_351/bin:$PATH
export PATH
source ~/.bash_profile更新
13 安装YouCompleteMe
cp /usr/clang_3_5/lib/libclang.so ~/.vim/bundle/YouCompleteMe/python/libclang.so
cd ~
mkdir build
cd build
cmake -G "Unix Makefiles" -DPATH_TO_LLVM_ROOT=/usr/clang_351/ . ~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp
cmake -G "Unix Makefiles" . ~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp
提示:编译器不支持 C++11
Your C++ compiler does NOT fully support C++11.
于是 find /usr -name "gcc" 发现 /usr/bin/gcc版本仍为4.4.7 从而备份/usr/bin/gcc 再试
由于之前安装gcc-6.3.0时没有移除之前 4.4.7版本
所以 sudo yum remove gcc
sudo yum remove g++
sudo yum remove gcc-c++
cp /usr/local/bin/gcc /usr/bin/gcc
在build目录下删除 之前安装失败的中间文件 rm -rf *
//这里需要注意的是,~/ycm_temp/llvm_root_dir中包含的是根据第一步下载的压缩包解压出来的内容(包括include, bin等等文件)。
//中途出现错误 clang-c/Index.h找不到 就是PATH_TO_LLVM_ROOT路径设置错误!
rm -rf CMakeCache.txt //防止中途编译异常带来的问题
make ycm_core
编译出现问题:可能与编译器版本有关 gcc6.3.0 可能太新了 -> 后查极有可能时clang3.5.1偏旧 改成 4.0.1可能能解决
--> 再 make ycm_core
cp /usr/clang_351/lib/libclang.so ~/.vim/bundle/YouCompleteMe/python/libclang.so 貌似不会出错
[ 72%] Building CXX object ycm/CMakeFiles/ycm_core.dir/ClangCompleter/TranslationUnit.cpp.o
/home/kk4728/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/ClangCompleter/TranslationUnit.cpp 在函数‘unsigned int YouCompleteMe::{匿名}::EditingOptions()’中:
/home/kk4728/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/ClangCompleter/TranslationUnit.cpp:43:10: 错误:‘CXTranslationUnit_CreatePreambleOnFirstParse’在此作用域中尚未声明
CXTranslationUnit_CreatePreambleOnFirstParse |
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/kk4728/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/ClangCompleter/TranslationUnit.cpp:44:10: 错误:‘CXTranslationUnit_KeepGoing’在此作用域中尚未声明
CXTranslationUnit_KeepGoing |
^~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/kk4728/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/ClangCompleter/TranslationUnit.cpp 在构造函数‘YouCompleteMe::TranslationUnit::TranslationUnit(const string&, const std::vector<UnsavedFile>&, const std::vector<std::__cxx11::basic_string<char> >&, CXIndex)’中:
/home/kk4728/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/ClangCompleter/TranslationUnit.cpp:105:51: 错误:‘clang_parseTranslationUnit2FullArgv’在此作用域中尚未声明
&clang_translation_unit_ );
^
make[3]: *** [ycm/CMakeFiles/ycm_core.dir/ClangCompleter/TranslationUnit.cpp.o] 错误 1
make[2]: *** [ycm/CMakeFiles/ycm_core.dir/all] 错误 2
make[1]: *** [ycm/CMakeFiles/ycm_core.dir/rule] 错误 2
make ycm_support_libs x64中失败!
//暂时越过 make ycm_make 和make ycm_support_libs
直接进入到YCM安装目录
./install.sh --clang-completer
在x64中运行正常,在x86中出现clang.5.0版本库异常,无法自动下载。
14 vimrc
let g:ycm_global_ycm_extra_conf=‘~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py‘
检查配置
echo | clang -std=c++11 -stdlib=libc++ -v -E -x c++ -
上述.ycm_extra_conf.py中添加c库支持
'-isystem',
'/usr/include',
'-isystem',
'/usr/local/include',
'-isystem',
'/usr/clang_3_5/bin/../include/c++/v1',
'-isystem',
'/usr/clang_3_5/bin/../lib/clang/3.5.1/include',
安装 man
yum install man
yum install man-pages.noarch man-pages-overrides.noarch
将en下的man复制过来,先凑合用用:
cp /usr/share/locale/en/LC_MESSAGES/man /usr/share/locale/zh/LC_MESSAGES/