1、报之类的错误
/usr/lib/libreadline.so: undefined reference to `PC' /usr/lib/libreadline.so: undefined reference to `tgetflag' /usr/lib/ibreadline.so: undefined reference to `tgetent' /usr/lib/libreadline.so: undefined reference to `UP' /usr/lib/libreadline.so: undefined reference to `tputs' /usr/lib/libreadline.so: undefined reference to `tgoto' /usr/lib/libreadline.so: undefined reference to `tgetnum' /usr/lib/libreadline.so: undefined reference to `BC'
解决:
由于lua编译依赖readline
库,而其依赖ncurses
库,但没有指定,所以出现“未定义的符合引用”错误。需要修改${LUA_DIR}/src/Makefile
中linux编译target,在SYSLIBS变量中追加‘-lncurses’选项即可。修改后,如下:
linux:
$(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX" SYSLIBS="-Wl,-E -ldl -lreadline -lncurses"
解决:
需要安装
ncurses
yum install ncurses-devel
3、报 lua.c:67:31: fatal error: readline/readline.h: No such file or directory
解决:
说明缺少libreadline-dev依赖包 centos: yum install readline-devel debian: apt-get install libreadline-dev.