title: Linking Intel's MKL (BLAS & LAPACK) to GCC
body: <p>I am trying to compile a giant software package, and this is the last hurdle I can't seem to figure out.</p>
  
  <p>I'm getting errors like:</p>
  
  <pre><code>RNDiracDeterminantBase.cpp:(.text+0x22bf): undefined reference to `dgetrf_'
  RNDiracDeterminantBase.cpp:(.text+0x2524): undefined reference to `dgetri_'
  RNDiracDeterminantBase.cpp:(.text+0x3005): undefined reference to `dgetri_'
  ../../lib/libqmcwfs.a(RNDiracDeterminantBase.cpp.o): In function `qmcplusplus::RNDiracDeterminantBase::ratio(qmcplusplus::ParticleSet&amp;, int, qmcplusplus::ParticleAttrib&lt;qmcplusplus::TinyVector&lt;double, 3u&gt; &gt;&amp;, qmcplusplus::ParticleAttrib&lt;double&gt;&amp;)':
  RNDiracDeterminantBase.cpp:(.text+0x4156): undefined reference to `dgemv_'
  RNDiracDeterminantBase.cpp:(.text+0x420f): undefined reference to `dger_'
  </code></pre>
  
  <p>Google reveals that these references are to Intel's MKL library.  However, I don't know what file I need to link.  I've tried libmkl_core.a, libmkl_gnu_thread.a, libmkl_blacs_intelmpi_lp64.a, etc.  There's tons of files in:</p>
  
  <p>/mkl/lib/intel64/</p>
  
  <p>Can post more information if requested.</p>