schism-dev / schism-esmf

Earth System Modeling Framework cap for SCHISM
5 stars 6 forks source link

multiple definition of `dswap_' in alpaca library #17

Closed platipodium closed 2 years ago

platipodium commented 2 years ago

I also tried with gfortran+openmpi, the following error always appears when compiling. (I tried lapack/blas, atlas, openblas) I saw your todo in Makefile for gfortran, do you have similar errors?

./libschism_esmf.a(lap.F90.o): In function `dswap_':
lap.F90:(.text+0x0): multiple definition of `dswap_'
./libschism_esmf.a(lap.F90.o): In function `dswap_':
lap.F90:(.text+0x0): multiple definition of `dswap_'
./lib/libblas.a(dswap.o):dswap.f:(.text+0x0): first defined here
./libschism_esmf.a(lap.F90.o): In function `ddot_':
lap.F90:(.text+0x180): multiple definition of `ddot_'
./lib/libblas.a(ddot.o):ddot.f:(.text+0x0): first defined here
./libschism_esmf.a(lap.F90.o): In function `dcopy_':
lap.F90:(.text+0x370): multiple definition of `dcopy_'
./lib/libblas.a(dcopy.o):dcopy.f:(.text+0x0): first defined here
./libschism_esmf.a(lap.F90.o): In function `lsame_':
lap.F90:(.text+0x5a0): multiple definition of `lsame_'
./lib/liblapack.a(lsame.o):lsame.f:(.text+0x0): first defined here
./libschism_esmf.a(lap.F90.o): In function `dscal_':
lap.F90:(.text+0xcf0): multiple definition of `dscal_'
./lib/libblas.a(dscal.o):dscal.f:(.text+0x0): first defined here
./libschism_esmf.a(lap.F90.o): In function `idamax_':
lap.F90:(.text+0x1170): multiple definition of `idamax_'
./lib/libblas.a(idamax.o):idamax.f:(.text+0x0): first defined here
collect2: error: ld returned 1 exit status
make: *** [Makefile:117: schism_pdaf] Error 1
platipodium commented 2 years ago

I have not seen this error, but I believe that this is possibly related to your ESMF installation depending on your ESMF_LAPACK setting. I suspect this is set to „internal“ (please check!) and therefore loads the routines both from inside ESMF code and from the -libmath included with gcc….

platipodium commented 2 years ago

I figure out this error is due to multi-definition from LAPACK and schism/lap.F90 for certain routines, both define the same subroutine like dswap.... ce861ad should fix this, and I also add some changes for Rules.mk. For ESMF_LAPACK, I use default (set to internal) for testing.