1

I am running the ./configure command before building the OpenFST package, which uses autoconf. The script fails when checking for the ar interface:

$ ./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

This seems related to this question but I can't understand how to make the script use the correct MacOS file so that configuration would work.

Nur L
  • 791
  • 7
  • 15
  • 1
    Show (at least) the portion of the resulting `config.log` file that shows the failure (i.e. starting from `checking the archiver`). Perhaps show the portion of the `configure` script that performs that check and, if you can identify it, the portion of `configure.ac` from which it was generated. – Ken Thomases Feb 09 '19 at 15:12
  • Thanks @KenThomases! Looked inside config.log which led me to the solution described here: https://github.com/commercialhaskell/stack/issues/4380 – Nur L Feb 09 '19 at 17:07

2 Answers2

3

Looking inside config.log, turns out the problem was related to using the wrong ar and wrong ranlib located in /opt/local/bin/ instead of the ones in /usr/bin.

Running this solved the issue:

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

Based on suggestion in this discussion: https://github.com/commercialhaskell/stack/issues/4380

Nur L
  • 791
  • 7
  • 15
1

Moving any system files around sounds like trouble. I suggest to do the following, which worked in my case (appveyor testing under MacOS with gcc-6/gcc-8):

# 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
Simon Sobisch
  • 6,263
  • 1
  • 18
  • 38