a problem when i link lapack with my obj files

Open discussion regarding features, bugs, issues, vendors, etc.

a problem when i link lapack with my obj files

Postby yiqun » Thu Sep 28, 2006 5:18 pm

when i try to link the lapack.a and blas.a with my other obj files, this error messages follow, can someone tell me why? thanks!

/usr/lib/liblapack.a(ilaenv.o)(.text+0x77): In function `ilaenv_':
: undefined reference to `s_copy'
/usr/lib/liblapack.a(ilaenv.o)(.text+0xe3): In function `ilaenv_':
: undefined reference to `s_copy'
/usr/lib/liblapack.a(ilaenv.o)(.text+0x105): In function `ilaenv_':
: undefined reference to `s_copy'
/usr/lib/liblapack.a(ilaenv.o)(.text+0x127): In function `ilaenv_':
: undefined reference to `s_copy'
/usr/lib/liblapack.a(ilaenv.o)(.text+0x169): In function `ilaenv_':
: undefined reference to `s_cmp'
/usr/lib/liblapack.a(ilaenv.o)(.text+0x194): In function `ilaenv_':
: undefined reference to `s_cmp'
/usr/lib/liblapack.a(ilaenv.o)(.text+0x291): In function `ilaenv_':
: undefined reference to `s_copy'
/usr/lib/liblapack.a(ilaenv.o)(.text+0x2c7): In function `ilaenv_':
: undefined reference to `s_cmp'
/usr/lib/liblapack.a(ilaenv.o)(.text+0x2ee): In function `ilaenv_':
: undefined reference to `s_cmp'
/usr/lib/liblapack.a(ilaenv.o)(.text+0x31e): In function `ilaenv_':
: undefined reference to `s_cmp'
/usr/lib/liblapack.a(ilaenv.o)(.text+0x362): In function `ilaenv_':
: undefined reference to `s_cmp'
/usr/lib/liblapack.a(ilaenv.o)(.text+0x3a1): In function `ilaenv_':
: undefined reference to `s_cmp'
/usr/lib/liblapack.a(ilaenv.o)(.text+0x3df): more undefined references to `s_cmp' follow
/usr/lib/liblapack.a(xerbla.o)(.text+0xe): In function `xerbla_':
: undefined reference to `s_wsfe'
/usr/lib/liblapack.a(xerbla.o)(.text+0x29): In function `xerbla_':
: undefined reference to `do_fio'
/usr/lib/liblapack.a(xerbla.o)(.text+0x44): In function `xerbla_':
: undefined reference to `do_fio'
/usr/lib/liblapack.a(xerbla.o)(.text+0x49): In function `xerbla_':
: undefined reference to `e_wsfe'
/usr/lib/liblapack.a(xerbla.o)(.text+0x5d): In function `xerbla_':
: undefined reference to `s_stop'
/usr/lib/liblapack.a(dlamch.o)(.text+0x8ec): In function `dlamc2_':
: undefined reference to `s_wsfe'
/usr/lib/liblapack.a(dlamch.o)(.text+0x8fd): In function `dlamc2_':
: undefined reference to `do_fio'
/usr/lib/liblapack.a(dlamch.o)(.text+0x902): In function `dlamc2_':
: undefined reference to `e_wsfe'
make: *** [testeof.exe] Error 1
yiqun
 
Posts: 4
Joined: Thu Sep 28, 2006 5:13 pm

Postby Julie » Thu Sep 28, 2006 5:23 pm

yigun
Add -lg2c in your Fortran compiler flags to link, it will work.

Julie
Last edited by Julie on Thu Sep 28, 2006 5:43 pm, edited 1 time in total.
Julie
 
Posts: 299
Joined: Wed Feb 23, 2005 12:32 am
Location: ICL, Denver. Colorado

my makefile, it still doesnt work

Postby yiqun » Thu Sep 28, 2006 5:28 pm

the following is my makefile, it still doesnt work.
I am working on a LINUX, and the lapack is a part of the LINUX package.
I am not the system manager, and I found that there are liblapack.a and libblas.a under the directory /usr/lib.


#
# MAKEFILE FOR prog.testeof.F
#

FF = f90
FLAG = -c

testeof.exe: deofcovcor.o deofpcs.o deoftotvar.o deof.o testeof.o
$(FF) -lm deofcovcor.o deofpcs.o deoftotvar.o deof.o testeof.o \
/usr/lib/libblas.a /usr/lib/liblapack.a

# mv testeof.exe ../bin/.
@ echo "It is done!"

deofcovcor.o: deofcovcor.F
$(FF) $(FLAG) deofcovcor.F
deofpcs.o: deofpcs.F
$(FF) $(FLAG) deofpcs.F
deoftotvar.o: deoftotvar.F
$(FF) $(FLAG) deoftotvar.F
dof.o: deof.F
$(FF) $(FLAG) deof.F
testeof.o: testeof.F
$(FF) $(FLAG) testeof.F
yiqun
 
Posts: 4
Joined: Thu Sep 28, 2006 5:13 pm

Postby Julie » Thu Sep 28, 2006 5:46 pm

yigan,

use the -lg2c library in your linking sequence.

Julie
Julie
 
Posts: 299
Joined: Wed Feb 23, 2005 12:32 am
Location: ICL, Denver. Colorado

let me explain it in detail

Postby yiqun » Thu Sep 28, 2006 8:41 pm

Julian, thanks for your help!

our linux is a 64-bit Redhat linux. when I use g77 as the compiler, it is a 64 bit system (GNU fortran 77 compiler g77 (or f77) has 8-byte default integer, native in this 64-bit Redhat linux). I foung there are liblapack.a and libblas.a in /usr/lib64, so I link them to my obj files (this should be right, because our system manager told me to do this, although he is not famaliar with lapack). My newest makefile is the following:


#
# MAKEFILE FOR prog.testeof.F
#

FF = g77
FLAG = -c

testeof.exe: deofcovcor.o deofpcs.o deoftotvar.o deof.o testeof.o
$(FF) deofcovcor.o deofpcs.o deoftotvar.o deof.o testeof.o \
/usr/lib64/libblas.a /usr/lib64/liblapack.a
@ echo "It is done!"

deofcovcor.o: deofcovcor.F
$(FF) $(FLAG) deofcovcor.F
deofpcs.o: deofpcs.F
$(FF) $(FLAG) deofpcs.F
deoftotvar.o: deoftotvar.F
$(FF) $(FLAG) deoftotvar.F
dof.o: deof.F
$(FF) $(FLAG) deof.F
testeof.o: testeof.F
$(FF) $(FLAG) testeof.F
g77 deofcovcor.o deofpcs.o deoftotvar.o deof.o testeof.o \
/usr/lib64/libblas.a /usr/lib64/liblapack.a
/usr/lib64/liblapack.a(dspevx.o)(.text+0x52e): In function `dspevx_':
: undefined reference to `dscal_'
/usr/lib64/liblapack.a(dspevx.o)(.text+0x91b): In function `dspevx_':
: undefined reference to `dcopy_'
/usr/lib64/liblapack.a(dspevx.o)(.text+0x96f): In function `dspevx_':
: undefined reference to `dcopy_'
/usr/lib64/liblapack.a(dspevx.o)(.text+0xa4a): In function `dspevx_':
: undefined reference to `dswap_'
/usr/lib64/liblapack.a(dspevx.o)(.text+0xaef): In function `dspevx_':
: undefined reference to `dscal_'
/usr/lib64/liblapack.a(dspevx.o)(.text+0xcd5): In function `dspevx_':
: undefined reference to `dcopy_'
/usr/lib64/liblapack.a(dsptrd.o)(.text+0x187): In function `dsptrd_':
: undefined reference to `dspmv_'
/usr/lib64/liblapack.a(dsptrd.o)(.text+0x1ba): In function `dsptrd_':
: undefined reference to `ddot_'
/usr/lib64/liblapack.a(dsptrd.o)(.text+0x1ee): In function `dsptrd_':
: undefined reference to `daxpy_'
/usr/lib64/liblapack.a(dsptrd.o)(.text+0x227): In function `dsptrd_':
: undefined reference to `dspr2_'
/usr/lib64/liblapack.a(dsptrd.o)(.text+0x37f): In function `dsptrd_':
: undefined reference to `dspmv_'
/usr/lib64/liblapack.a(dsptrd.o)(.text+0x3cd): In function `dsptrd_':
: undefined reference to `ddot_'
/usr/lib64/liblapack.a(dsptrd.o)(.text+0x41c): In function `dsptrd_':
: undefined reference to `daxpy_'
/usr/lib64/liblapack.a(dsptrd.o)(.text+0x46a): In function `dsptrd_':
: undefined reference to `dspr2_'
/usr/lib64/liblapack.a(dstein.o)(.text+0x5ee): In function `dstein_':
: undefined reference to `dcopy_'
/usr/lib64/liblapack.a(dstein.o)(.text+0x635): In function `dstein_':
: undefined reference to `dcopy_'
/usr/lib64/liblapack.a(dstein.o)(.text+0x66e): In function `dstein_':
: undefined reference to `dcopy_'
/usr/lib64/liblapack.a(dstein.o)(.text+0x738): In function `dstein_':
: undefined reference to `dasum_'
/usr/lib64/liblapack.a(dstein.o)(.text+0x76a): In function `dstein_':
: undefined reference to `dscal_'
/usr/lib64/liblapack.a(dstein.o)(.text+0x88a): In function `dstein_':
: undefined reference to `ddot_'
/usr/lib64/liblapack.a(dstein.o)(.text+0x8c7): In function `dstein_':
: undefined reference to `daxpy_'
/usr/lib64/liblapack.a(dstein.o)(.text+0x8e3): In function `dstein_':
: undefined reference to `idamax_'
/usr/lib64/liblapack.a(dstein.o)(.text+0x96b): In function `dstein_':
: undefined reference to `dnrm2_'
/usr/lib64/liblapack.a(dstein.o)(.text+0x997): In function `dstein_':
: undefined reference to `idamax_'
/usr/lib64/liblapack.a(dstein.o)(.text+0x9cd): In function `dstein_':
: undefined reference to `dscal_'
/usr/lib64/liblapack.a(dsteqr.o)(.text+0x1097): In function `dsteqr_':
: undefined reference to `dswap_'
/usr/lib64/liblapack.a(dlarfg.o)(.text+0x4f): In function `dlarfg_':
: undefined reference to `dnrm2_'
/usr/lib64/liblapack.a(dlarfg.o)(.text+0x188): In function `dlarfg_':
: undefined reference to `dscal_'
/usr/lib64/liblapack.a(dlarfg.o)(.text+0x1eb): In function `dlarfg_':
: undefined reference to `dnrm2_'
/usr/lib64/liblapack.a(dlarfg.o)(.text+0x28c): In function `dlarfg_':
: undefined reference to `dscal_'
/usr/lib64/liblapack.a(dlarfg.o)(.text+0x312): In function `dlarfg_':
: undefined reference to `dscal_'
/usr/lib64/liblapack.a(dorg2l.o)(.text+0x220): In function `dorg2l_':
: undefined reference to `dscal_'
/usr/lib64/liblapack.a(dorg2r.o)(.text+0x25c): In function `dorg2r_':
: undefined reference to `dscal_'
/usr/lib64/liblapack.a(dlarf.o)(.text+0x108): In function `dlarf_':
: undefined reference to `dgemv_'
/usr/lib64/liblapack.a(dlarf.o)(.text+0x198): In function `dlarf_':
: undefined reference to `dgemv_'
/usr/lib64/liblapack.a(dlarf.o)(.text+0x1e2): In function `dlarf_':
: undefined reference to `dger_'
collect2: ld returned 1 exit status
make: *** [testeof.exe] Error 1


And I checked it online, somebody said that it is because blas.a hasnt been connected. but I have put it in my makefile, so why?

I also added /usr/lib64/libg2c.so.0, which I can find in the directory, although I dont know what it is for, and the error message is the same as before. So the point is that blas.a hasnt been connected actually?

thanks for your help! looking forward for your further help!



the error message is the following:
yiqun
 
Posts: 4
Joined: Thu Sep 28, 2006 5:13 pm

Postby Julie » Thu Sep 28, 2006 8:44 pm

yigun

right now, it is looking for the blas library.
It comes from the fact that you need to link with first lapack then blas

g77 deofcovcor.o deofpcs.o deoftotvar.o deof.o testeof.o \
/usr/lib64/liblapack.a /usr/lib64/libblas.a

Julie
Julie
 
Posts: 299
Joined: Wed Feb 23, 2005 12:32 am
Location: ICL, Denver. Colorado

it works!

Postby yiqun » Thu Sep 28, 2006 8:46 pm

after I modify the makefile according to your suggestion, it works!
thank you very much!
yiqun
 
Posts: 4
Joined: Thu Sep 28, 2006 5:13 pm

Postby Julien Langou » Thu Sep 28, 2006 8:47 pm

This was Julie before, now it is Julien.

OK you are almost there swicth the blas with the lapack in the linking.
I.e. first lapack.a then blas.a

Something like:
Code: Select all
FF = g77
FLAG = -c

testeof.exe: deofcovcor.o deofpcs.o deoftotvar.o deof.o testeof.o
               $(FF) deofcovcor.o deofpcs.o deoftotvar.o deof.o testeof.o /usr/lib64/liblapack.a /usr/lib64/libblas.a


Julien
Julien Langou
 
Posts: 832
Joined: Thu Dec 09, 2004 12:32 pm
Location: Denver, CO, USA


Return to User Discussion

Who is online

Users browsing this forum: No registered users and 2 guests