Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Linking LAPACK and Fortran 90

Status
Not open for further replies.

alemundo

Technical User
May 22, 2014
3
US
I am running 12.04 on a 64-bit machine and I am trying to compile a Fortran 90 program. I installed the LAPACK files through Synaptic but when I try to compile the program I am told:
"Fatal Error Can't find module file 'lapack.mod' for reading at (1): No such file or directory."

My original attempt to link:
gfortran test.f90 -L/usr/lib/lapack -liblapack.a

The file locations are correct. I'm just happy to take whatever information you can offer.
 
Find out where lapack.mod lives - say it lives in /xxx/yyy/zzz. Change your build line to

gfortran test.f90 -I/xxx/yyy/zzz -L/usr/lib/lapack -llapack

You do know that the executable will be called a.out unless you specify a -o parameter.
It is not a good idea on Linux to name your programs test since there is a sh/bash command called test.
 
Alright, xwb. So I typed "whereis lapack.mod" and my output was "/usr/lib/lapack /usr/share/man/man3/lapack.3lapack.gz" However, I do not see the plain lapack.mod file when I visit them.

I did try the new build line anyway with both the directories shown pointing to the same place but I got the same error that I had before.

Noted!

 
Could you modify the test program and remove the use lapack statement? At a guess the lapack library is written as f77: not f90 so there probably isn't a mod file.
 
In that case should I just find the f90 version for it?
 
alemundo:

did you see the difference between your command and xwb's ?

when using a library, you do not specify the entire name "-liblapack.a"; you simply pass the "-l" flag followed by the name of the library without the prefix "lib" and without the extension ".a"

So, for starters, try a command along the lines of:

gfortran -llapack -L/usr/lib/lapack myprogram.f90

and the actual file liblapack.a must be in the directory specified by -L
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top