我用的是x86_64机器。我试图使用它的makefile来构建fortune,但是我得到了一个关于缺少符号的错误:
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`发布于 2014-01-22 00:02:47
显然,您正在尝试在Mac上编译,使用标签"osx“和主机名"terences-imac”……
据我所知,最初的财富(ftp://metalab.unc.edu/pub/Linux/games/amusements/fortune/)只针对Linux。
有一些BSD端口,你可以查看:https://github.com/ArrantSquid/Fortune-OSX,它在OSX10.9上为我工作(点击所有)
发布于 2013-05-31 07:45:21
这就是为什么,当人们抱怨汽车工具时,你应该忽略它们。记住,自动工具是为用户准备的,而不是为维护人员准备的。
您不需要指定您正在构建的操作系统。但是,缺少的符号与正则表达式解析有关,并且在makefile中设置了-DBSD_REGEX。如果您不在BSD系统上,这可能是问题的一部分。
如果您使用的是GNU/Linux,那么请查看re_comp手册页,我看到它推荐:
#define _REGEX_RE_COMP因此您可以尝试将-D_REGEX_RE_COMP添加到编译行中。
发布于 2020-09-06 16:28:55
目前在github上有一个Mac财富端口的分支,已经被改编成64位版本。
https://github.com/tristanmorgan/Fortune-OSX/tree/sixty-four-bit
https://stackoverflow.com/questions/16847476
复制相似问题