LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   undefined gfortran references when compiling with g77 (https://www.linuxquestions.org/questions/linux-software-2/undefined-gfortran-references-when-compiling-with-g77-465727/)

StudMuffin 07-19-2006 09:47 PM

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.

MALDATA 02-16-2007 02:34 PM

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

weibullguy 02-16-2007 02:55 PM

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

MALDATA 02-17-2007 12:06 AM

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

weibullguy 02-17-2007 06:06 AM

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.


All times are GMT -5. The time now is 07:13 AM.