2013-05-30 55 views
0

我在x86_64机器上。我想使用它的makefile来建立fortune,但我得到有关失踪符号的错误:在x86_64上编译“财富”时出错

cd fortune && make CC='gcc' \ 
        CFLAGS='-O2 -DFORTDIR="\"/usr/local/share/games/fortunes\"" -DOFFDIR="\"/usr/local/share/games/fortunes/off\"" -Wall -fomit-frame-pointer -pipe -DHAVE_REGEX_H -DBSD_REGEX -I../util' \ 
        LDFLAGS='-s' LIBS='' 
gcc -s -o fortune fortune.o 
ld: warning: option -s is obsolete and being ignored 
Undefined symbols for architecture x86_64: 
    "_re_comp", referenced from: 
     _getargs in fortune.o 
    "_re_exec", referenced from: 
     _matches_in_list in fortune.o 
ld: symbol(s) not found for architecture x86_64 
collect2: ld returned 1 exit status 
make[1]: *** [fortune] Error 1 
make: *** [fortune-bin] Error 2 

我得到同样的错误,如果我尝试建立在x86主机:

terences-imac:fortune-mod-9708 MAU$ make host=x86 
cd fortune && make CC='gcc' \ 
        CFLAGS='-O2 -DFORTDIR="\"/usr/local/share/games/fortunes\"" -DOFFDIR="\"/usr/local/share/games/fortunes/off\"" -Wall -fomit-frame-pointer -pipe -DHAVE_REGEX_H -DBSD_REGEX -I../util' \ 
        LDFLAGS='-s' LIBS='' 
gcc -s -o fortune fortune.o 
ld: warning: option -s is obsolete and being ignored 
Undefined symbols for architecture x86_64: 
    "_re_comp", referenced from: 
     _getargs in fortune.o 
    "_re_exec", referenced from: 
     _matches_in_list in fortune.o 
ld: symbol(s) not found for architecture x86_64 
collect2: ld returned 1 exit status 
make[1]: *** [fortune] Error 1 
make: *** [fortune-bin] Error 2` 
+0

编译什么?它是什么”?一个操作系统?应用程序?你在编译什么设备?你的问题非常模糊。 – Coder404

+1

你想要编译什么? – Renan

+4

我意识到这不是最大的问题,但它几乎在每一行都会说“财富” –

回答

0

这这就是为什么当人们抱怨自动工具时,你应该忽略它们。请记住,自动工具适用于用户,而不适用于维护人员

您不指定您正在构建的操作系统。但是,缺少的符号与正则表达式解析相关,并且在您正在设置的生成文件中为-DBSD_REGEX。如果你不在可能成为问题一部分的BSD系统上。

如果您使用的GNU/Linux,然后看​​手册页,我把它推荐:

#define _REGEX_RE_COMP 

所以你不妨尝试加入-D_REGEX_RE_COMP您编译行。

+0

这对我来说并不意味着什么,WRT你的问题。 – MadScientist

+0

我正在使用BSD正则表达式。 – rake

+0

很明显,你用错误使用BSD正则表达式;这不是缺少的信息。问题是,你在BSD系统上编译?或者在其他类似GNU/Linux的系统上?您是否尝试按照我的建议添加'-D_REGEX_RE_COMP'标志?它有用吗? – MadScientist

2

显然你正在试图编译在Mac OS X,由标记“OSX”和主机名“terences的iMac”走出......

据我才知道,原来财富(ftp://metalab.unc.edu/pub/Linux/games/amusements/fortune/)是仅用于Linux。

有一些BSD端口,你可以检查:https://github.com/ArrantSquid/Fortune-OSX这是为我工作在OSX 10.9(铛和所有)

+0

我有点猜到了。但是,然后生成文件提到了BSD正则表达式,我认为如果它在其他* BSD上工作,它将在Mac上工作。 – rake