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…