I need some help regarding installation of LAPACK ( for Fortran 95) on a Fedora machine.
I am writing this post after having tried all answers posted to pertinent queries in this forum.
I tried two different options:
METHOD 1
I directly downloaded the lapack95.a library from here (http://www.netlib.org/lapack95/, file named lapack95_linux_redhat.tgz. After unzipping, I could get file lapack95.a
After looking for some answers on how to link and use libraries, I wrote a trial code and saved in file try.f90 and then did the following
gfortran -c try.f90
gfortran -o try try.o -L/(name of directory where lapack95.a
was present. I put it in the same directory
as try.f90)/ -llapack95
( The fortran file try.f90 and lapack95.a were in the same directory)
I got the following error:
/usr/bin/ld: cannot find -llapack95
collect2: error: ld returned 1 exit status
I searched on internet and found here (https://forums.fedoraforum.org/archive/index.php/t-248227.html) that we need to install lapack-devel. I did that and had the same outcome.
Method 2
I also tried running the above command (in Method 1) but without space between / and -llapack95 , i.e. as :
gfortran -o try try.o -L/(name of directory where lapack95.a
was present I put it in the same directory
as try.f90)/-llapack95
and received the following error:
try.o: In function `MAIN__':
try.f90:(.text+0xdb): undefined reference to `sgesv_'
collect2: error: ld returned 1 exit status
Method 3
After having no success, I thought may it's not good idea to use the lapack95.a downloaded directly. I should build it from the original files.
I realized that may be I need to install lapack95 through proper means following which from the same link http://www.netlib.org/lapack95
I downloaded the file lapack95.tgz and followed the instructions in readme file.( which said just to run make file in SRC)
I made some changes as :
FC1 = f95 -fixed to
FC1 = f95
and
OPTS0 = -u -V -dcfuns -dusty -ieee=full
to
OPTS0 = -u -V
( as suggested on https://www.reddit.com/r/linux4noobs/comments/7tgmb9/fortran_library_netlib_lapack95_installation_error/)
I expected that the library will be created in /usr/lib/ or usr/local/lib as LAPACK3 but couldn't find it.
Infact there was an error ( and thus could not have any .a file )
f95 -free -c -u -V - -I./../lapack95_modules f77_lapack_double.f90 f95: error: -E or -x required when input is from standard input make: *** [../make.inc:45: f77_lapack_double.o] Error 1
I am not sure if any of my method is fine. I expected Method 1 to work as I am linking the library locally but failure in all 3 cases.
Kindly suggest. Thanks