×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Linking LAPACK and Fortran 90

Linking LAPACK and Fortran 90

Linking LAPACK and Fortran 90

(OP)
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.

RE: Linking LAPACK and Fortran 90

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.

RE: Linking LAPACK and Fortran 90

(OP)
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!

RE: Linking LAPACK and Fortran 90

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.

RE: Linking LAPACK and Fortran 90

(OP)
In that case should I just find the f90 version for it?

RE: Linking LAPACK and Fortran 90

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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close