Search code examples
clapackblasatlas

ATLAS-LAPACK not linking to BLAS


I went to a standard ATLAS compile. All the tests pass, but when I am trying to compile with the following command:

gcc prog.c -o prog -I/home/atlas_build/include -L/home/atlas_build/lib -llapack -lcblas -lm

It gives a spew of errors:

dsyevr.f:(.text+0xbb): undefined reference to `lsame_'
dsyevr.f:(.text+0xe3): undefined reference to `lsame_'
dsyevr.f:(.text+0x102): undefined reference to `lsame_'
dsyevr.f:(.text+0x125): undefined reference to `lsame_'
dsyevr.f:(.text+0x148): undefined reference to `lsame_'
/home/atlas_build/lib/liblapack.a(dsyevr.o):dsyevr.f:(.text+0x1ac): more undefined references to `lsame_' follow
/home/atlas_build/lib/liblapack.a(dsyevr.o): In function `dsyevr_':
dsyevr.f:(.text+0x39e): undefined reference to `xerbla_'
dsyevr.f:(.text+0x742): undefined reference to `dscal_'
dsyevr.f:(.text+0x7cb): undefined reference to `dscal_'
dsyevr.f:(.text+0x9cb): undefined reference to `dcopy_'
dsyevr.f:(.text+0xa15): undefined reference to `dcopy_'
dsyevr.f:(.text+0xa84): undefined reference to `dcopy_'
dsyevr.f:(.text+0xac2): undefined reference to `dcopy_'
dsyevr.f:(.text+0x1146): undefined reference to `dscal_'
dsyevr.f:(.text+0x124b): undefined reference to `dswap_'

It goes on and on, complaining about BLAS functions missing like dscal_, dcopy_, etc. I have truncated the output. Why is this happening?


Solution

  • Resolved this. Need to link against lgfortran.