title: Error in linking gfortran to LAPACK and BLAS
body: <p>I have installed LAPACK and BLAS from Synaptic package manager in Ubuntu. </p>
  
  <pre><code>whereis libblas
  libblas: /usr/lib/libblas.so /usr/lib/libblas.a /usr/lib/libblas
  
  whereis liblapack
  liblapack: /usr/lib/liblapack.a /usr/lib/liblapack.so
  </code></pre>
  
  <p>When I try to compile the <a href="http://faculty.washington.edu/rjl/uwamath583s11/sphinx/_build/html/lapack_examples.html" rel="noreferrer">randomsys1 example</a> with <code>gfortran</code> I get the following error messages.</p>
  
  <pre><code>gfortran randomsys1.f90 -L/usr/lib/lapack -llapack -L/usr/lib/libblas -lblas
  /tmp/cclwtifh.o: In function `MAIN__':
  randomsys1.f90:(.text+0x12): undefined reference to `init_random_seed_'
  collect2: error: ld returned 1 exit status
  </code></pre>
  
  <p>or</p>
  
  <pre><code>gfortran randomsys1.f90 -llapack -lblas
  /tmp/ccB1isEC.o: In function `MAIN__':
  randomsys1.f90:(.text+0x12): undefined reference to `init_random_seed_'
  collect2: error: ld returned 1 exit status
  </code></pre>
  
  <p>As per my understanding, it is the recommended way to link <code>gfortran</code> with <code>lapack</code> and <code>blas</code> (kindly refer to <a href="https://stackoverflow.com/questions/20669410/gfortran-lapack-undefined-reference-error?answertab=active#tab-top">gfortran LAPACK “undefined reference” error</a>). Thanks in advance for pointing out the correct way to compile the <code>fortran</code> code using <code>gfortran</code>. </p>