初心者がUbuntu 18.04.4 LTSにvim 8.2 + python 3.8.2 +luaのプラグイン環境を構築しようとして詰まった時の話


概要

マスタリングVimを購読したのでVim環境を整えようと、@kiwi-bird様の下記の記事を参考にプラグイン環境を構築しようとした際、超絶初歩的なミスをしていたので自戒の念を込めて公開します。

参考記事
Ubuntu18.04にvim8.2+python+ruby+luaプラグイン環境を構築するぜ

事前準備等については上記を参考にしていただけますと幸いです。
なお、今回はrubyをインストールしていません

Vimのインストール

さくっとインストールしてみました。

git clone https://github.com/vim/vim
cd vim
./configure \
  --enable-fail-if-missing \
  --with-features=huge \
  --disable-selinux \
  --enable-perlinterp \
  --enable-python3interp \
  --enable-rubyinterp \
  --with-ruby-command=$HOME/.rbenv/shims/ruby \
  --enable-luainterp \
  --with-lua-prefix=$HOME/.luaenv/versions/5.3.5 \
  --enable-cscope \
  --enable-fontset \
  --enable-multibyte \
  vi_cv_path_python3=$HOME/.pyenv/shims/python

ところがどっこい

configure: creating cache auto/config.cache
checking whether make sets $(MAKE)... yes

~()~

checking --enable-perlinterp argument... yes
checking for perl... /usr/bin/perl
checking Perl version... OK
checking if compile and link flags for Perl are sane... no: PERL DISABLED
configure: error: could not configure perl

コピペでそのまま投入したためperlでエラーが出てました。この際、大して気にせずmakeしてしまい、pythonもluaも有効化されません。
結果、ディレクトリを変えたりインストールし直したりとリトライを何度かやってようやくエラーメッセージを読むことを覚えました。。。

perlと今回インストールしないrubyの記述を抜いてこれで完璧と再度コマンド投入

# ./configure \
   --enable-fail-if-missing \
   --with-features=huge \
   --disable-selinux \
   --enable-python3interp \
   --enable-luainterp \
   --with-lua-prefix=$HOME/.luaenv/versions/5.3.5 \
   --enable-cscope \
   --enable-fontset \
   --enable-multibyte \
   vi_cv_path_python3=$HOME/.pyenv/shims/python
configure: creating cache auto/config.cache
checking whether make sets $(MAKE)... yes

~()~

checking --with-lua-prefix argument... /home/u_sota/.luaenv/versions/5.3.5
checking --with-luajit... no
checking for lua... no
checking if lua.h can be found in /home/u_sota/.luaenv/versions/5.3.5/include... yes
checking if link with -L/home/u_sota/.luaenv/versions/5.3.5/lib -llua is sane... yes
checking --enable-mzschemeinterp argument... no
checking --enable-perlinterp argument... no
checking --enable-pythoninterp argument... no
checking --enable-python3interp argument... yes
checking --with-python3-command argument... no
checking Python version... auto/configure: line 6682: /home/u_sota/.pyenv/shims/python: No such file or directory

checking Python is 3.0 or better... auto/configure: line 6689: /home/u_sota/.pyenv/shims/python: No such file or directory
too old
configure: error: could not configure python3

今度はPythonが見つからないとのこと。pythonが$HOME/.anyenv/配下に
あるためでした。vi_cv_path_python3の記述を変更します。

./configure \
   --enable-fail-if-missing \
   --with-features=huge \
   --disable-selinux \
   --enable-python3interp \
   --enable-luainterp \
   --with-lua-prefix=$HOME/.luaenv/versions/5.3.5 \
   --enable-cscope \
   --enable-fontset \
   --enable-multibyte \
   vi_cv_path_python3=$HOME/.anyenv/envs/pyenv/shims/python
configure: loading cache auto/config.cache
checking whether make sets $(MAKE)... yes
checking for gcc... gcc

~()~

configure: updating cache auto/config.cache
configure: creating auto/config.status
config.status: creating auto/config.mk
config.status: creating auto/config.h

今回はうまく通ったようです。make後にversionを確認したところ、luaとpython3が有効になっていたので、インストールを行いました。

教訓

コピペする前に自分の環境を省みること。
エラーメッセージをちゃんと読む。