1,105,625 Community Members

Fortran Compile Error Help

Member Avatar
Takafoo
Light Poster
37 posts since Mar 2009
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
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.

Member Avatar
WaltP
Posting Sage w/ dash of thyme
9,363 posts since May 2006
Reputation Points: 2,905 [?]
Q&As Helped to Solve: 1,151 [?]
Skill Endorsements: 45 [?]
Team Colleague
 
0
 

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

Member Avatar
Takafoo
Light Poster
37 posts since Mar 2009
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

How do I define it then sorry?

Member Avatar
nezachem
Practically a Posting Shark
896 posts since Dec 2009
Reputation Points: 616 [?]
Q&As Helped to Solve: 197 [?]
Skill Endorsements: 0 [?]
 
0
 

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

Member Avatar
Takafoo
Light Poster
37 posts since Mar 2009
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
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

Member Avatar
nezachem
Practically a Posting Shark
896 posts since Dec 2009
Reputation Points: 616 [?]
Q&As Helped to Solve: 197 [?]
Skill Endorsements: 0 [?]
 
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

Member Avatar
Takafoo
Light Poster
37 posts since Mar 2009
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
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

Member Avatar
nezachem
Practically a Posting Shark
896 posts since Dec 2009
Reputation Points: 616 [?]
Q&As Helped to Solve: 197 [?]
Skill Endorsements: 0 [?]
 
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.

Member Avatar
Takafoo
Light Poster
37 posts since Mar 2009
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
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

Member Avatar
nezachem
Practically a Posting Shark
896 posts since Dec 2009
Reputation Points: 616 [?]
Q&As Helped to Solve: 197 [?]
Skill Endorsements: 0 [?]
 
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*"

Member Avatar
Takafoo
Light Poster
37 posts since Mar 2009
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
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

Member Avatar
nezachem
Practically a Posting Shark
896 posts since Dec 2009
Reputation Points: 616 [?]
Q&As Helped to Solve: 197 [?]
Skill Endorsements: 0 [?]
 
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.

Member Avatar
Takafoo
Light Poster
37 posts since Mar 2009
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
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 three months: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: