在CentOS 5.6中编译imapfilter 2.4.1时发生错误。

我正在尝试在 CentOS 5.6 中编译 imapfilter 2.4.1(https://github.com/lefcha/imapfilter)。我相信我已经解决了所有依赖关系,但在运行 make 时出现以下错误:

make[1]: 进入目录 `/home/src/imapfilter-2.4.1/src'
cc -Wall -O -DMAKEFILE_SHAREDIR='"/usr/local/share/imapfilter"' -c -o core.o core.c
core.c:41: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘ifcorelib’
core.c: In function ‘ifcore_append’:
core.c:947: warning: implicit declaration of function ‘lua_strlen’
core.c: In function ‘luaopen_ifcore’:
core.c:1162: warning: implicit declaration of function ‘luaL_register’
core.c:1162: error: ‘ifcorelib’ undeclared (first use in this function)
core.c:1162: error: (Each undeclared identifier is reported only once
core.c:1162: error: for each function it appears in.)
make[1]: *** [core.o] Error 1
make[1]: 离开目录 `/home/src/imapfilter-2.4.1/src'
make: *** [all] Error 2

基于其他用户的评论和文件修订日期,我确定它应该可以编译。我猜测我可能遗漏了某个库。我将非常感谢任何能提供帮助的人。

原文链接 https://stackoverflow.com/questions/8859716

点赞
stackoverflow用户196561
stackoverflow用户196561

从第一个错误信息开始:

core.c:41: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘ifcorelib’

core.c 的第 41 行是:

static const luaL_reg ifcorelib[] = {

gcc 艰涩的消息意味着它并不知道 luaL_reg 是什么,它认为它是一个变量名。然后当在同一个定义/声明中读取 第二个 变量名时,它就陷入了恐慌。luaL_reg 应该是结构体之类的东西。

因此,似乎您的问题出在 LUA 开发头文件中。可能你的 Lua 包过于陈旧或者过于现代。

imapfilter 的 github 读我文件中写着:

编译时的要求是 Lua(版本 5.1)

你确定你的 lua 是 5.1,lua-devel(或者其他带有 lua 头文件的软件包)也是 5.1 吗?

2012-01-18 03:13:48