Skip to content

How to Install Armadillo

K M Masum Habib edited this page Oct 6, 2016 · 1 revision

Given below are the steps for installing armadillo.

On Linux or Mac OS X

1. Download armadillo from armadillo download page to your home folder using:

#!bash
wget http://sourceforge.net/projects/arma/files/armadillo-x.yyy.z.tar.gz

2. Extract the source:

#!bash
tar -xvf armadillo-x.yyy.z.tar.gz

3. Change to the source directory:

#!bash
cd armadillo-x.yyy.z

4. Configure and compile:

#!bash
./configure
make

5. Install:

  • If you have root access, run as root (installs in /usr/local):
#!bash
make install
  • If you have sudo access (installs in /usr/local):
#!bash
sudo make install
  • If you do not have either of the above (installs in $HOME/):
#!bash
cmake -DCMAKE_INSTALL_PREFIX:PATH=~ .
make install

For armadillo-4.xyz.n

Change options in CMakeLists.txt:

set(ARMA_USE_WRAPPER   true )
option(BUILD_SHARED_LIBS "build dynamically linked library" ON)
set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})

If these do not work, turn the ARMA_USE_WRAPPER to false (use the below line instead of three lines above).

set(ARMA_USE_WRAPPER   false)

Then Uncomment #define ARMA_USE_CXX11 in include/armadillo_bits/config.hpp file.

For MKL library >= 10.x, in cmake_aux/Modules/ARMA_FindMKL.cmake, add

SET(MKL_NAMES ${MKL_NAMES} mkl_rt)

Compile and install:

#!bash
cmake .    
make     
make install DESTDIR=~