首先安装gcc环境。
1 | yum install gcc |
安装过程,按官网的步骤执行(必须联网的前提下)。
1 2 3 4 | curl -R -O http://www.lua.org/ftp/lua-5.3.1.tar.gz tar zxf lua-5.3.1.tar.gz cd lua-5.3.1 make linux test |
可能遇到的异常:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | [root@localhost lua-5.3.4]# make linux test cd src && make linux make[1]: Entering directory `/root/Desktop/lua-5.3.4/src' make all SYSCFLAGS="-DLUA_USE_LINUX" SYSLIBS="-Wl,-E -ldl -lreadline" make[2]: Entering directory `/root/Desktop/lua-5.3.4/src' gcc -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_2 -DLUA_USE_LINUX -c -o lua.o lua.c lua.c:82:31: error: readline/readline.h: No such file or directory lua.c:83:30: error: readline/history.h: No such file or directory lua.c: In function ‘pushline’: lua.c:312: warning: implicit declaration of function ‘readline’ lua.c:312: warning: assignment makes pointer from integer without a cast lua.c: In function ‘addreturn’: lua.c:339: warning: implicit declaration of function ‘add_history’ make[2]: *** [lua.o] Error 1 make[2]: Leaving directory `/root/Desktop/lua-5.3.4/src' make[1]: *** [linux] Error 2 make[1]: Leaving directory `/root/Desktop/lua-5.3.4/src' make: *** [linux] Error 2 [root@localhost lua-5.3.4]# |
解决办法:运行安装以下组件。
1 | yum install libtermcap-devel ncurses-devel libevent-devel readline-devel |
检查安装是否完整:
1 2 3 | [root@localhost lua-5.3.4]# lua Lua 5.1.4 Copyright (C) 1994-2008 Lua.org, PUC-Rio > |
继续阅读
微信公众号
分享IT信息技术、北海生活的网站。提供北海本地化的信息技术服务。