首页 > 代码库 > linux安装lua相关编译报错

linux安装lua相关编译报错

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"

 

2、报cannot find -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.

linux安装lua相关编译报错