首先下载Lua安装包:http://www.lua.org/
这里,我下载的是最新的版本lua-5.3.4.tar.gz
接着,我们需要安装Lua:
tar -zxvf lua-5.3.4.tar.gz
cd lua-5.3.4
sudo apt-get install libreadline-dev
make linux test
输出结果为:
liuqiang@liuqiang-Ubuntu16:~/Downloads/lua-5.3.4$ make linux test
cd src && make linux
make[1]: Entering directory '/home/liuqiang/Downloads/lua-5.3.4/src'
make all SYSCFLAGS="-DLUA_USE_LINUX" SYSLIBS="-Wl,-E -ldl -lreadline"
make[2]: Entering directory '/home/liuqiang/Downloads/lua-5.3.4/src'
gcc -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_2 -DLUA_USE_LINUX -c -o lua.o lua.c
gcc -std=gnu99 -o lua lua.o liblua.a -lm -Wl,-E -ldl -lreadline
gcc -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_2 -DLUA_USE_LINUX -c -o luac.o luac.c
gcc -std=gnu99 -o luac luac.o liblua.a -lm -Wl,-E -ldl -lreadline
make[2]: Leaving directory '/home/liuqiang/Downloads/lua-5.3.4/src'
make[1]: Leaving directory '/home/liuqiang/Downloads/lua-5.3.4/src'
src/lua -v
Lua 5.3.4 Copyright (C) 1994-2017 Lua.org, PUC-Rio
接着开始安装:
sudo make install
输出结果为:
liuqiang@liuqiang-Ubuntu16:~/Downloads/lua-5.3.4$ sudo make install
[sudo] password for liuqiang:
cd src && mkdir -p /usr/local/bin /usr/local/include /usr/local/lib /usr/local/man/man1 /usr/local/share/lua/5.3 /usr/local/lib/lua/5.3
cd src && install -p -m 0755 lua luac /usr/local/bin
cd src && install -p -m 0644 lua.h luaconf.h lualib.h lauxlib.h lua.hpp /usr/local/include
cd src && install -p -m 0644 liblua.a /usr/local/lib
cd doc && install -p -m 0644 lua.1 luac.1 /usr/local/man/man1