- 下载源码包以及编译
wget http://www.lua.org/ftp/lua-5.3.1.tar.gz
tar -zxvf lua-5.3.1.tar.gz
cd lua-5.3.1
make linux
- 注意的问题
编译的时候,遇到的问题是,缺少依赖包 readline, 然后readline又依赖ncurses,所以要先安装着两个软件
yum install -y readline-devel ncurses-devel
如果是debian linux
apt-get install libreadline6-dev
apt-get install libncurses5-dev
如果是ubuntu
sudo apt-get install libreadline6-dev
sudo apt-get install libncurses5-dev
- 测试
运行:
gcc -o test tes.c -I/usr/local/lua/include/ -L/usr/local/lua/lib/ /usr/local/lua/lib/liblua.a -llua -lm -ldl
(转自我另外一个博客lua编译(linux) )