1
votes

I have downloaded the latest Armadillo package (3.920) and I am trying to use it on my machine (Ubuntu 12.04). I am following the steps mentioned in the readme.txt file for the installation (cmake ., make, sudo make install). I have lapack and blas on my system. When I try to run the example provided in the examples directory using: g++ example1.cpp -O2 -larmadillo I get the error: /usr/lib/liblapack.so.3gf: undefined reference to ATL_zptgemm' /usr/lib/liblapack.so.3gf: undefined reference toATL_scopy' etc

If I try to run the example with g++ example1.cpp -O2 -llpack -lblas -lgfortran I get the error: /tmp/ccOsKhfg.o: In function double arma::blas::dot<double>(unsigned int, double const*, double const*)': example1.cpp:(.text._ZN4arma4blas3dotIdEET_jPKS2_S4_[double arma::blas::dot<double>(unsigned int, double const*, double const*)]+0x36): undefined reference towrapper_ddot_' /tmp/ccOsKhfg.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*)': example1.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*)]+0x53): undefined reference towrapper_dgemv_' /tmp/ccOsKhfg.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*)': example1.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*)]+0x61): undefined reference towrapper_dgemm_'

Note that if I comment lines '#define ARMA_USE_LAPACK','#define ARMA_USE_BLAS'in config.hpp I am able to run example 1 but not example 2 as it requires lapack.

Can you please guide me in solving the problem. Thanks. Salil

1
You need to cleanup the formatting before submitting the question. Please review: stackoverflow.com/editing-help - James A Mohler

1 Answers

0
votes

By seeing your question, i think you should type -llapack instead of -llpack.
Without -lgfortan it can work so try that too.

g++ main.cpp -o main -o1 -larmadillo -llapack -lblas