[英]“cannot find -lreadline” error when compiling Lua
This should be a pretty straightforward issue -- I'm trying to compile Lua (or rather lua-vec, which is a minor variant) on a CentOS Linux install, and I get the following error: 这应该是一个非常简单的问题 - 我正在尝试在CentOS Linux安装上编译Lua(或者更确切地说是lua-vec,这是一个小变体),我收到以下错误:
[jt@flyboy src]#make linux
make all MYCFLAGS=-DLUA_USE_LINUX MYLIBS="-Wl,-E -ldl -lreadline -lhistory -lncurses"
make[1]: Entering directory `/jt/flyboy/fly/lua/lua-vec/src'
gcc -o lua lua.o liblua.a -lm -Wl,-E -ldl -lreadline -lhistory -lncurses
/usr/bin/ld: cannot find -lreadline
collect2: ld returned 1 exit status
make[1]: *** [lua] Error 1
That would suggest the readline lib is not installed. 这表明没有安装readline lib。 But... 但...
[jt@flyboy src]#ls /usr/lib/libreadline*
/usr/lib/libreadline.so.5 /usr/lib/libreadline.so.5.1
Interestingly, if I rearrange the order of readline/history/ncurses, whichever is first triggers the same error, so I suspect that this is some sort of a folder-specification problem, not a missing library problem. 有趣的是,如果我重新排列readline / history / ncurses的顺序,那么首先触发相同的错误,所以我怀疑这是某种文件夹规范问题,而不是缺少库问题。
Any ideas? 有任何想法吗?
yum install readline-devel.x86_64 readline-devel.i386 ncurses-devel.i386 ncurses-devel.x86_64
seems to have done the trick! 似乎已经成功了! The odd thing is I have compiled this before without these libs... but enough time pondering life's mysteries... 奇怪的是我之前没有这些文件编译过这个...但是有足够的时间思考生活的神秘......
libreadline
is not enough, it will give you libraries related to readline. libreadline
是不够的,它会给你与readline相关的库。 You need libreadline-dev
for compiling package which depends upon readline
like in above case. 你需要libreadline-dev
来编译包,它依赖于readline
,如上例所示。
In Red Hat like distros, name of package is readline-devel
在像发行版这样的Red Hat中,包的名称是readline-devel
Following command will do the trick in such environment: 以下命令将在这样的环境中完成:
$ yum install -y readline-devel
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.