otool is referencing an old version of libffi

262 views Asked by At

I'm trying to compile an R package (which compiles in Linux) on Mac OS 10.15.7.

I'm getting a weird problem right at the end of the installation, related to llvm-objdump-mp-7.0 referencing /opt/local/bin/libffi.7.dylib.

The problem seems to be with my Xcode/homebrew toolsets somehow being out of sync.

I can generate the problem with

$otool --version
llvm-otool(1): Apple Inc. version cctools-921
dyld: Library not loaded: /opt/local/lib/libffi.7.dylib
  Referenced from: /opt/local/libexec/llvm-7.0/lib/libLLVM.dylib
  Reason: image not found
fatal error: otool: fatal error in /opt/local/bin/llvm-objdump-mp-7.0

However,

$ ls /opt/local/lib/libffi*
/opt/local/lib/libffi.8.dylib   /opt/local/lib/libffi.dylib
/opt/local/lib/libffi.a

I've run brew update followed by brew upgrade and brew reinstall libffi and brew reinstall llvm

I've upgraded my Xcode to 12.4, as well as installing the command line tools.

What am I missing?

1

There are 1 answers

0
ralmond On BEST ANSWER

I must have previously installed an older version of llvm which put its commands in /usr/local/bin, which then masked the system version of /usr/bin/otool.

The current llvm formula puts the updated tools in /usr/local/opt/llvm/bin so as to not mask the Xcode versions. However, the older versions were still living in /usr/local/bin.

The following commands seemed to fix me.

sudo rm /opt/local/bin/otool
sudo rm /opt/local/bin/llvm-otool
sudo rm /opt/local/bin/*-mp-7.0

otools is now properly finding the Xcode version, so I'm up and running again.