Compile with ATC problem

Hi

i try to compile with atc package
and give error^

..
trtri.f:(.text+0x614): undefined reference to `dtrmm_'
dtrtri.f:(.text+0x6ae): undefined reference to `dtrsm_'
/home/maks/lapack/liblapack.a(dgetf2.o): In function `dgetf2_':
dgetf2.f:(.text+0x1e0): undefined reference to `idamax_'
dgetf2.f:(.text+0x23e): undefined reference to `dswap_'
dgetf2.f:(.text+0x3b3): undefined reference to `dger_'
dgetf2.f:(.text+0x417): undefined reference to `dscal_'
/home/maks/lapack/liblapack.a(dtrti2.o): In function `dtrti2_':
dtrti2.f:(.text+0x18f): undefined reference to `dtrmv_'
dtrti2.f:(.text+0x1b5): undefined reference to `dscal_'
dtrti2.f:(.text+0x31a): undefined reference to `dtrmv_'
dtrti2.f:(.text+0x34a): undefined reference to `dscal_'
collect2: ld returned 1 exit status
make[1]: *** [../lmp_openmpi] Error 1
make[1]: Leaving directory `/home/maks/lammps-9Dec11/src/Obj_openmpi'
make: *** [openmpi] Error 2

Those look like BLAS functions. Does your
lib/atc/Makefile.lammps contain a line like:

user-atc_SYSLIB = -lblas -llapack

and do you see those libs in your link line
when LAMMPS builds?

Steve

Yes it does. Compiler request both this libs when they were absent.
I get lapack from www.netlib.org/lapack/ , and compile it in home directory, and set syspath to this.

Blas is in lapack package too, and was compiled in librefblas.a, and rename to libblas.a, then lammps make can found it.

I see that blas source in lapacke archive is newest than separate blas package.(april vs november). May be is this reason? i can't check now.

2011/12/14 Maxim <[email protected]...>:

I see that blas source in lapacke archive is newest than separate blas package.(april vs november). May be is this reason? i can't check now.

no. version doesn't matter here. the error indicates that
you are not linking with BLAS at all. you may have compiled
and installed it, but it is not part of LAPACK and thus
not automatically linked. you have to link to it explicitly
(unless you are using MKL or some other incarnation
that has shared libraries with dependencies or combines
multiple libraries into a "meta"-library).

cheers,
   axel.

When compile atc lib i set in ССFLAGS -fpermissive, because i give error that recommend to set it.

1) I set syspath to blaslib in lapack. - get this error
2) Compile separate BLAS and link to it. - get this error (in both case name set to libblas.a )
3) don't link any lib, (-llapack, -lblas stay) then not found -llapack and -lblas error

...
ariable.o velocity.o verlet.o write_restart.o -latc -lfftw -lblas -llapack -lstdc++ -o ../lmp_openmpi
...
/home/maks/BLAS/libblas.a(xerbla.o): In function `xerbla_':
xerbla.f:(.text+0x59): undefined reference to `_gfortran_st_write'
xerbla.f:(.text+0x64): undefined reference to `_gfortran_string_len_trim'
xerbla.f:(.text+0x76): undefined reference to `_gfortran_transfer_character'
xerbla.f:(.text+0x86): undefined reference to `_gfortran_transfer_integer'
xerbla.f:(.text+0x8e): undefined reference to `_gfortran_st_write_done'
xerbla.f:(.text+0x98): undefined reference to `_gfortran_stop_numeric'
/home/maks/lapack/liblapack.a(dgecon.o): In function `dgecon_':
dgecon.f:(.text+0x41e): undefined reference to `idamax_'
/home/maks/lapack/liblapack.a(dgetrf.o): In function `dgetrf_':
dgetrf.f:(.text+0x3e3): undefined reference to `dtrsm_'
/home/maks/lapack/liblapack.a(dgetri.o): In function `dgetri_':
dgetri.f:(.text+0x3df): undefined reference to `dswap_'
dgetri.f:(.text+0x58c): undefined reference to `dgemv_'
dgetri.f:(.text+0x649): undefined reference to `dtrsm_'
/home/maks/lapack/liblapack.a(dlacn2.o): In function `dlacn2_':
dlacn2.f:(.text+0xf4): undefined reference to `dasum_'
dlacn2.f:(.text+0x19d): undefined reference to `dasum_'
dlacn2.f:(.text+0x1e2): undefined reference to `dcopy_'
dlacn2.f:(.text+0x1ff): undefined reference to `dasum_'
dlacn2.f:(.text+0x2ef): undefined reference to `idamax_'
dlacn2.f:(.text+0x34b): undefined reference to `idamax_'
dlacn2.f:(.text+0x3f2): undefined reference to `dcopy_'
/home/maks/lapack/liblapack.a(dlatrs.o): In function `dlatrs_':
dlatrs.f:(.text+0x2fe): undefined reference to `dasum_'
dlatrs.f:(.text+0x354): undefined reference to `idamax_'
dlatrs.f:(.text+0x3a0): undefined reference to `idamax_'
dlatrs.f:(.text+0x851): undefined reference to `daxpy_'
dlatrs.f:(.text+0x875): undefined reference to `idamax_'
dlatrs.f:(.text+0x937): undefined reference to `dscal_'
dlatrs.f:(.text+0x9c4): undefined reference to `dscal_'
dlatrs.f:(.text+0xe49): undefined reference to `dtrsv_'
dlatrs.f:(.text+0xe9e): undefined reference to `dscal_'
dlatrs.f:(.text+0xf53): undefined reference to `dasum_'
dlatrs.f:(.text+0x1037): undefined reference to `dscal_'
dlatrs.f:(.text+0x12e4): undefined reference to `daxpy_'
dlatrs.f:(.text+0x130f): undefined reference to `idamax_'
dlatrs.f:(.text+0x13d5): undefined reference to `dscal_'
dlatrs.f:(.text+0x15cc): undefined reference to `dscal_'
dlatrs.f:(.text+0x16bd): undefined reference to `ddot_'
dlatrs.f:(.text+0x174e): undefined reference to `dscal_'
dlatrs.f:(.text+0x17e0): undefined reference to `dscal_'
dlatrs.f:(.text+0x19e7): undefined reference to `dscal_'
/home/maks/lapack/liblapack.a(drscl.o): In function `drscl_':
drscl.f:(.text+0xef): undefined reference to `dscal_'
drscl.f:(.text+0x151): undefined reference to `dscal_'
/home/maks/lapack/liblapack.a(dtrtri.o): In function `dtrtri_':
dtrtri.f:(.text+0x141): undefined reference to `_gfortran_concat_string'
dtrtri.f:(.text+0x2b9): undefined reference to `dtrmm_'
dtrtri.f:(.text+0x32c): undefined reference to `dtrsm_'
dtrtri.f:(.text+0x64a): undefined reference to `dtrmm_'
dtrtri.f:(.text+0x6f0): undefined reference to `dtrsm_'
/home/maks/lapack/liblapack.a(ilaenv.o): In function `ilaenv_':
ilaenv.f:(.text+0x94): undefined reference to `_gfortran_compare_string'
ilaenv.f:(.text+0xb3): undefined reference to `_gfortran_compare_string'
ilaenv.f:(.text+0xd2): undefined reference to `_gfortran_compare_string'
ilaenv.f:(.text+0xf1): undefined reference to `_gfortran_compare_string'
ilaenv.f:(.text+0x110): undefined reference to `_gfortran_compare_string'
/home/maks/lapack/liblapack.a(ilaenv.o):ilaenv.f:(.text+0x12f): more undefined references to `_gfortran_compare_string' follow
/home/maks/lapack/liblapack.a(dgetf2.o): In function `dgetf2_':
dgetf2.f:(.text+0x1d1): undefined reference to `idamax_'
dgetf2.f:(.text+0x225): undefined reference to `dswap_'
dgetf2.f:(.text+0x396): undefined reference to `dger_'
dgetf2.f:(.text+0x418): undefined reference to `dscal_'
/home/maks/lapack/liblapack.a(dtrti2.o): In function `dtrti2_':
dtrti2.f:(.text+0x19b): undefined reference to `dtrmv_'
dtrti2.f:(.text+0x1c1): undefined reference to `dscal_'
dtrti2.f:(.text+0x360): undefined reference to `dtrmv_'
dtrti2.f:(.text+0x38d): undefined reference to `dscal_'
collect2: ld returned 1 exit status
make[1]: *** [../lmp_openmpi] Ошибка 1
make[1]: Выход из каталога `/home/maks/lammps-9Nov11/src/Obj_openmpi'
make: *** [openmpi] Ошибка 2
[email protected]...:~/lammps-9Nov11/src$

2011/12/14 Maxim <[email protected]...>:

When compile atc lib i set in ССFLAGS -fpermissive, because i give error that recommend to set it.

what error? where? never *ever* trust a compiler suggestion blindly.
particularly using the -fpermissive option is often hiding the real problem
and will lead to a crash later on. what version of GCC are you using?
and on what platform?

1) I set syspath to blaslib in lapack. - get this error
2) Compile separate BLAS and link to it. - get this error (in both case name set to libblas.a )
3) don't link any lib, (-llapack, -lblas stay) then not found -llapack and -lblas error

...
ariable.o velocity.o verlet.o write_restart.o -latc -lfftw -lblas -llapack -lstdc++ -o ../lmp_openmpi

1) your order of linking is wrong. use: -llapack -lblas

2) lapack and blas are fortran libraries, so you need to add the fortran
   runtime library to the linker line. it only is added automatically, if you
   link with the fortran compiler, but you have to link LAMMPS with the
   C++ compiler (and hence adding -lstdc++ is redundant, BTW).
   in short: add -lgfortran (but *after* -lblas, since BLAS depends on it)

axel.

Maxim, did you modify the makefiles that came with the package? If you have different compilers, you may have a different fortran compiler, so you should confirm your fortran compiler, blas, and lapack are where you think they are. Also, every time I have seen a compiler has suggested using -fpermissive, it was always a bad idea.
Jeremy