• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

lua-5.2.3编译问题记录"libreadline.so:undefinedreferenceto`PC'&a ...

原作者: [db:作者] 来自: [db:来源] 收藏 邀请
  作者:zhanhailiang 日期:2014-10-21
[root@~/software]# cd lua-5.2.3
[root@~/software/lua-5.2.3]# make linux
cd src && make linux
make[1]: Entering directory `/root/software/lua-5.2.3/src'
make all SYSCFLAGS="-DLUA_USE_LINUX" SYSLIBS="-Wl,-E -ldl -lreadline"
make[2]: Entering directory `/root/software/lua-5.2.3/src'
gcc -o lua   lua.o liblua.a -lm -Wl,-E -ldl -lreadline 
/usr/local/lib/libreadline.so: undefined reference to `PC'
/usr/local/lib/libreadline.so: undefined reference to `tgetflag'
/usr/local/lib/libreadline.so: undefined reference to `tgetent'
/usr/local/lib/libreadline.so: undefined reference to `UP'
/usr/local/lib/libreadline.so: undefined reference to `tputs'
/usr/local/lib/libreadline.so: undefined reference to `tgoto'
/usr/local/lib/libreadline.so: undefined reference to `tgetnum'
/usr/local/lib/libreadline.so: undefined reference to `BC'
/usr/local/lib/libreadline.so: undefined reference to `tgetstr'
collect2: ld returned 1 exit status
make[2]: *** [lua] Error 1
make[2]: Leaving directory `/root/software/lua-5.2.3/src'
make[1]: *** [linux] Error 2
make[1]: Leaving directory `/root/software/lua-5.2.3/src'
make: *** [linux] Error 2

这是由于lua编译依赖readline库,readline库依赖ncurses库。但没有指定。就会出现“没有定义的符合引用”错误。

解决方式是改动${LUA_DIR}/src/Makefile中linux编译target=linux。在SYSLIBS变量中追加‘-lncurses’选项就可以。例如以下:

105 linux:
106         $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX" SYSLIBS="-Wl,-E -ldl -lreadline -lncurses"

此时又一次运行:

[root@~/software/lua-5.2.3]# make linux install
cd src && make linux
make[1]: Entering directory `/root/software/lua-5.2.3/src'
make all SYSCFLAGS="-DLUA_USE_LINUX" SYSLIBS="-Wl,-E -ldl -lreadline -lncurses"
make[2]: Entering directory `/root/software/lua-5.2.3/src'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/root/software/lua-5.2.3/src'
make[1]: Leaving directory `/root/software/lua-5.2.3/src'
cd src && mkdir -p /usr/local/bin /usr/local/include /usr/local/lib /usr/local/man/man1 /usr/local/share/lua/5.2 /usr/local/lib/lua/5.2
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

至此,lua-5.2.3成功安装:

[root@~/software/lua-5.2.3/src]# /usr/local/bin/lua -v
Lua 5.2.3  Copyright (C) 1994-2013 Lua.org, PUC-Rio

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Cocos2d-x Lua中Sprite精灵类发布时间:2022-07-22
下一篇:
Nginx + Lua搭建文件上传下载服务(转载腾讯云大神)发布时间:2022-07-22
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap