0

我在 x86_64 机器上。我正在尝试fortune使用它的 makefile 构建,但我收到有关缺少符号的错误:

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`
4

3 回答 3

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(clang 和所有)上为我工作

于 2014-01-21T16:02:47.200 回答
0

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

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

如果您使用的是 GNU/Linux,那么查看re_comp手册页,我看到它建议:

#define _REGEX_RE_COMP

所以你可以尝试添加-D_REGEX_RE_COMP到你的编译行。

于 2013-05-30T23:45:21.230 回答
0

目前在 github 上有一个 Mac 端口的 fork,它已适应编译为 64 位。

https://github.com/tristanmorgan/Fortune-OSX/tree/sixty-four-bit

于 2020-09-06T08:28:55.030 回答