整个安装步骤如下

文章作者:w88手机版登录网络 上传时间:2019-12-21

CentOS中安装YouCompleteMe插件全经过,

全部进程多次经过每每,搜查了广大网络基友博客。首要参照以下:

本身有试过CentOS6.9和CentOS7中装置,均无难点。整个安装步骤如下:(写的可比粗糙卡塔尔

1,

  win10 x64 : 通过有线网卡连接互联网:
    IP: 192.168.1.106
    Netmast: 255.255.255.0
    gateway: 192.168.1.1
    DNS : 120.196.165.24
        211.136.192.6
    vmware中互联网采纳桥接形式 , 勾选 复制物理连接到网络 。接收对应的无线网卡其余都去掉。

  Centos6.9-x64
    IP: 192.168.1.6 /255.255.255.0 / 192.168.1.1 同一网段

  CentOS7 - x86 要注意增添网卡,并在意互连网设置,GATEWAY网关
    1卡塔尔 关闭虚构机. VMare workstation 对应虚构机安装目录中的.vmx增加ethernet0.virtualDev = "e1000"
    2) 重启,ip addr -> cp /etc/sysconfig/network-scripts/ifg-lo /ect/sysconfig/network-scripts/ifg-ens33

  检查测试 网络设置是或不是准确

*    ping 192.168.1.106
    ping 192.168.1.1
    ping www.baidu.com  //pass

2, 设想机加多八个硬盘用来读书 20G SCSI
  reboot
  fdisk /dev/sdb
  mkfs.ext4 /dev/sdb1
  echo "/dev/sdb1 /learn ext4 defaults 0 0 " >> /etc/fstab

3, 添加客户kk4728
  useradd kk4728
  passwd kk4728
 添加sudo用户, /etc/sudoers 添加 kk4728 ALL=(ALL) ALL
 修正学习盘权限
    chown -R kk4728 /learn
    chgrp -R kk4728 /learn
    chmod -R 775 /learn

4, 设置境况变量
  vi ~/.bash_profile添加
  PATH=$PATH:.
  让系统能够搜寻当前可试行文件

5,同步时间
sudo yum install ntp
sudo ntpdate time.nist.gov

6 设置重视项
  sudo yum install -y gcc gcc-c gdb ctags ncurses-devel libevent-devel git automake xz zlib-devel cmake libxml2 libxslt libxslt-devel kernel-devel wget openssl openssl-devel

  CentOS7 中 默许安装 gcc4.8.5
  glibc-2.17
  python-2.7.5

7, 升级glibc
  wget
  xz -d glibc-2.17.tar.xz
  tar -xvf glibc-2.17.tar
  cd glibc-2.17
  mkdir build
  cd build
  ../configure --prefix=/usr --disable-profile --enable-add-ons --with-headers=/usr/include --with-binutils=/usr/bin
  sudo make && make install

  安装时出错 libc.a 写权限战败 . 分开安装
  sudo make
  sudo make install

  验证:
    x64: strings /lib64/libc.so.6 | grep GLIBC
    x86: strings /lib/libc.so.6 | grep GLIBC

  假若这里表明退步。应该是libc.so.6(软连接卡塔尔(قطر‎指向的渠道不对 这里先不升官,按后期需求进步。libc.so.6指向的文件太主要;
  使用不当会唤起系统不能够登陆或重启, 轻则有个别指令段错误!!!
  find / -name "libc.so.6"
  cp /usr/glibc-2.17/lib/libc-2.17.so /lib/libc-2.17.so
  rm -rf /lib/libc.so.6
  之后即便引发那几个,主要是libc.so.6是系统宗旨链接库。删除后掀起大多数指令出错!
  要求重新创立链接,可是ln 也是索要libc.so.6的。 须要手工业增多LD_PRELOAD路径
  [root#localhost ~ ] LD_PRELOAD=/lib/libc-2.17.so ln -s /lib/libc-2.17.so /lib/libc.so.6
  再度验证OK*

8,安装Python2.7.13 (CentOS7 -> Python 2.7.5)
  wget
  xz -d Python-2.7.13.tar.xz
  tar -xvf Python-2.7.13.tar
  cd Python-2.7.13
  ./configure --enable-shared
  sudo make
  sudo make install
  /usr/local/bin/python2.7 -V
  提醒错误

  权限切换回root
  vi /etc/ld.so.conf 添加/usr/local/lib 保存

  /sbin/ldconfig
  /sbin/ldconfig –v
  mv /usr/bin/python /usr/bin/python.bak
  ln -s /usr/local/bin/python2.7 /usr/bin/python
  vi /usr/bin/yum
  改成 #!/usr/bin/python2.6

  将权限切换回kk4728

8 零部件安装
  安装setuptools
    wget -O - | sudo python
  pip安装
    wget –no-check-certificate
    tar zvxf 7.1.0.tar.gz #解压文件
    cd pip-7.1.0
    sudo python setup.py install

  CentOS7 - x86
  wget –no-check-certificate
  tar zvxf 9.0.0.tar.gz #解压文件
  cd pip-9.0.0
  sudo python setup.py install

  权限改为root
  pip install requests
  pip install lxml
  pip install cssselect

  安装flake8
  pip install flake8

  权限改回kk4728

9 升级vim8.0
  wget

  权限改成root
  yum install unzip 
  unzip master.zip
  cd vim-master
  cd src/
  ./configure --with-features=huge --enable-python3interp --enable-pythoninterp=yes --enable-rubyinterp --enable-luainterp --enable-multibyte --enable-cscope
  //--prefix=/usr/local/vim
  //--enable-perlinterp
  make
  sudo make install 

*  权限改回kk4728*

*  vim --version
  验证是不是安装vim --version | grep python

10 vimrc 插件安装
  git clone ~/.vim/bundle/Vundle.vim
  vim .bash_profile 中添加alias vi=vim
  mv ~/.vimrc ~/.vimrc.bak
  Vundle插件处理的门道:~/.vim/bundle/Vundle.vim

  .vimrc暂且配置
  """""""""""""""""""""""""""""""""""""""""""""
  filetype off
  set rtp =~/.vim/bundle/Vundle.vim
  call vundle#begin()
  Plugin 'VundleVim/Vundle.vim'
  " My Plugins here:*

  Plugin 'bling/vim-airline'
  Plugin 'scrooloose/nerdtree'
  Plugin 'kien/ctrlp.vim'
  Plugin 'taglist.vim'
  Plugin 'Valloric/YouCompleteMe'
  Plugin 'winmanager'
  let g:winManagerWindowLayout="NERDTree|TagList"
  let g:NERDTree_title="[NERDTree]"
  function! NERDTree_Start()
  exec 'NERDTree'
  endfunction
  function! NERDTree_IsValid()
  return 1
  endfunction

  " All of your Plugins must be added before the following line
  call vundle#end() " required
  filetype plugin indent on " required

  //安装时间较长 二十分钟
  vim中:PluginInstall
  cmd: vim PluginInstall qall

11 更新gcc至6.3.0 安装时间太长 忧虑权限难点中途抛锚。这里整个使用root安装
  wget
  tar -jxvf gcc-6.3.0.tar.bz2
  cd gcc-6.3.0
  ./contrib/download_prerequisites
  cd ..
  mkdir gcc-build-6.3.0
  cd gcc-build-6.3.0
  ../gcc-6.3.0/configure --enable-checking=release --enable-languages=c,c --disable-multilib

  ######################################################
  这里要细心:按需要移除此前gcc版本
  yum remove gcc
  yum remove g
  yum remove gcc-c

  /lib/cpp fails sanity check的减轻办法

  在有个别软件的时候,运行./configure 会报错,错误提醒为:
  configure: error: C preprocessor “/lib/cpp” sanity check
  check See `config.log’ for more details
  ######################################################

  make -j7
  make install

  管理libstdc .so.6 以Computerx86 x64莫衷一是而各异 find / -name "libstdc .*"
    x64: cp libstdc .so.6.0.19 /usr/lib64/libstdc .so.6.0.19
      ln -sf /usr/lib64/libstdc .so.6.0.19 /usr/lib64/libstdc .so.6
    x32: cp /usr/local/lib/libstdc .so.6.0.22 /usr/lib/libstdc .so.6.0.22
      ln -sf /usr/lib/libstdc .so.6.0.22 /usr/lib/libstdc .so.6
  输入strings /usr/lib64/libstdc .so.6 | grep GLIBCXX查看成功
  strings /usr/lib/libstdc .so.6 | grep GLIBCXX
  GLIBCXX_3.4.8
  GLIBCXX_3.4.9
  GLIBCXX_3.4.10
  GLIBCXX_3.4.11
  GLIBCXX_3.4.12
  GLIBCXX_3.4.13
  GLIBCXX_3.4.14
  GLIBCXX_3.4.15
  GLIBCXX_3.4.16
  GLIBCXX_3.4.17
  GLIBCXX_3.4.18
  GLIBCXX_3.4.19
  GLIBCXX_3.4.20
  GLIBCXX_3.4.21
  GLIBCXX_3.4.22
  GLIBCXX_FORCE_NEW
  GLIBCXX_DEBUG_MESSAGE_LENGTH

12 安装clang : 这里不再另行编写翻译,间接下载更新好的

   i686: i386的一个子集,协理的cpu从Pentium 2 (686卡塔尔(英语:State of Qatar)带头,从前的型号不帮忙.
   i386: 适用于intel和AMD所有32位的cpu.以及via采用X86架构的32的cpu.
   intel平台富含8086,80286,80386,80486,奔腾类别(1.2.3.4卡塔尔国、赛扬系列,Pentium D种类以致centrino P-M,core duo 等.
   X86_64: 适用于intel的Core 2 Duo, Centrino Core 2 Duo, and Xeon 和AMD Athlon64/x2, Sempron64/x2, Duron64等采用X86架构的64位cpu.

   wget
  xz -d clang llvm-4.0.1-x86_64-linux-gnu-Fedora-25.tar.xz
  tar xvf clang llvm-4.0.1-x86_64-linux-gnu-Fedora-25.tar
  cd clang llvm-4.0.1-x86_64-linux-gnu-Fedora-25

  x64:
    wget
    xz -d clang llvm-3.5.1-x86_64-fedora20.tar.xz
    tar xvf clang llvm-3.5.1-x86_64-fedora20.tar
    cd clang llvm-3.5.1-x86_64-fedora20
  x86:
    wget
    xz -d clang llvm-3.5.1-i686-fedora20.tar.xz
    tar xvf clang llvm-3.5.1-i686-fedora20.tar
    cd clang llvm-3.5.1-i686-fedora20

  以上二种应该都足以,反正都以编写翻译好了的就能够了。这里自个儿童卫生保健守用了3.5.1版本的。文件小点 100多M 4.0.1 700多M

  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等等文件卡塔尔(英语:State of Qatar)。
  //中途现身谬误 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/

  整个vimrc配置如下
  """""""""""""""""""""""""""""""""""""""""""
  filetype off
  set rtp =~/.vim/bundle/Vundle.vim
  call vundle#begin()
  Plugin 'gmarik/Vundle.vim'
  " My Plugins here:"

  Plugin 'bling/vim-airline'
  "let g:airline_powerline_fonts = 1"
  set laststatus=2
  set t_Co=256

  Plugin 'scrooloose/nerdtree'
  let mapleader=","
  nmap <silent> <leader>ne :NERDTree<CR>
  nmap <silent> <leader>nc :NERDTreeClose<CR>
  "map <silent> <F3> :NERDTreeToggle<CR>"
  Plugin 'kien/ctrlp.vim'
  "Plugin 'altercation/vim-colors-solarized'"
  let g:ctrlp_custom_ignore = {
   'dir': 'vendor/bundle/*|vendor/cache/*|public|spec',
   'file': 'v.(exe|so|dll|swp|log|jpg|png|json)$',
   }
  syntax enable
  set background=dark
  let g:solarized_termcolors=256
  " colorscheme flatcolor

  Plugin 'taglist.vim'
  let Tlist_Show_One_File = 1 "差异不常候呈现八个文件的tag,只突显当前文件的"
  let Tlist_Exit_OnlyWindow = 1 "假诺taglist窗口是最终一个窗口,则脱离vim"
  "let Tlist_Use_Right_Window = 1" "在左臂窗口中呈现taglist窗口"
  "nmap <F4> :TlistToggle<cr>"

  Plugin 'Valloric/YouCompleteMe'
  Plugin 'rdnetto/YCM-Generator'
  let g:ycm_global_ycm_extra_conf = '~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py'
  let g:ycm_confirm_extra_conf = 0
  nnoremap <leader>gl :YcmCompleter GoToDeclaration<CR>
  nnoremap <leader>gf :YcmCompleter GoToDefinition<CR>
  nnoremap <leader>gg :YcmCompleter GoToDefinitionElseDeclaration<CR>
  inoremap <c-o> <c-x><c-o>
  let g:ycm_semantic_triggers = {
   'c' : ['->', ' ', '.', ' ', '(', '[', '&'],
   'cpp,objcpp' : ['->', '.', ' ', '(', '[', '&', '::'],
   'perl' : ['->', '::', ' '],
   'php' : ['->', '::', '.'],
   'cs,java,javascript,d,vim,python,perl6,scala,vb,elixir,go' : ['.'],
   'ruby' : ['.', '::'],
   'lua' : ['.', ':']
   }

  Plugin 'winmanager'
  let g:winManagerWindowLayout="NERDTree|TagList"
  let g:NERDTree_title="[NERDTree]"
  function! NERDTree_Start()
  exec 'NERDTree'
  endfunction
  function! NERDTree_IsValid()
  return 1
  endfunction
  nmap <silent> <F2> :if IsWinManagerVisible() <BAR> WMToggle<CR> <BAR> else <BAR> WMToggle<CR>:q<CR> endif <CR><CR>

  " All of your Plugins must be added before the following line"
  call vundle#end() " required"
  filetype plugin indent on " required"

  set nu "show line number"
  set ts=4 "tab length is 4"
  autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o
  set list listchars=tab:→ ,trail:·
  set hlsearch incsearch smartcase ignorecase
  autocmd BufNewFile,BufRead *.json set filetype=javascript

  
  nmap mm :call ChangeMouse()<cr>
  function ChangeMouse()
  if &mouse == "a"
  set mouse-=a
  else
  let &mouse = "a"
  endif
  endfunction

  set nocompatible
  set autoindent
  set backspace=indent,eol,start

  set fencs=utf-8,ucs-bom,shift-jis,gb18030,gbk,gb2312,cp936
  set termencoding=utf-8
  set encoding=utf-8
  set fileencodings=ucs-bom,utf-8,cp936
  set fileencoding=utf-8
  
  安装 TMUX
  yum install automake
  yum install libevent-devel ncurses-devel

  安装TMUX错误:‘EVBUFFER_EOL_LF’未声明 ----未尝试!!!!!!!!!!

  原因是选取的libevent的版本太低变成的,要求libevent>= 2.0.10-stable

  wget –no-check-certificate
  按照
  成功安装

15 清理
  clang 编写翻译好了以往,不用安装,仅仅为了赢得libclang.so 已经复制到 /usr/clang_351中
  python2.7 也会有时的,作为clang的依据 无需设置什么第三方库
  gcc 也能够是有的时候的, 用来编写翻译clang, 还足以获取libstdc .so

  清理后空中稍加减弱!!!!!!!!!!!!!!!!!!!

整个进度几次经过波折,搜查了众多网络好友博客。首要参考以下: http://...

本文由w88手机版登录-www.w88zhan.com-优德w88app官方登录发布于w88手机版登录网络,转载请注明出处:整个安装步骤如下

关键词: