otool is referencing an old version of libffi - llvm

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?

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.

Related

Strange Output from cask command

Today I installed cask via homebrew on my M1 Mac Mini, and wanted to check the version of cask that I had installed. I was not fully sure of the command to complete this, so I tried
cask --version
This gave me a long readout where there were several processes of compiling things in my directory. This may be a dumb question but did I do something that I was not intending to?
cask --version, as part of Homebrew/brew, was deprecated in Oct. 2018
Now, only brew --version should be enough.

FFTW Error "Symbol not found: _ompi_mpi_char" when running executable

I'm on macOS Catalina (10.15.7) and I have FFTW installed using brew install fftw. Up until today, I was able to run an executable which required FFTW. I have no idea why it just stopped working today and gave me the following error.
dyld: Symbol not found: _ompi_mpi_char
Referenced from: /usr/local/opt/fftw/lib/libfftw3_mpi.3.dylib
Expected in: flat namespace
in /usr/local/opt/fftw/lib/libfftw3_mpi.3.dylib
zsh: abort ./cartogram -h
I've tried everything from uninstalling and reinstalling all my brew packages and git cloning a fresh repo from GitHub but it doesn't work despite it working for my friend when he freshly clones the repo from GitHub. My suspicion is that it has something to do with my "macOS Catalina 10.15.7 Update" 2 days ago, which is 1 day after I last successfully ran my executable.
Any help is appreciated, thank you.
I think it might be due to the formula's flag --enable-openmp. I have tried to compile FFTW 3.3.10 myself using the following command to configure:
./configure --enable-threads --enable-shared --disable-debug --disable-dependency-tracking --enable-avx2
and then
make && make install

Installing gcc on linux

How to install gcc version 4.8 on centos or scientific linux operating systems which require yum for installing.
I tried to download gcc from https://ftp.gnu.org/gnu/gcc/gcc-4.8.2/ and then ran ./configure and then make. After running make it gives me the error: configure: error: cannot compute suffix of object files: cannot compile
See `config.log' for more details.
Is there some way by which I may install gcc version 4.8 on linux using yum install
I tried:
1). I tried with yum --enablerepo=testing-2-devtools-6 install devtoolset-2-gcc devtoolset-2-gcc-c++ it gives me repository not found
2). yum group install "Development Tools". It gives me Package gcc-4.4.7-11.el6.x86_64 already installed and latest version
3). building it from scratch, you'll have to do ./contrib/download_prerequisites first to get MPFR, GMP and MPC in the GCC source tree, then make a separate directory and run /path/to/gcc/source/configure.
It gives:
configure: error: building out of tree but /home/Softwares/gcc-4.8.2
contains host-x86_64-unknown-linux-gnu
https://access.redhat.com/documentation/en-US/Red_Hat_Developer_Toolset/3/html/3.0_Release_Notes/DTS3.0_Release.html#Features
Install the Red Hat Developer Toolset 3.0 (or 2.X) in a way similar to what is described here. (Basically you use a repo someone else built for CentOS).
Google says to try
yum group install "Development Tools"
check out: http://www.cyberciti.biz/faq/centos-rhel-7-redhat-linux-install-gcc-compiler-development-tools/

Error with homebrew + opencv + libpng

On Mac OS Maverick I have installed OpenCV with a brew install opencv.
I created a simple program (copied from this tutorial). Compilation worked fine but when running the executable I get the following error:
dyld: Library not loaded: /usr/local/lib/libpng16.16.dylib
Referenced from: /usr/local/lib/libopencv_highgui.2.4.dylib
Reason: Incompatible library version: libopencv_highgui.2.4.dylib requires version 33.0.0 or later, but libpng16.16.dylib provides version 32.0.0
Trace/BPT trap: 5
I checked that libpngwas properly installed via brew install libpng and ran a brew upgrade to make sure everything was up-to-date.
Running locate libpng16.dylib returns:
/Applications/GIMP.app/Contents/Resources/lib/libpng16.16.dylib
/usr/local/Cellar/libpng/1.6.10/lib/libpng16.16.dylib
/usr/local/Cellar/libpng/1.6.12/lib/libpng16.16.dylib
/usr/local/Cellar/libpng/1.6.13/lib/libpng16.16.dylib
/usr/local/Cellar/libpng/1.6.15/lib/libpng16.16.dylib
/usr/local/lib/libpng16.16.dylib
Any idea?
The best solution is to fully uninstall libpng and re-install it:
$ sudo brew uninstall libpng
$ sudo rm '/usr/local/bin/libpng-config'
$ for i in `brew link --overwrite --dry-run libpng`; do sudo rm $i; done
$ sudo brew install libpng
If you need to install opencv:
$ sudo brew tap homebrew/science
$ sudo brew install opencv
Homebrew should ensure that you the correct dependencies install. However, it's possible that you have more than one version of libpng16 installed at different paths. Have a look in...
/usr/lib
/opt/local/lib
If you find any versions of the library in these locations then they may be causing the wrong one to be loaded when your program starts. As a quick fix you can try typing DYLD_LIBRARY_PATH=/usr/local/lib before your program name on the command line. In the longer term you may need to remove the conflicting versions altogether.
This answer is for OSX users who installed through Conda, more specifically the conda-forge channel (I'm not sure about others).
Conda ends up installing its own libpng in the environment and you can update it with conda upgrade libpng.
I guess this is basically a bug with the opencv recipe on conda-forge.

Compiler Not Found

I am getting this error when i tried to compile my program
-bash: g++: command not found
Also I have only been getting this error after I formatted my Mac Book Pro
This error came after I did this
g++ functions.cpp
Please help me.
Thank You
Here is a cleanest solution than installing XCode just for Gcc.
STEP 1 > install this:
[HomeBrew Web Site] (http://brew.sh/)
All the informations concerning the installation and the utility of such a program are on the site itself.
It's a package manager, but for Mac. It's like apt-get or yaourt, if you ever used Ubuntu or Arch Linux.
STEP 2 > Go to the Terminal application and type :
$> homebrew search gcc
Then choose from the version you want, and type again in Terminal:
$> homebrew install [choosen version]
Gcc is now installed.