Undefined Armadillo LAPACK Wrapper Link

I have a question regarding the use of Armadillo.

I am using Ubuntu 12.10 and the gcc compiler in Code :: Blocks. I installed LAPACK and BLAS using the synaptic package manager. I also once installed Armadillo using the synaptic package manager once manually using CMake. CMake discovered the LAPACK and BLAS libraries when creating configurations for compiling armadillos. In addition, I linked the BLAS and LAPACK libraries in Code :: Blocks under “Build Options” → “Linker”.

However, when I want to create my project, I get an error message:

In function `void arma::lapack::getrf<double>(int*, int*, double*, int*, int*, int*)':| /usr/include/armadillo_bits/lapack_wrapper.hpp|41|undefined reference to `wrapper_dgetrf_'| 

This means that the armadillo cannot find LAPACK, but what did I do wrong?

I also tore the corresponding lines in the armadillo_bits / config.hpp file so that it looked like this:

  #if !defined(ARMA_USE_LAPACK) //#define ARMA_USE_LAPACK //// Uncomment the above line if you have LAPACK or a high-speed replacement for LAPACK, //// such as Intel MKL, AMD ACML, or the Accelerate framework. //// LAPACK is required for matrix decompositions (eg. SVD) and matrix inverse. #endif #if !defined(ARMA_USE_BLAS) //#define ARMA_USE_BLAS //// Uncomment the above line if you have BLAS or a high-speed replacement for BLAS, //// such as OpenBLAS, GotoBLAS, Intel MKL, AMD ACML, or the Accelerate framework. //// BLAS is used for matrix multiplication. //// Without BLAS, matrix multiplication will still work, but might be slower. #endif /* #undef ARMA_USE_WRAPPER */ //// Comment out the above line if you're getting linking errors when compiling your programs, //// or if you prefer to directly link with LAPACK and/or BLAS. //// You will then need to link your programs directly with -llapack -lblas instead of -larmadillo 

The error occurs when I try to set up a matrix with integers, therefore

  Mat<int> element_nodes; 

I would be grateful for the helpful answers. I searched the internet for several hours. Also, if you need more source code, let me know.

+5
source share
3 answers

It looks like you have two copies of Armadillo installed that have different configurations. If in doubt, connect your programs with:

g ++ prog.cpp -o prog -O2 -larmadillo -llapack -lblas

You can also take a look at Armadillo Frequently Asked Questions and fooobar.com/questions/1485772 / ....

0
source

I guess you haven't uncommented the definition line yet !:

if! defined (ARMA_USE_LAPACK)

 //#define ARMA_USE_LAPACK ^^ || 

Here

0
source

If you used the blas and lapack library files from the downloaded armadillo package, maybe they don’t work because in the ReadMe file he said that they belong to a third party, so I downloaded from other sources and then compiled a fine

0
source

Source: https://habr.com/ru/post/1485770/


All Articles