MacOS Mojave:./configure 脚本在检查存档器 (ar) 接口时失败



我在构建使用autoconf的OpenFST包之前运行./configure命令。检查ar接口时脚本失败:

$ ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... ./install-sh -c -d
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking dependency style of gcc... gcc3
checking for ar... ar
checking the archiver (ar) interface... unknown
configure: error: could not determine ar interface

这似乎与这个问题有关,但我无法理解如何使脚本使用正确的MacOS文件,以便配置正常工作。

查看 config.log 内部,事实证明问题与使用错误的ar和位于 /opt/local/bin/ 中的错误ranlib而不是/usr/bin中的有关。

运行它解决了问题:

sudo mv /opt/local/bin/ranlib /opt/local/bin/ranlib-backup-2019-02-09
sudo mv /opt/local/bin/ar /opt/local/bin/ar-backup-2019-02-09

根据本次讨论中的建议:https://github.com/commercialhaskell/stack/issues/4380

移动任何系统文件听起来很麻烦。我建议执行以下操作,这在我的情况下有效(使用 gcc-6/gcc-8 在 MacOS 下进行应用测试(:

# work around bugs in this environment
export TMPDIR=$PREFIX/tmp  # was set to something below the user
# have a folder with the files we're interested in linked ...
mkdir -p $PREFIX/tmp/sysbin
ln -s $PREFIX/tmp/sysbin/ar /usr/bin/ar
ln -s $$PREFIX/tmp/sysbin/ranlib /usr/bin/ranlib
# and let it be used
export PATH=$PREFIX/tmp/sysbin:$PATH
../configure

相关内容

  • 没有找到相关文章

最新更新