title: GFortran error: ld: library not found for -lSystem when trying to compile
body: <p>I am getting a strange error when trying to compile a simple fortran-90 file using gfortran. I am working on a macOS mojave system. I have gfortran 8.2.0 installed and I checked to be sure of this by doing the following:</p>
  
  <pre><code>Input: gfortran --version
  Output: GNU Fortran (GCC) 8.2.0
  Copyright (C) 2018 Free Software Foundation, Inc.
  This is free software; see the source for copying conditions.  
  There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A 
  PARTICULAR PURPOSE.
  </code></pre>
  
  <p>Which indicates that gfortran installed correctly and I also confirmed this by typing simply: gfortran, into the terminal, which returns:</p>
  
  <pre><code>gfortran: fatal error: no input files
  compilation terminated.
  </code></pre>
  
  <p>However, when I try to compile my file like so:</p>
  
  <pre><code>gfortran hello.f90 -o hello.x
  </code></pre>
  
  <p>I get an error which reads: </p>
  
  <pre><code>ld: library not found for -lSystem
  collect2: error: ld returned 1 exit status
  </code></pre>
  
  <p>I've tried compiling in different ways and I also tried setting the LD_LIBRARY_PATH in .bash_profile as described by <a href="https://gcc.gnu.org/wiki/GFortranBinaries32Linux" rel="noreferrer">https://gcc.gnu.org/wiki/GFortranBinaries32Linux</a> but I still get the same error. The gfortran directory has the pathname: /usr/local/gfortran, however another gfortran which is not a directory can be found in /usr/local/bin </p>
  
  <p>Typing:</p>
  
  <pre><code>which gfortran
  </code></pre>
  
  <p>Outputs:</p>
  
  <pre><code>/usr/local/bin/gfortran
  </code></pre>
  
  <p>And a long list search of this directory:</p>
  
  <pre><code>Input: ls -l /usr/local/bin/gfortran
  Output: lrwxr-xr-x  1 root  wheel  32 15 May 14:07 
  /usr/local/bin/gfortran -&gt; /usr/local/gfortran/bin/gfortran
  </code></pre>
  
  <p>How can I fix this where everything seems to be correctly installed?</p>
  
  <p>Any help would be greatly appreciated!</p>