Ubuntu 20.04下编译安装带Python3与剪贴板支持的Vim失败问题求助
大家好,我最近在Ubuntu 20.04上尝试从源码编译安装Vim,想要同时开启Python3支持和剪贴板支持,但遇到了一些问题,希望能得到大家的帮助。
我参考插件网站的说明修改了./configure命令,加入了剪贴板相关配置,具体命令如下:
./configure --with-features=huge \ --enable-multibyte \ --enable-rubyinterp=yes \ --enable-python3interp=yes \ --with-python3-config-dir=$(python3-config --configdir) \ --enable-perlinterp=yes \ --enable-luainterp=yes \ --enable-gui=gtk2 \ --enable-cscope \ --with-x \ --prefix=/usr/local
执行make和sudo make install后,编译出的Vim并没有Python3支持,且编译过程中出现了如下报错:
lto1: fatal error: bytecode stream in file ‘/home/daniel/anaconda3/lib/python3.8/config-3.8-x86_64-linux-gnu/libpython3.8.a’ generated with LTO version 6.0 instead of the expected 8.1
compilation terminated.
lto-wrapper: fatal error: gcc returned 1 exit status
compilation terminated.
/usr/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
link.sh: Linking failed
make[1]: *** [Makefile:2062: vim] Error 1
make[1]: Leaving directory '/home/daniel/vim/src'
make: *** [Makefile:29: first] Error 2
我推测问题根源在于$(python3-config --configdir)指向的是我的conda Python安装路径,而conda的Python是用旧版本LTO编译的,和当前系统的gcc版本不兼容。
我已经尝试过这些方法,但都没解决问题:
- 手动指定系统Python的配置目录,将
--with-python3-config-dir改为/usr/lib/python3.8/config-3.8-x86_64-linux-gnu,但编译时依然调用conda的Python - 每次尝试编译前都会在Vim源码目录执行
sudo make distclean清理之前的编译文件
另外,几天前我还成功编译出符合需求的Vim,但后来不知道是不是因为用pip安装了某个库,突然失去了剪贴板支持,现在重新编译就一直失败。
想请教大家:
- 如何让Vim编译时使用系统Python而不是conda的?
- 还有其他什么解决方案能让我成功编译出带Python3和剪贴板支持的Vim吗?
谢谢大家!
备注:内容来源于stack exchange,提问作者dherrera




