Lua很小巧。
一下是摘自Lua官方网站的编译步骤:
curl -R -O http://www.lua.org/ftp/lua-5.2.3.tar.gz tar zxf lua-5.2.3.tar.gz cd lua-5.2.3 make linux make test
其中
按照上面的步骤编译链接过程中碰到下面的错误:
shell> gcc -o lua lua.o liblua.a -lm -Wl,-E -ldl -lreadline /usr/lib64/libreadline.so: undefined reference to `PC' /usr/lib64/libreadline.so: undefined reference to `tgetflag' /usr/lib64/libreadline.so: undefined reference to `tgetent' /usr/lib64/libreadline.so: undefined reference to `UP' /usr/lib64/libreadline.so: undefined reference to `tputs' /usr/lib64/libreadline.so: undefined reference to `tgoto' /usr/lib64/libreadline.so: undefined reference to `tgetnum' /usr/lib64/libreadline.so: undefined reference to `BC' /usr/lib64/libreadline.so: undefined reference to `tgetstr' collect2: ld returned 1 exit status
解决办法是添加-lncurses
选项,即:
gcc -o lua lua.o liblua.a -lm -Wl,-E -ldl -lreadline -lncurses
ncurses
(new curses)是一个用于编写基于终端(命令行)的程序的库,是GNU项目之一。(https://www.gnu.org/software/ncurses/)