clang_complete插件所需的libclang 的编译

来源:互联网 发布:开发java最好用的软件 编辑:程序博客网 时间:2024/05/18 14:44
gcc 4.8.x 的编译
====
llvm 用gcc4.1编不过,需要4.8以上的,如果没有可以参照http://www.linuxfromscratch.org/blfs/view/stable/general/gcc.html来编。

libclang.so 的编译
====
cd ~
svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm
cd ~/llvm/tools
svn co http://llvm.org/svn/llvm-project/cfe/trunk clang
cd ~/llvm/projects
svn co http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt

mkdir build && cd build
export CFLAGS='-fPIC'
export LDFLAGS='-fPIC'
export CPPFLAGS='-fPIC'
export CXXFLAGS='-fPIC'
../llvm/configure --prefix=$HOME/tools \
--disable-docs --enable-optimized --disable-assertions --enable-targets=x86,x86_64  \
--with-gcc-toolchain=$HOME/tools \
--with-extra-ld-options=-Wl,-R,$HOME/tools/lib64 \

make -j16
make VERBOSE=1 查看编译参数,适当修改Makefile.config
我编译出现projects/compiler-rt/lib/sanitizer_common下面编不过。
我#if 0暂时规避了。不知道把上层subdirs += sanitizer_common 有什么影响。
windows mingw 编译请参考[1]。
windows 上我编译花了很长时间, linux 服务器16核马力全开,也花了半个小时。

把clang_complete 放到bundle 下面就可以用了,
这时编辑一个cpp文件,出现
WARNING: libclang can not find the builtin includes
--with-c-include-dirs 就是为了避免这种情况。
但是我发现加了编译不过,按[1]的修改源码也不行,
正解是修改 plugin/libclang.py 的 getBuiltinHeaderPath[2]

[1] http://blog.wwang.me/2013/12/ycm-with-clang-on-windows.html
[2] https://github.com/Rip-Rip/clang_complete/issues/238
[3] neocomplete 和YCM的比较: https://github.com/skwp/dotfiles/issues/330



0 0
原创粉丝点击