title: armadillo C++ matrix library -- how to enable use of ATLAS or LAPACK?
body: <p>When i compile example2.cpp with armadillo makefile and run it i am getting an error message</p>
  
  <pre><code>error: det(): use of ATLAS or LAPACK needs to be enabled
  </code></pre>
  
  <p>How do i fix that? I have similar errors when i try to use solve. Details of my setup are:</p>
  
  <ul>
  <li>Ubuntu Lucid Lynx 10.04</li>
  <li>Armadillo version: 2.4.2 (Loco Lounge Lizard)</li>
  <li>ATLAS 3.9.51</li>
  <li>BOOST 1.48.0</li>
  <li>g++ (Ubuntu 4.4.3-4ubuntu5.1) 4.4.3</li>
  </ul>
  
  <p>Atlas was installed before armadillo was, armadillo installation was configured with Cmake. I am far from an expert in cmake, but i thought that it was supposed to find ATLAS when i generated makefiles with it. Armadillo documentation seem to say that if i install with cmake i don't need to do any manual enabling of ATLAS. I tried to manually hack example2.cpp by inserting</p>
  
  <pre><code>#define ARMA_USE_ATLAS
  </code></pre>
  
  <p>before the headers, but it just generates a bunch of errors regarding missing stuff on Cblas. Maybe there is a step missing to allow cmake to find ATLAS. It feels i am missing something simple but key. Any help would be greatly appreciated.</p>
  
  <h2>Additional Detail:</h2>
  
  <p>Edit: for whatever reason i cannot add comment anymore, so i am posting a reply to @Appleman1234 answer below here. </p>
  
  <p>I compiled armadillo and ATLAS from source. I thought that ATLAS has LAPACK and BLAS bundled in and optimized. When i compiled it, i passed a location to lapack tar like </p>
  
  <pre><code>./configure --shared --with-netlib-lapack-tarfile=/&lt;path&gt;/lapack-3.3.1.tgz
  </code></pre>
  
  <p>I also see in atlas lib directory the following files: </p>
  
  <pre><code>libatlas.a, libcblas.a, libf77blas.a, liblapack.a, libptcblas.a, libptf77blas.a libsatlas.so, libtatlas.so
  </code></pre>
  
  <p>which seem to indicate that blas, cblas, and lapack are installed on the system. However, CMakeCache.txt in armadillo seem to indicate that cmake didn't find BLAS, CBLAS, CLAPACK as follows</p>
  
  <pre><code>BLAS_LIBRARY:FILEPATH=BLAS_LIBRARY-NOTFOUND
  </code></pre>
  
  <p>There is no notion of ATLAS in CMakeCache.txt, so i assume that it wasn't found either. Maybe i am mistaken, but it seems that i somehow need to point cmake to ATLAS, i just don't know how. I could also be at error assuming that ATLAS has BLAS, LAPACK and CBLAS. I thought i compiled them as a part of ATLAS, but i could be wrong. Would appreciate your comments.</p>
  
  <h2>Solution to the problem:</h2>
  
  <p>What Dirk suggested almost worked. The problem as i mentioned in one of the replies to his post was cmake was balking. I misdiagnosed that as a problem with cmake not finding clapack. In fact, after looking more carefully at cmake output i realised it had problems with not finding good compiler or rather dragging its feet when it decided to use  as compiler /usr/bin/c++. So i did CXX=g++ and then cmake again which worked fine. After that armadillo compiled fine. </p>