【发布时间】:2018-04-14 22:39:21
【问题描述】:
我正在 OS X 上进行测试。我们有 configure.ac 和 Makefile.am。 Autotools 为平台选择了错误的AR 和ARFLAGS。在Makefile.am 中有(和没有)AM_PROG_AR 会发生这种情况:
$ egrep 'AR =|ARFLAGS =' Makefile
AMTAR = $${TAR-tar}
AR = ar
ac_ct_AR = ar
Autoconf 应该使用 Apple 的 libtool(不要混淆 Autotools 的 libtool)和 libtool 的标志。 Apple 的libtool 可以正确处理胖库和交叉编译。应该是something like:
AR = /usr/bin/libtool
ARFLAGS = -static -o
Apple 的Porting UNIX/Linux Applications to OS X 没有讨论这个话题,我在 Autoconf 文档中找不到它。 Autoconf 文档也缺少AC_PROG_AR(或类似的)。请参阅 Autoconf 手册中的5.2.1 Particular Program Checks。
我们如何告诉 Autoconf 使用 Apple 的平台构建工具,而不是 Linux 构建工具?
$ autoconf --version
autoconf (GNU Autoconf) 2.69
$ automake --version
automake (GNU automake) 1.15.1
【问题讨论】:
-
你在
configure.ac中使用AM_PROG_AR吗? -
我认为您需要在配置命令行中指定您的首选选项:
./configure AR=/usr/bin/libtool ARFLAGS="-static -o"。然后,您可能会覆盖脚本自己确定的内容。 -
谢谢乔纳森。运行
AR=/usr/bin/libtool ARFLAGS='-static -o' ./configure过早死亡。消息是checking the archiver (/usr/bin/libtool) interface... unknown,然后是configure: error: could not determine /usr/bin/libtool interface。这就是我们一直试图在脚本中修复它的原因。 -
在 2019 年 2 月在 MacOS Mojave 上安装 OpenFST 时仍然发生。有什么解决办法吗?
标签: autotools autoconf unix-ar