LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 07-19-2006, 09:47 PM   #1
StudMuffin
LQ Newbie
 
Registered: May 2006
Distribution: mandrake 10.1
Posts: 3

Rep: Reputation: 0
Angry undefined gfortran references when compiling with g77


ello

Using openSUSE 10.1 32-bit on AMD 165 Opteron Dual Core. Have compat-g77 3.3.5-2, gcc 4.1.0-25 and gcc-fortran 4.1.0-25.

I'm trying to compile a program that makes use of the lapack libraries (for linear algebraic operations). So when I compile, the command line looks like this:

# g77 program.f -L/usr/lib -lgfortran -llapack -lblas

However, I get these error messages:

# /usr/lib/liblapack.so: undefined reference to `_gfortran_filename'
# /usr/lib/liblapack.so: undefined reference to `_gfortran_ioparm'
# /usr/lib/liblapack.so: undefined reference to `_gfortran_line'

And I do not understand what is going on. Anyone happen to run into this problem as well? Thanks.
 
Old 02-16-2007, 02:34 PM   #2
MALDATA
Member
 
Registered: Mar 2005
Posts: 103

Rep: Reputation: 17
I'm trying to do almost exactly the same thing, with the same result.

Only difference is that if I include the -lblas or -lgfortran flags I get the error "/usr/bin/ld: cannot find -lgfortran" (or -lblas).

My command is
g77 lptest.f -o lpout.exe -L/usr/lib -llapack

The output is a bunch of these lines:
/usr/lib/liblapack.a(ATL_sgetrs.o)(.text+0xcf): In function `ATL_sgetrs':
: undefined reference to `cblas_strsm'

Any ideas? I've only ever done some basic coding, never anything with libraries, so I don't know how to do this kind of thing. Thanks...

-Mark
 
Old 02-16-2007, 02:55 PM   #3
weibullguy
ReliaFree Maintainer
 
Registered: Aug 2004
Location: Kalamazoo, Michigan
Distribution: Slackware-current, Cross Linux from Scratch, Gentoo
Posts: 2,731
Blog Entries: 1

Rep: Reputation: 224Reputation: 224Reputation: 224
Studmuffin, it looks like your LAPACK was compiled with gfortran and you're trying to compile with g77. Try compiling program.f with gfortran instead and see what happens. Another option is to use the ACML library for BLAS and LAPACK functions.

MALDATA, you answered your own question, the linker can't find the libraries -> /usr/bin/ld: cannot find -lgfortran" (or -lblas).
 
Old 02-17-2007, 12:06 AM   #4
MALDATA
Member
 
Registered: Mar 2005
Posts: 103

Rep: Reputation: 17
I found someone who knows what he's doing and he got me all set up. I just didn't know that the LAPACK libraries also called BLAS and ATLAS... so to get it to work I need -llapack, -lf77blas, and -latlas flags. I assumed that calling -llapack would implicitly include whatever other libraries it needs.

So, next time this happens, is there any way to figure out ALL the libraries I need to specify, or should I just keep googling errors until I figure it out?

Thanks for the help
-Mark
 
Old 02-17-2007, 06:06 AM   #5
weibullguy
ReliaFree Maintainer
 
Registered: Aug 2004
Location: Kalamazoo, Michigan
Distribution: Slackware-current, Cross Linux from Scratch, Gentoo
Posts: 2,731
Blog Entries: 1

Rep: Reputation: 224Reputation: 224Reputation: 224
Quote:
Originally Posted by MALDATA
I found someone who knows what he's doing and he got me all set up. I just didn't know that the LAPACK libraries also called BLAS and ATLAS... so to get it to work I need -llapack, -lf77blas, and -latlas flags. I assumed that calling -llapack would implicitly include whatever other libraries it needs.

So, next time this happens, is there any way to figure out ALL the libraries I need to specify, or should I just keep googling errors until I figure it out?

Thanks for the help
-Mark
Actually, BLAS, LAPACK, and Atlas are not the same thing. Use your distro's package manager, then someone will have figured out the dependencies for you. Otherwise read the documentation that comes with code and peruse the configure script to figure out what is needed.

Last edited by weibullguy; 02-17-2007 at 06:09 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
g77 in gcc 4.1.0 not found only gfortran fortran 95 compiler! I need fortran 77. TheBrick Linux - Software 3 07-04-2007 06:39 AM
Compiling garnome 2.14.1 fails in libgnome(undefined references to popt...) Spooled Linux - Software 2 05-10-2006 07:14 PM
Undefined references with static libraries Nightfox Programming 2 10-28-2005 06:43 PM
Compiling with g77 thank you very much...but I solved compile with g77 gambato79 Fedora 9 07-19-2005 11:35 AM
texinfo - undefined references during make fitret Linux - Software 1 06-18-2005 02:38 PM


All times are GMT -5. The time now is 11:27 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration