Ubuntu14.04 32位安装YouCompleteMe

  YouCompleteMe是一个至关好用的代码补全插件,因为更新系统重装了一下,记录一下过程。html

  项目主页: https://github.com/Valloric/YouCompleteMe , 感受不少地方写的不是太清楚,须要仔细阅读。python

  一、首先要安装vimgit

   sudo apt-get install vim  安装后vim版本已经到7.4了,达到要求(Vim 7.3.584+)。github

  二、安装vundle, 这是一个vim插件管理工具。vim

  https://github.com/gmarik/Vundle.vim#aboutsvn

   安装后进入vim, 执行 :BundleInstall 便可完成安装。 工具

  三、若是须要c语言的语法检查支持,则须要安装生成makefile须要libclang.so(3.2+). 系统里我是搜了半天都没搜到,官网也只提供了x86_64位版本的二进制包,因此只好用源码编译。优化

  参考http://clang.llvm.org/get_started.html 便可。ui

 主要过程以下;spa

If you would like to check out and build Clang, the current procedure is as follows:

  1. Get the required tools.
  2. Checkout LLVM:
    • Change directory to where you want the llvm directory placed.
    • svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm
  3. Checkout Clang:
    • cd llvm/tools
    • svn co http://llvm.org/svn/llvm-project/cfe/trunk clang
    • cd ../..
  4. Checkout extra Clang Tools: (optional)
    • cd llvm/tools/clang/tools
    • svn co http://llvm.org/svn/llvm-project/clang-tools-extra/trunk extra
    • cd ../../../..
  5. Checkout Compiler-RT:
    • cd llvm/projects
    • svn co http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
    • cd ../..
  6. Build LLVM and Clang:
    • mkdir build (for building without polluting the source dir)
    • cd build
    • ../llvm/configure --enable-optimized     这里若是不加优化选项,没法编译成功,提示ld 内存不足,很诡异。
    • make

  四、编译成功以后则会生成一个libclang.so, 时间挺长的,接着生成Makefile:

    mkdir ycm_build

    cd ycm_build 

    cmake -G "Unix Makefiles" -DEXTERNAL_LIBCLANG_PATH=/your/path/to/libclang.so . ~/.vim/bundle/YouCompleteMe/cpp/

  五、开始编译

    make ycm_core 

相关文章
相关标签/搜索