0

When running a python "case" file for a computational/simulation program (used in research) via the command line on my MacBook (Big Sur 11.5) I get the following error:

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

(1) I don't know how to interpret what this means and would love an explanation. (2) I would appreciate input on how to troubleshoot this problem. Please note the problem is 100% not in my case file or the software. It has to be a problem with how I've set up things on my Mac.

Since my experience with running programs via the command line is limited, and my Fortran experience nonexistent, please don't assume very much prior knowledge on my part. I truly want a "for dummies" explanation.

The program I'm running has several dependencies, which according to the developer are:

  • Python 3
  • numpy
  • scipy (only needed for additional utilities, postprocessor)
  • matplotlib (only needed for additional utilities)
  • GNU C (gcc/g++) and Fortran (gfortran) compilers (development headers must be present)
  • Xcode and developer tools (OpenMPI support requires that Fortran-compatible libraries be built)

I've done my best to install up-to-date versions of all of the above. But honestly, some of the guides and stackoverflow conversations for working through this stuff is totally Greek to me. Particularly this stuff:

  • "Development headers must be present" NO idea at all what that means.
  • "OpenMPI support requires Fortran-compatible libraries be built" Again, not sure what that directive indicates I need to do.

I'm running the following versions of things:

  • GNU Fortran/GCC: Homebrew GCC 11.3.0
  • Python: 3.9.13
  • Open MPI: 4.1.4
n_bandit
  • 101
  • 4
  • 1
    Regarding 1, did you read https://stackoverflow.com/questions/66855252/what-is-an-undefined-reference-unresolved-external-symbol-error-and-how-do-i-fix ? I have already asked you for the exact command that produced the error. It really is necessary. Try to include the complete output or log of your build script *including any compiler or linker calls* so that we see what exactly was called. – Vladimir F Героям слава Jun 06 '22 at 05:53
  • The for dummies explanation is that there is *some* command that tries to link the libm library and cannot find it. To tell you anything more, we have to know *which* command it is and in what environment it is executed. – Vladimir F Героям слава Jun 06 '22 at 08:46
  • 1
    In you last question https://stackoverflow.com/questions/72467901/trying-get-open-mpi-to-play-nicely-with-fortran-on-os-x we do have a more complete output and some script, but the crucial information is missing. The script is too high-level. It calls other scripts. We need to know what is the ultimate command that causes the error message. – Vladimir F Героям слава Jun 06 '22 at 11:48
  • 1
    Please understand that this is not just a matter of installing a missing library. The libm library is an integral part of the C standard library. So it is probably the matter of installing or configuring your compiler correctly. This is why the actual details are necessary. – Vladimir F Героям слава Jun 06 '22 at 11:52

1 Answers1

0

I experienced the same issue after upgrading to MacOS Ventura this past week. I have found the issue was with the compatibility of the Xcode Command Line Tools, and it worked for me after installing the most recent version of the Command Line Tools.