user111283
user111283

Reputation: 51

Problem with gfortran: unable to obtain libquadmath for Mac Big Sur

I recently bought the MacBook Air with M1 processor and Big Sur as OS.

I am trying to build a library which requires gcc and gfortran. I did not have gfotran, so I run a

brew install gcc

which led to the following libraries under the home-brew installing path (/opt/homebrew/Cellar):

list of libraries downloaded with gcc

However I cannot find the libquadmath.dylib. I also tried to download this gfortran experimental release for ARM Big Sur

I cannot seem to be able to have the libquadmath.dylib.

Upvotes: 5

Views: 3747

Answers (3)

First, I look for libquadmath path using this command:

LIBQUADMATH := $(shell $(FLINK) -print-file-name=libquadmath.a)

And I use this variable to set static flag value dynamically:

STATIC_FLAG = -static-libgfortran -static-libgcc -lgfortran -lgcc -lSystem -Wl,-no_compact_unwind $(LIBQUADMATH)

Upvotes: 0

windey1988
windey1988

Reputation: 1

cp /usr/local/lib/gcc/12/libquadmath.0.dylib /Users/***/opt/anaconda3/lib/python3.9/site-packages/torch/lib

solve my problem.

Upvotes: 0

Moritz Makowski
Moritz Makowski

Reputation: 382

I am running an Intel Mac on MacOS Big Sur and I had the same issue.

Apparently all gfortran libraries are stored inside the gcc directory (or Cellar if you are using Homebrew).

For me the issue was that /usr/local/gfortran/lib/libquadmath.0.dylib was missing even though all gfortran dependencies were installed inside the gcc directory.

Using locate libquadmath.0.dylib I could find all files with that name on my system. The first time you run locate it will take a while and will generate a search index in the background.

I found that /usr/local/lib/gcc/11/libquadmath.0.dylib exists and I could just add a link to the existing files:

ln /usr/local/lib/gcc/11/libquadmath.0.dylib /usr/local/gfortran/lib/libquadmath.0.dylib

Before being able to create the link I had to create the directory /usr/local/gfortran/lib/.

Upvotes: 3

Related Questions