Hi,

I am not sure whether it helps, but I want to point out that libm is the math library which is on Linux usually GLIBC and I assume on OS X it is provided by the OS vendor.

Additionally, that libm is linked dynamically.

This seems to be a OS X issue – and I have no idea about OS X, but I found the following:

https://github.com/fxcoudert/gfortran-for-macOS/issues/12

which suggests that there is a mismatch of the XCode / MacOS X SDK version.

As work around, it seems to work to set MACOSX_DEPLOYMENT_TARGET and/or to ensure that you have the same xcode version as the one used by gfortran, e.g. by "xcode-select --install".

In some other thread, the suggestion was to use -L/usr/lib but I assume that won't help. Looking at https://github.com/xianyi/OpenBLAS/issues/3032 – it seems as if you can use 'gfortran -v taxsim.for' to see the SDK version used when building GCC.

At least that example had some |string like:
||-syslibroot /Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk/|

|If you had installed 11.0 instead, ||MACOSX_DEPLOYMENT_TARGET=11.0 would work.|

|I hope it helps. If not, you need to find someone else as I have no idea about OS X.|

|Good luck!|

|Tobias
|

On 19.03.21 21:22, Daniel Feenberg via Fortran wrote:

Is there a way to make a statically linked binary with fortran in OS
X? For much of the past year I have been using:

      gfortran taxsim.for -static-libgfortran -static-libgcc

but since January I only get the error message;

      ld: library not found for -lm.
      collect2: error: ld returned 1 exit status?

This is OS X 11,2,3 Big Sur and fortran version 6.3.0. I need static
linking because my users are not developers and do not have Xcode or
gcc installed. This is free software.  I have seen postings from 2015
suggesting that I rename libquadmath.0.dylib, which I did try but
which did not help.

Of course I have no need for lquad precision variables, which I
understand is the source of the problem.

Daniel Feenberg
NBER

Reply via email to