WRF | unrecognized command line option ‘-f90=gfortran’ & ungrib.exe compile error

Issue

When compiling WPSv4.0/v4.2/v3.8.1

gfortran: error: unrecognized command line option ‘-f90=gfortran’

Solution

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# Settings for    Linux x86_64 ppc64le, gfortran compiler with gcc   (dmpar)
#
DESCRIPTION = GNU ($SFC/$SCC)
DMPARALLEL = 1
OMPCPP = # -D_OPENMP
OMP = # -fopenmp
OMPCC = # -fopenmp
SFC = gfortran
SCC = gcc
CCOMP = gcc
DM_FC = mpif90 -f90=gfortran
DM_CC = mpicc -cc=$(SCC)
FC = $(DM_FC)
CC = $(DM_CC) -DFSEEKO64_OK
LD = $(FC)

modify DM_FC to

DM_FC = mpif90

without -f90-gfortran

Finally,

  1. geogrid.exe and metgrid.exe
  2. link_grib.csh

are generated.

But, no ungrib.exe !!!

Error

Error: Arguments of ‘iand’ have different kind type parameters at (1)

References

  1. (RESOLVED) ungrib.exe compile error: Arguments of ‘iand’ have different kind type parameters at (1)ted
  2. (RESOLVED) Not generating ungrib.exe

Solution

Fix mismatch integer kind in IAND intrinsic calls in g2 librar

ungrib/src/ngl/g2/intmath.f

1
2
3
4
5
6
ilog2_2=0
i=i_in
if(i<=0) return
if(iand(i,i-1)/=0) then
!write(0,*) 'iand i-1'
ilog2_2=1

to

1
2
3
4
5
6
7
8
      ilog2_2=0
i=i_in
if(i<=0) return
! WPS modification for the XL compiler
! if(iand(i,i-1)/=0) then
if(iand(i,i-1_2)/=0) then
!write(0,*) 'iand i-1'
ilog2_2=1
And,
1
2
3
4
5
6
ilog2_1=0
i=i_in
if(i<=0) return
if(iand(i,i-1)/=0) then
!write(0,*) 'iand i-1'
ilog2_1=1
to
1
2
3
4
5
6
7
8
      ilog2_1=0
i=i_in
if(i<=0) return
! WPS modification for the XL compiler
! if(iand(i,i-1)/=0) then
if(iand(i,i-1_1)/=0) then
!write(0,*) 'iand i-1'
ilog2_1=1

Works!!!


WRF | unrecognized command line option ‘-f90=gfortran’ & ungrib.exe compile error
https://waipangsze.github.io/2024/05/29/WPS_install_gfortran_error/
Author
wpsze
Posted on
May 29, 2024
Updated on
November 15, 2024
Licensed under