5

I am using armadillo as a wrapper framework for linear algebra routines which further uses linear algebra static libraries like lapack and blas.

I have manually compiled blas and lapack libraries and so as per readme.txt of armadillo, i am supposed to link to these two libraries at compile time. This is the gcc commandline i use -

g++ example2.cpp  -I../include/armadillo -L../lib/BLAS -lblas_LINUX -L../lib/lapack -   llapack_LINUX -lgfortran

This induces these errors -

../lib/lapack/liblapack_LINUX.a(dgetrf.o): In function `dgetrf_':
dgetrf.f:(.text+0x3da): undefined reference to `dtrsm_ '
../lib/lapack/liblapack_LINUX.a(dgetri.o): In function `dgetri_':
dgetri.f:(.text+0x286): undefined reference to `dswap_'
dgetri.f:(.text+0x609): undefined reference to `dtrsm_'

and more of these kind of errors.

Can anyone give me a suggestion to overcome this?

Ali
  • 56,466
  • 29
  • 168
  • 265
Hobby_Web_programmer
  • 775
  • 2
  • 10
  • 18

1 Answers1

7

You should first give the LAPACK library then the BLAS library:

g++ example2.cpp  -I../include/armadillo -L../lib/lapack -llapack_LINUX  -L../lib/BLAS -lblas_LINUX -lgfortran

LAPACK references routines in the BLAS library, and not the other way around; in this situation the LAPACK library must come first.

Ali
  • 56,466
  • 29
  • 168
  • 265