源码安装vim8

背景

突然想要试用youcompleteme插件,但是yum安装的vim版本太低了,于是索性直接从源码编译vim8来使用,中间遇到了一些问题,记录一下以备后续查阅。

安装

下载源码

git clone https://github.com/vim/vim.git

编译、安装

cd vim/src
make
make install

默认安装在/usr/local/bin/vim,由于之前的vim还没卸载,于是直接使用绝对路径打开新的vim8,报错:

YouCompleteMe unavailable: requires Vim compiled with Python (3.6.0+) support

提示没有添加python3支持,于是重新编译

./configure --enable-python3interp=yes
make
make install

重新使用绝对路径打开vim,报错消失了,成功打开。

配置youcompleteme

参考官方文档:https://github.com/ycm-core/YouCompleteMe#full-installation-guide
执行python3 install.py --all时报错:

Searching Python 3.7 libraries...
ERROR: found static Python library (/usr/local/lib/python3.7/config-3.7m-x86_64-linux-gnu/libpython3.7m.a) but a dynamic one is required. You must use a Python compiled with the --enable-shared flag. If using pyenv, you need to run the command:
  export PYTHON_CONFIGURE_OPTS="--enable-shared"
before installing a Python version.

原因:源码编译python3.7时没有添加--enable-shared选项,重新编译python3.7

make distclean
./configure --enable-shared --enable-optimizations
make 
make install

再执行python3 install.py --all成功。

安装好YCM之后,打开vim试一下,报错:

YouCompleteMe unavailable: /usr/local/lib/python3.7/lib-dynload/_socket.cpython-37m-x86_64-linux-gnu.so: undefined symbol: PyByteArray_Type

参考:
https://github.com/ycm-core/YouCompleteMe/wiki/Building-Vim-from-source

源码安装vim8

上一篇:wsl安装Ubuntu16.04无法ssh提示Permission denied (publickey)


下一篇:Linux重定向用法详解