Armadillo + BLAS + LAPACK: communication error?

When I try to compile example1.cpp that comes with Armadillo 2.4.2, I keep getting the following binding error:

/tmp/ccbnLbA0.o: In function `double arma::blas::dot<double>(unsigned int, double const*, double const*)': main.cpp:(.text._ZN4arma4blas3dotIdEET_jPKS2_S4_[double arma::blas::dot<double>(unsigned int, double const*, double const*)]+0x3b): undefined reference to `wrapper_ddot_' /tmp/ccbnLbA0.o: In function `void arma::blas::gemv<double>(char const*, int const*, int const*, double const*, double const*, int const*, double const*, int const*, double const*, double*, int const*)': main.cpp:(.text._ZN4arma4blas4gemvIdEEvPKcPKiS5_PKT_S8_S5_S8_S5_S8_PS6_S5_[void arma::blas::gemv<double>(char const*, int const*, int const*, double const*, double const*, int const*, double const*, int const*, double const*, double*, int const*)]+0x68): undefined reference to `wrapper_dgemv_' /tmp/ccbnLbA0.o: In function `void arma::blas::gemm<double>(char const*, char const*, int const*, int const*, int const*, double const*, double const*, int const*, double const*, int const*, double const*, double*, int const*)': main.cpp:(.text._ZN4arma4blas4gemmIdEEvPKcS3_PKiS5_S5_PKT_S8_S5_S8_S5_S8_PS6_S5_[void arma::blas::gemm<double>(char const*, char const*, int const*, int const*, int const*, double const*, double const*, int const*, double const*, int const*, double const*, double*, int const*)]+0x7a): undefined reference to `wrapper_dgemm_' collect2: ld returned 1 exit status 

Can anyone help? I manually installed

  • latest version of BLAS
  • LAPACK-3.4.0
  • boost 1.48.0
  • latest version of ATLAS

I am using Ubuntu 11.04 on a MacBook Pro 7.1

+4
source share
3 answers

Thank you so much for osgx! After reading my comment, I looked again at the README file! Turns out I miss the โ€œ-O1 -larmadilloโ€ in the team!

Here is the command I used to make it work:

 g++ example1.cpp -o example1 -O1 -larmadillo 

Stupid mistake, I know ... It just reminds you how important it is to read README.

README also mentions:

If you get binding errors or if Armadillo was installed manually and you indicated that LAPACK and BLAS are available, you will need to explicitly bind LAPACK and BLAS (or their equivalents), for example:

 g++ example1.cpp -o example1 -O1 -llapack -lblas 

I did not need to include `-llapack -lblas', but perhaps this will help anyone who has similar problems.

+14
source

Compared to 5.0.0 (may also apply to earlier versions)

You really need -larmadillo , on Fedora 21 -llapack and -lopenblas no longer required.

0
source

There is a strange thing that I just discovered when comparing previously working code compilations with the very problem of this thread, emphasizing the involvement of gnu cc (I'm not an expert in this): for my success, compiling a machine depends on the order of the parameters for gcc / g ++, where g ++ infile is o outfile -libarmadillo ... worked, but g ++ -libarmadillo infile -o outfile ... did not have (almost) the same error as mentioned above. (hope this helps).

0
source

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


All Articles