gfortran ld: library not found for -lSystem

Hello,

I have installed gfortran package (together with Apple Developer Tools installed, as well as "command line developer tools").

If I try to run a simple fortran code from terminal:

gfortran test.f90 -o test

I get following error:

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

I tried to google for it but did not find anything helpful. What do I need to do to get it working?

Thanks!




Accepted Answer
Instead of installing the gfortran package itself, I installed the whole gcc using homebrew:

brew install gcc


and that solved the problem.

This is a mistake! Please see the upfloord!

SORRY!
I have same problem when I update my Mac to BIg Sur. When I run my Fortran program
Code Block
ifort ***.f90

then I will get the error:
Code Block
ld: library not found for -lSystem

I have find a way solve it by using the following format

Code Block
ifort ***.f90 -L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib

but I want it to get normal, how should I do it? Changing the configuration envirament? how should I change? I'm a fresh man in MAC.
THANK YOU!
exactly what I needed!
gfortran ld: library not found for -lSystem
 
 
Q