I have a macbook pro late 2019 (Intel), running with Mac OS 12.1. I cannot compile Fortran code using gfortran, configured using brew, since I get this error at link time:
$ gfortran whatever-fortran-program.f90
ld: library not found for -lSystem
collect2: error: ld returned 1 exit status
ld: file not found: /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation for architecture x86_64
collect2: error: ld returned 1 exit status
Has anyone experienced this issue and know how to circumvent it? Thanks!
PS: I know I can install other compilers on Mac OS, but I want gfortran since I want to use the OpenMPI build in brew.
I fixed that by reinstalling CommandLineTools from the developer account on Apple’s website. I believe Xcode doesn’t properly upgrade CommandLineTools.
As @mhulsen stated - I don’t think Apple upgrades the command line tools unfortunately, so things just break occasionally and unexpectedly by the looks of it…
Hi, wiremoons. Thanks for the tips. Unfortunately, they did not work for me while using gfortran on Mac OS Ventura. I even installed directly from the binaries provided by Apple here
I was able to get co-array fortran to install, compile, and run on an M2 Mac running Ventura. The steps were;
Install all updates
install Xcode
install command line tools
install brew
brew install emacs coarray
Make sure path leads to correct compiler.
Oddly, this was almost the same steps to get everything working from Windows Subsystem for Linux;
Install WSL v2
apt update
install brew
brew emacs coarray
Make sure path leads to correct compiler.
After that everything was working on either platform. Now only if I had good projects to work on!..
Did you take a look at this link? Perhaps you can collaborate with @certik on coarray parallel solutions to that effort, or with more detailed variations than fastGPT?
I have not yet used the Ventura OS, but on earlier MacOS versions it is not necessary to install Xcode in order to get brew, gfortran, ifort, etc. to work. It is only the command line tool installation that is necessary. Xcode is about 40GB now, so it requires a lot of disk space and a lot of network bandwidth to install and keep up to date. The nice thing about Xcode is that it includes all the libraries to compile codes for Apple Macs, tablets, watches, phones, and home entertainment. But if you are only interested in software development on Macs, then you have the option to skip the other stuff.