Lua-5.2.3 compilation problem "/usr/local/lib/libreadline. So: Undefined reference to 'pc '"

Source: Internet
Author: User
Zhanhailiang Date: 2014-10-21
[root@~/software]# cd lua-5.2.3[root@~/software/lua-5.2.3]# make linuxcd src && make linuxmake[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 statusmake[2]: *** [lua] Error 1make[2]: Leaving directory `/root/software/lua-5.2.3/src‘make[1]: *** [linux] Error 2make[1]: Leaving directory `/root/software/lua-5.2.3/src‘make: *** [linux] Error 2

This is becauseLuaCompile DependenciesReadlineLibrary and Readline library dependencyNcursesLibrary, but not specified, the "undefined reference compliance" error will occur.

Solution: Modify $ {lua_dir }/Src/makefileCompiling in LinuxTarget = Linux, InSyslibsAppend in variable'-Lncurses'Option. As follows:

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

Execute again:

[root@~/software/lua-5.2.3]# make linux installcd src && make linuxmake[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.2cd src && install -p -m 0755 lua luac /usr/local/bincd src && install -p -m 0644 lua.h luaconf.h lualib.h lauxlib.h lua.hpp /usr/local/includecd src && install -p -m 0644 liblua.a /usr/local/libcd doc && install -p -m 0644 lua.1 luac.1 /usr/local/man/man1

So far, lua-5.2.3 installation successful:

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

Lua-5.2.3 compilation problem "/usr/local/lib/libreadline. So: Undefined reference to 'pc '"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.