I have installed LAPACK and BLAS from Synaptic package manager in Ubuntu.
whereis libblas
libblas: /usr/lib/libblas.so /usr/lib/libblas.a /usr/lib/libblas
whereis liblapack
liblapack: /usr/lib/liblapack.a /usr/lib/liblapack.so
When I try to compile the randomsys1 example with gfortran
I get the following error messages.
gfortran randomsys1.f90 -L/usr/lib/lapack -llapack -L/usr/lib/libblas -lblas
/tmp/cclwtifh.o: In function `MAIN__':
randomsys1.f90:(.text+0x12): undefined reference to `init_random_seed_'
collect2: error: ld returned 1 exit status
or
gfortran randomsys1.f90 -llapack -lblas
/tmp/ccB1isEC.o: In function `MAIN__':
randomsys1.f90:(.text+0x12): undefined reference to `init_random_seed_'
collect2: error: ld returned 1 exit status
As per my understanding, it is the recommended way to link gfortran
with lapack
and blas
(kindly refer to gfortran LAPACK “undefined reference” error). Thanks in advance for pointing out the correct way to compile the fortran
code using gfortran
.