Opened 4 years ago

Closed 4 years ago

#60954 closed defect (fixed)

ESMF does not build with gcc10 (in gcc10 and gfortran variants)

Reported by: platipodium (Carsten Lemmen) Owned by: tenomoto (Takeshi Enomoto)
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc:
Port: esmf

Description

gcc10 is pickier with types and fails to build ESMF resulting in type mismatches

v:info:build /opt/local/bin/mpif90-mpich-mp -c -Os -O   -m64 -mcmodel=small -ffree-line-length-none  -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_esmf/esmf/work/esmf-8_0_1/build_config/Darwin.gfortran.default -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_esmf/esmf/work/esmf-8_0_1/src/Infrastructure -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_esmf/esmf/work/esmf-8_0_1/src/Superstructure -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_esmf/esmf/work/esmf-8_0_1/mod/modO/Darwin.gfortran.64.mpich2.default -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_esmf/esmf/work/esmf-8_0_1/src/include -I/opt/local/include -I/opt/local/include  -DESMF_NO_INTEGER_1_BYTE -DESMF_NO_INTEGER_2_BYTE -DESMF_LAPACK=1 -DESMF_MOAB=1 -DESMF_NO_ACC_SOFTWARE_STACK=1 -DESMF_NETCDF=1 -DESMF_XERCES=1 -DESMF_YAMLCPP=1 -DESMF_YAML=1 -DESMF_PIO=1 -DESMF_MPIIO -DESMF_NO_PTHREADS -DESMF_NO_OPENMP -DESMF_NO_OPENACC -DESMF_BOPT_O -DESMF_TESTCOMPTUNNEL -DSx86_64_small=1 -DESMF_OS_Darwin=1 -DESMF_COMM=mpich2 -DESMF_DIR=/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_esmf/esmf/work/esmf-8_0_1 -DESMF_NO_MPI3 /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_esmf/esmf/work/esmf-8_0_1/src/Infrastructure/Util/src/ESMF_FortranWordsize.F90 -o /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_esmf/esmf/work/esmf-8_0_1/obj/objO/Darwin.gfortran.64.mpich2.default/ESMF_FortranWordsize.o
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_science_esmf/esmf/work/esmf-8_0_1/src/Infrastructure/Util/src/ESMF_FortranWordsize.F90:361:50:
:info:build   361 |  call ESMF_PointerDifference(C_SIZEOF (c_ptrvar), varTK(1), varTK(2), wsize)
:info:build       |                                                  1
:info:build ......
:info:build   406 |  call ESMF_PointerDifference(C_SIZEOF (c_ptrvar), varTK(1), varTK(2), wsize)
:info:build       |                                                  2
:info:build Error: Type mismatch between actual argument at (1) and actual argument at (2) (REAL(4)/REAL(8)).

Attachments (1)

Portfile.patch (2.6 KB) - added by platipodium (Carsten Lemmen) 4 years ago.
Patch to portfile adding the suggested workaround compile options

Download all attachments as: .zip

Change History (7)

comment:1 Changed 4 years ago by platipodium (Carsten Lemmen)

Upstream developers are aware of the issue with the stricter argument type checking by default in GCC 10.x. A workaround for this issue is documented under the Platform-sepcific Known Bugs section for ESMF 8.0.0 (http://www.earthsystemmodeling.org/download/data/releases.shtml#8_0_0):

For GNU compilers GCC>=10.x, the default Fortran argument mismatch checking has become stricter. This will result in build failures. The work-around is to set environment variable

ESMF_F90COMPILEOPTS="-fallow-argument-mismatch -fallow-invalid-boz"

comment:2 Changed 4 years ago by jmroot (Joshua Root)

Cc: takeshi@… removed
Owner: set to tenomoto
Status: newassigned

Changed 4 years ago by platipodium (Carsten Lemmen)

Attachment: Portfile.patch added

Patch to portfile adding the suggested workaround compile options

comment:3 Changed 4 years ago by tenomoto (Takeshi Enomoto)

I am aware that gfortran10 is stricter and Portfile already incorporated the option (-fallow-argument-mismatch is sufficient). You are using mpif90-mpich-mp. The current Portfile fails to detect the version of gfortran. Checking gfortran and gfortran10 correctly detects the gfortran version behind mpif90, but gfortran could be other version and checking for gfortran1x variants need to be added in the future. I'll see there is a better solution.

comment:4 Changed 4 years ago by tenomoto (Takeshi Enomoto)

The source code of group mpi-1.0 gave me a hint. I can get the name of fortran compiler by calling fortran_compiler_name() in group compilers-1.0. I'll test with gfortran and with mpi. It take a while on my Mac mini 2012.

comment:5 Changed 4 years ago by tenomoto (Takeshi Enomoto)

It turned out that all I have to do is to add

compilers.allow_arguments_mismatch yes

comment:6 Changed 4 years ago by tenomoto (Takeshi Enomoto)

Resolution: fixed
Status: assignedclosed

In 0dad9cfe9cc9266c95dd9f8f051c9aaf3e7a7e27/macports-ports (master):

esmf: fix build with mpi compiler

Closes: #60954

Note: See TracTickets for help on using tickets.