vim编译安装+lua模块

2016/09/21 vim

#vim编译安装+lua模块

使用背景:代码自动补全插件,需要安装lua模块

安装准备,首先下载安装vim所依赖的其它安装包,ncurses,lua,readline,vim

源码下载,编译安装

ncurses:http://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.9.tar.gz
readline:ftp://ftp.gnu.org/gnu/readline/readline-5.2.tar.gz
lua:http://www.lua.org/download.html
vim:ftp://ftp.vim.org/pub/vim/unix/vim-7.4.tar.bz2

步骤1:

检查VIM是否安装lua模块,如果有+lua表示已安装lua

vim --version

如果没有安装先卸载vim,用gcc编译安装

rpm -qa | grep vim
yum remove vim*
yum remove vim vim-enhanced vim-common vim-minimal

步骤2:

lua相关网站

http://lua-users.org/wiki/LuaBinaries
http://luabinaries.sourceforge.net/download.html
lua下载地址
http://sourceforge.net/projects/luabinaries/files/5.3.2/Docs%20and%20Sources/lua-5.3.2_Sources.tar.gz
https://sourceforge.net/projects/luabinaries/files/5.3.2/Docs%20and%20Sources
https://sourceforge.net/projects/luabinaries/files/5.3.2/Docs%20and%20Sources/lua-5.3.2_Sources.zip

https://github.com/keplerproject/luarocks
http://keplerproject.github.io/luarocks/releases/

http://www.lua.org/download.html

vim相关网址

http://www.vim.org
vim下载
http://www.vim.org/download.php
http://www.vim.org/sources.php
ftp://ftp.vim.org/pub/vim/unix/vim-7.4.tar.bz2
编译安装vim
http://vim.wikia.com/wiki/Building_Vim

##开始安装vim及lua

1.安装lua

curl -R -O http://www.lua.org/ftp/lua-5.3.2.tar.gz
tar zxf lua-5.3.2.tar.gz
cd lua-5.3.2
vim lua-5.3.2/src/Makefile,修改110行,在行尾添加-lncurses
make linux test
make install

2.编译安装vim


wget -c ftp://ftp.vim.org/pub/vim/unix/vim-7.4.tar.bz2
tar zxvf lua-5.3.2_Sources.tar.gz
tar jxf vim-7.4.tar.bz2
cd vim74/


make distclean

./configure --enable-luainterp --enable-gui=no \
--without-x --enable-multibyte --prefix=/usr

./configure --prefix=/usr --with-features=huge --enable-rubyinterp --enable-pythoninterp --enable-luainterp --with-lua-prefix=/usr/local > error.log

使用该编译参数
./configure --with-features=huge \
--enable-cscope \
--enable-rubyinterp \
--enable-largefile \
--enable-multibyte \
--disable-netbeans \
--enable-luainterp \
--with-lua-prefix=/usr/local \
--enable-pythoninterp \
--enable-cscope -prefix=/usr 

make && make install

一些安装错误

yum install lua-devel

提示缺少ncurses
yum -y install ncurses-devel

lua.c:80:31: error: readline/readline.h: No such file or directory
解决方法,安装readline-devel 
yum -y install readline-devel 

vim安装错误
make过程出现错误,vim74/src/if_lua.c:777:undefined reference to luaL_optlong。打开if_lua.c文件,定位到777行,将
long pos = luaL_optlong(L, 3, 0);     //修改为
long pos = (long)luaL_optinteger(L, 3, 0);



关于lua的相关记录
这东西没有 configure 晕,怎么去指定include 和 lib呢,从安装目录里面找了半天 只在 Makefile 里面找到了一个INSTALL_TOP 安装路径。我郁闷了,这可怎么办。
打开 src/Makefile 
有两个变量 CFLAGS=  和 MYLDFLAGS= 

这两个东西就是指定include 和lib的,
CFLAGS= -O2 -Wall $(MYCFLAGS) -I/usr/local/ufo/lib/readline/include
.....
MYLDFLAGS=-L/usr/local/ufo/lib/readline/lib
修改后保存退出,然后又改了一下 
INSTALL_TOP = /usr/local/ufo/lua

参考 http://blog.csdn.net/laishaofa/article/details/50282199


Search

    Table of Contents