源碼安裝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試一下,報錯:

OSError: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found

需要升級gcc版本,參考:https://blog.csdn.net/GUI1259802368/article/details/84934075

yum provides libstdc++.so.6
Loaded plugins: auto-update-debuginfo, fastestmirror
Loading mirror speeds from cached hostfile
libstdc++-4.8.5-4.el7.i686 : GNU Standard C++ Library
Repo        : base
Matched from:
Provides    : libstdc++.so.6



libstdc++-4.8.5-5.tl2.i686 : GNU Standard C++ Library
Repo        : tlinux
Matched from:
Provides    : libstdc++.so.6



libstdc++-4.8.5-39.tl2.i686 : GNU Standard C++ Library
Repo        : tlinux
Matched from:
Provides    : libstdc++.so.6



libstdc++-4.8.5-39.tl2.1.i686 : GNU Standard C++ Library
Repo        : tlinux
Matched from:
Provides    : libstdc++.so.6



libstdc++-4.8.5-39.tl2.1.i686 : GNU Standard C++ Library
Repo        : @tlinux
Matched from:
Provides    : libstdc++.so.6

安裝最新版本:

yum install libstdc++-4.8.5-39.tl2.1.i686

新版本是安裝在/usr/loca/lib64/目錄下,需要將其拷貝到/usr/lib64目錄下

cp /usr/local/lib64/libstdc++.so.6.0.28 /usr/lib64/
ln -sf /usr/lib64/libstdc++.so.6.0.28 /usr/lib64/

重新打開vim,報錯消失,終於完成了。

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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM