title: Use MKL to build .so and dyn.load in R
body: <p>I am stuck in making shared object with MKL and dyn.load it in R. 
  The FORTRAN testing code is </p>
  
  <pre><code>SUBROUTINE invf_Rf(XX,iXX,n)
      implicit none
      double precision, dimension(:,:) ::  XX(n,n),iXX(n,n)
      integer n,INFO
      iXX=XX
      call DPOTRF( 'U',n , iXX,n,INFO)
  
      call DPOTRI( 'U',n , iXX,n,INFO)
  
  end SUBROUTINE
  </code></pre>
  
  <p>And I use the MKL link advisor to complied it, the makevars file is:</p>
  
  <pre><code>PKG_LIBS= $(FLIBS)  -L${MKLROOT}/lib/intel64 -Wl,--no-as-needed -lmkl_gf_ilp64 -lmkl_gnu_thread -lmkl_core -lgomp -lpthread -lm -ldl  -fdefault-integer-8 -m64 -I${MKLROOT}/include -I/opt/intel/mkl/lib/intel64
  </code></pre>
  
  <p>when I load it in R and use it, the debug error is:</p>
  
  <pre><code>Intel MKL FATAL ERROR: Cannot load libmkl_avx2.so or libmkl_def.so.
  [Inferior 1 (process 13619) exited with code 02]
  </code></pre>
  
  <p>Thanks for helping!!</p>