1.11M Members

Fortran Compile Error Help

 
0
 

Hi I am new to Fortran and am getting the below error when I try and compile using ifort 100.f90

/tmp/ifortN2Zshv.o: In function `MAIN__':
100.f90:(.text+0x25a2): undefined reference to `zgesv_'

I am not sure how to correct this and cannot find anything in my searches so any help would be appreciated.

 
0
 

zgesv_ is a variable or function you tried to use but didn't define. Hence "undefined reference"

 
0
 

How do I define it then sorry?

 
0
 

Through my crystal ball I see that you need to add -llapack -lblas to your linker command line.

 
0
 

ifort 100.f90 -L/Lib/blas_LINUX -L/Lib/lapack_LINUX
/tmp/ifort4orRdn.o: In function `MAIN__':
100.f90:(.text+0x27d2): undefined reference to `zgesv_'


I am still getting the same issue sorry

 
0
 

-L tells the linker where to look for libraries. It still needs to know which libraries to link in. That's what -l option is for.
add -llapack -lblas

 
0
 

So ifort 100.f90 -L/Lib/ -llapack_LINUX -lblas_LINUX ?

--------------

ifort 100.f90 -L/Lib/ -llapack_LINUX -lblas_LINUX
ld: cannot find -llapack_LINUX

 
0
 

You have to check your installation. For starters, linux filenames are case sensitive. Do you have a /Lib directory with the capital L? If so, what is the output of find /Lib -name "libblas*" ? If not, try the same with /lib instead of Lib.

 
0
 

find /Lib -name "libblas*"
find: /Lib: No such file or directory
h2:~> dir
total 41412
-rw-r--r-- 1 hpc12 h2 4280 Apr 15 08:14 100.f90
drwxr-xr-x 2 hpc12 h2 92 Apr 14 10:32 Lib
-rw-r--r-- 1 hpc12 h2 21193536 Apr 12 03:56 lapack_LINUX.a
-rw-r--r-- 1 hpc12 h2 21193536 Apr 12 03:56 liblapack_LINUX.a

 
0
 

> find: /Lib: No such file or directory
OK, you have no /Lib, meaning that -L/Lib/ points to nowhere.

h2:~> dir

This is even better. You do have lapack library. What is the directory name ( pwd at the command prompt)? BTW, I am positive that you absolutely need blas; do you have it? find / -name "libblas*"

 
0
 

Thanks so much this is driving me insane and I really need to work it out a.s.a.p.

blas_LINUX.a
lapack_LINUX.a
liblapack_LINUX.a

 
0
 

Thank me when we reach some result.
Now, which directory liblapack resides in? Same for lapack and blas.
Just in case, are they valid libraries - what does nm liblapack_LINUX.a display?.
> this is driving me insane
Is this your first deadline? Relax, there are many more ahead. Insanity is not productive.

 
0
 

I got it working using ifort 100.f90 lapack_LINUX.a blas_LINUX.a and moving the libraries into the same directory as the code

Thanks for your help

You
This article has been dead for over six months: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: