Search code examples
cmakepermissionsinstallationarmadillo

Installing Armadillo without root permission


I've been trying to install the C++ armadillo library in a cluster environment for which I don't have neither root nor sudo privileges. So far, I haven't had much success. Following some system admin basic guidelines, the armadillo README file and the instructions provided here, I've arrived to what I understand it is the installation part:

"cmake . -DCMAKE_INSTALL_PREFIX:PATH=<desired directory>

In "desired directory", I've introduced the folder where my codes are located.

Then I did

make

and

make install

and went back to the directory where I had installed armadillo. I tried compiling my code and got the message: "error: armadillo: No such file or directory" My assumption was that the system was simply not seeing the library at all. I was then advised by system admin to change the $LD_LIBRARY_PATH in order for the compiler to know where to look. I proceeded to do so by:

export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:<desired directory>

only to get the same error again. ("desired directory" is the directory where my codes and library live).

I suspect I might be making some very basic mistake, but that's my first time trying to solve such problems. Therefore, I'd appreciate any help and would be thankful for your patience.


Solution

  • Based on the Questions page from the Armadillo website, one approach is to simply use the -I option to gcc or clang. If you have unpacked armadillo in /home/sergio, the following should do the trick:

    g++ prog.cpp -o prog -O2 -I /home/sergio/armadillo-9.100.5/include -DARMA_DONT_USE_WRAPPER -lopenblas -llapack
    

    Change the -lopenblas to -lblas if the machine that you are using doesn't have OpenBLAS installed. (OpenBLAS is a fast version of BLAS).