2021-05-12 14:32:11
CentOS 5.x安裝Lua 5.2.3 error (MYLIBS=-lncurses)
在CentOS 5.x 中安裝Lua 5.2.3時遇到如下錯誤:
# make linux
gcc -o lua lua.o liblua.a -lm -Wl,-E -ldl -lreadline
/usr/lib/gcc/x86_64-RedHat-linux/4.1.2/../../../../lib64/libreadline.so:undefined reference to `PC'
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64/libreadline.so: undefined reference to `tgetflag'
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64/libreadline.so: undefined reference to `tgetent'
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64/libreadline.so:undefined reference to `UP'
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64/libreadline.so: undefined reference to `tputs'
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64/libreadline.so: undefined reference to `tgoto'
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64/libreadline.so:undefined reference to `tgetnum'
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64/libreadline.so: undefined reference to `BC'
/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64/libreadline.so: undefined reference to `tgetstr'
collect2: ld returned 1exit status
make[2]:***[lua]Error1
make[2]:Leaving directory `/opt/soft_bak/lua-5.2.3/src'
make[1]: *** [linux] Error 2
make[1]: Leaving directory `/opt/soft_bak/lua-5.2.3/src'
make: *** [linux] Error 2
解決辦法, 新增 MYLIBS=-lncurses
[root@db-172-16-3-39 lua-5.2.3]# make linux MYLIBS=-lncurses
cd src && make linux
make[1]: Entering directory `/opt/soft_bak/lua-5.2.3/src'
make all SYSCFLAGS="-DLUA_USE_LINUX" SYSLIBS="-Wl,-E -ldl -lreadline"
make[2]: Entering directory `/opt/soft_bak/lua-5.2.3/src'
gcc -o lua lua.o liblua.a -lm -Wl,-E -ldl -lreadline -lncurses
gcc -O2 -Wall -DLUA_COMPAT_ALL -DLUA_USE_LINUX -c -o luac.o luac.c
gcc -o luac luac.o liblua.a -lm -Wl,-E -ldl -lreadline -lncurses
make[2]: Leaving directory `/opt/soft_bak/lua-5.2.3/src'
make[1]: Leaving directory `/opt/soft_bak/lua-5.2.3/src'
[root@db-172-16-3-39 lua-5.2.3]# make install
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
[root@db-172-16-3-39 lua-5.2.3]# make test
src/lua -v
Lua 5.2.3 Copyright (C) 1994-2013 Lua.org, PUC-Rio
Lua 語言 15 分鐘快速入門 http://www.linuxidc.com/Linux/2013-06/86582.htm
Lua程式設計(第2版)中文 PDF http://www.linuxidc.com/Linux/2013-03/81833.htm
Lua程式設計(第二版)閱讀筆記 http://www.linuxidc.com/Linux/2013-03/81834.htm
NetBSD 將支援用 Lua 指令碼開發核心元件 http://www.linuxidc.com/Linux/2013-02/79527.htm
CentOS 編譯安裝 Lua LuaSocket http://www.linuxidc.com/Linux/2011-08/41105.htm
Programming In Lua 高清PDF中文版 http://www.linuxidc.com/Linux/2015-05/117362.htm
如何設定一套優雅的Lua開發環境 http://www.linuxidc.com/Linux/2015-10/124397.htm
相關文章