编译vim8源码同时支持python,pyhton3,lua,ruby,perl...(ubuntu16.4)
第一步,安装python,lua,ruby,perl.
-> sudo apt install git python-dev ruby-dev lua5.1-policy lua5.1-policy-dev libncurses5-dev
第二步,github下载源码
-> git clone https://github.com/vim/vim.git
第三步,makefile编译,这里要去找你自己的路径
-> cd vim;
-> ./configure --enable-pythoninterp=yes --with-python-config-dir=/usr/lib/python2.7/config-i386-linux-gnu --enable-luainterp=yes --with-lua-prefix=/usr --enable-rubyinterp=yes --with-ruby-command=ruby --enable-perlinterp=yes
-> sudo make VIMRUNTIMEDIR=/usr/share/vim/vim80/
-> sudo make install
-> vim --version
+python +python3 +lua +ruby -perl (but no compile or link error or warning,I will check it)
第四步,没有支持perl,fixed it.
make是成功的,没有错误和警告提示,那就看看编译过程有没有log可查.
-> cd vim; grep "perl" -nrE
src/auto/config.log:245:configure:5761: gcc -o conftest -g -O2 -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fwrapv -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/lib/i386-linux-gnu/perl/5.22/CORE -Wl,-E -L/usr/local/lib conftest.c -Wl,-E
-fstack-protector-strong -L/usr/local/lib -L/usr/lib/i386-linux-gnu/perl/5.22/CORE -lperl -ldl -lm -lpthread -lcrypt >&5
src/auto/config.log:246:/usr/bin/ld: cannot find -lperl
果然有问题,cannot find -lperl, 原来是链接失败了,在-L/usr/lib/i386-linux-gnu/perl/5.22/CORE这个目录链接失败了.
找找libperl.so在哪里
-> cd /; sudo find . -name "libperl.so*"
./usr/lib/i386-linux-gnu/libperl.so.5.22.1
./usr/lib/i386-linux-gnu/libperl.so.5.22
就找到这俩,只有带版本号的lib,看来开发者不太想让人链接他的lib.找到这里就简单了,去-L路径添加软链接libperl.so
-> cd /usr/lib/i386-linux-gnu/perl/5.22/CORE
-> sudo ln -s /usr/lib/i386-linux-gnu/libperl.so.5.22 libperl.so
-> ls -al libperl.so
lrwxrwxrwx 1 root root 39 1月 5 21:05 libperl.so -> /usr/lib/i386-linux-gnu/libperl.so.5.22
再执行一次第三步,完活.
during using , i find that !!!python dont work with python3 together.