Search code examples
c++armadillo

Error while generating the run-time armadillo library on ubuntu16.04


According to the Linux and macOS: Installation guide for Armadillo, on Debian machine(ubuntu-16.04) I was trying for installing the armadillo library and after executing the command : $cmake . The full stop separated from "cmake" by a space is important. I executed the command : $ make (also tried with root privileges still), the following error was thrown.

piyush@ubuntu:~/armadillo$ sudo make
Scanning dependencies of target armadillo
[ 33%] Building CXX object CMakeFiles/armadillo.dir/src/wrapper1.cpp.o
[ 66%] Building CXX object CMakeFiles/armadillo.dir/src/wrapper2.cpp.o
[100%] Linking CXX shared library libarmadillo.so
/usr/bin/ld: /usr/local/lib/libsuperlu.a(util.c.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libsuperlu.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
CMakeFiles/armadillo.dir/build.make:123: recipe for target 'libarmadillo.so.9.800.2' failed
make[2]: *** [libarmadillo.so.9.800.2] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/armadillo.dir/all' failed
make[1]: *** [CMakeFiles/armadillo.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2

Solution

  • This library is available in Ubuntu. Just do

    sudo apt install libarmadillo-dev
    

    P.S. Never run sudo make, it's a very bad practice.