码迷,mamicode.com
首页 > 其他好文 > 详细

lua-5.2.3编译问题记录"libreadline.so: undefined reference to `PC'"

时间:2017-07-08 21:59:12      阅读:277      评论:0      收藏:0      [点我收藏+]

标签:成功   direction   data   enter   install   ldl   sof   bin   lag   

  作者: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

lua-5.2.3编译问题记录"libreadline.so: undefined reference to `PC'"

标签:成功   direction   data   enter   install   ldl   sof   bin   lag   

原文地址:http://www.cnblogs.com/wzzkaifa/p/7138020.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!