Qianqian Fang <
fan...@gmail.com> wrote:
> On Nov 14, 6:21 pm, nos...@see.signature (Richard Maine) wrote:
> > Well, considering it is a linking error, I'd think it important to see
> > the actual command that you link with. "link .o files and *.a files" is
> > presumably not the actual command. Yes, it can matter.
>
> thanks for your reply. In order to replicate the problem by anyone
> who want to help, I created a simple test case.
>
> first of all, my windows is an XP.....
[details elided]
...
> gfortran blit_matrixutil.o blit_const.o liblapack.a -o testlapack
>
> (the -cpp option enables gfortran to interpret the C-styled
> preprocessors)
> the last command failed with
>
> liblapack.a(dgetrf.o):dgetrf.f:(.text+0x35f): undefined reference to
> `dtrsm_'
> liblapack.a(dgetrf.o):dgetrf.f:(.text+0x41a): undefined reference to
> `dgemm_'
> liblapack.a(dgetri.o):dgetri.f:(.text+0x224): undefined reference to
> `dswap_'
> liblapack.a(dgetri.o):dgetri.f:(.text+0x360): undefined reference to
> `dgemv_'
> liblapack.a(dgetri.o):dgetri.f:(.text+0x5a2): undefined reference to
> `dtrsm_'
> ...
>
> I really appreciate if anyone can point me to the right direction
> on how to solve the above issue.
Ok. That doesn't look like the link order problem I was thinking of. I
don't have a Windows system handy to duplicate it with, though I'm sure
several people here do and that's certainly specific enough data. I did
glance at some of the material you cite, even though I don't have a
duplicate of your system to run it on quite identically.
However, I'll venture another quick guess. My last one looks to have
been wrong, but I'll try again. Looks to me like you did not link in a
copy of the BLAS stuff. The LAPACK distribution includes a copy of a
BLAS implementation, although it recommend using a tuned BLAS for best
performance. Although there is a BLAS implementation included with
LAPACK, I'm not sure that you actually compiled that; or if you compiled
it, I don't see evidence of it being linked in.
See the comments about BLAS in the README in the lapack distribution.
ALso see the BLAS stuff right before the LAPACK stuff on the page that
you cite from the gcc wiki:
<
http://gcc.gnu.org/wiki/GfortranBuild#LAPACK_.28Linear_Algebra_PACKage.
29>
I don't see you mentioing having done anything about that. That make.inc
file that you say you used includes instructions to replace
/path/to/blas with the path tothe blas library that you just compiled
I'm suspicious that the things like _dgemm_ that you see in the output
of "nm liblapack.a" do not indicate that dgemm is actually in that
library; I wouldn't expect it to be there anyway. I suspect that instead
what you are seeing is the references to dgemm - the ones that aren't
satisfied because you didn't build or link in a BLAS.
I still think that all the fuss about underscores is just a distraction
from something simpler. My current guess of "something simpler" is that
you aren't compiling and linking the BLAS.
P.S. Not that it probably has anything to do with yourt problem, but I'm
minorly surprised that you are using a 2-year-old version of lapack for
a new installation. When I glanced at the lapack site, I did look at the
version you specified, but I couldn't help noticing that it was several
versions old.