MEGAN 2.1 installation errors

Hello there. Im trying to compile and run Megan 2.1 with the pgf90 compiler.

First all, I had the IOAPI and netcdf libraries already installed but with ifort. Is it necessary to reinstall them with pgf90?

Besides that, I have compiling errors (I believe not related).

Removing *.o
Make all programs
pgf90 -c -O -Mbyteswapio -Mextend -Mlfs -Msecond_underscore -I/home/sol/Build_CMAQ/src/ioapi/ioapi/fixed_src met2mgn.f
pgf90 -c -O -Mextend -Mlfs -Msecond_underscore -I/home/sol/Build_CMAQ/src/ioapi/ioapi/fixed_src readpar.f
NVFORTRAN-S-0188-Argument number 3 to open3: type mismatch (readpar.f: 332)
  0 inform,   0 warnings,   1 severes, 0 fatal for readpar
make: *** [makefile:36: readpar.o] Error 2

I believe this is due to the fact that pgname is not defined in readpar.f. So I added:, in line 22 of readpar.f:

CHARACTER*16, PARAMETER :: pgname = ‘READPAR’

But then I got the following error:

Removing *.o
Make all programs
pgf90 -c -O -Mbyteswapio -Mextend -Mlfs -Msecond_underscore -I/home/sol/Build_CMAQ/src/ioapi/ioapi/fixed_src met2mgn.f
pgf90 -c -O -Mextend -Mlfs -Msecond_underscore -I/home/sol/Build_CMAQ/src/ioapi/ioapi/fixed_src readpar.f
NVFORTRAN-W-0025-Illegal character (E2) - ignored (readpar.f: 22)
NVFORTRAN-W-0025-Illegal character (80) - ignored (readpar.f: 22)
NVFORTRAN-W-0025-Illegal character (98) - ignored (readpar.f: 22)
NVFORTRAN-W-0025-Illegal character (99) - ignored (readpar.f: 22)
NVFORTRAN-S-0087-Non-constant expression where constant expression required (readpar.f: 22)
  0 inform,   4 warnings,   1 severes, 0 fatal for readpar
make: *** [makefile:36: readpar.o] Error 2

Im a bit confused here.

After that Im having multiple errors of the kind:

/usr/bin/ld: /home/sol/Build_CMAQ/src/ioapi/Linux2_x86_64ifort/libioapi.a(dscgrid.o): in function `dscoord_':
dscgrid.f:(.text+0x92): undefined reference to `for_write_int_fmt'
/usr/bin/ld: dscgrid.f:(.text+0xb5): undefined reference to `for_write_int_fmt_xmit'
/usr/bin/ld: dscgrid.f:(.text+0xe0): undefined reference to `for_write_int_fmt_xmit'
/usr/bin/ld: dscgrid.f:(.text+0xfc): undefined reference to `for_write_int_fmt_xmit'
/usr/bin/ld: dscgrid.f:(.text+0x13d): undefined reference to `for_cpystr'
/usr/bin/ld: /home/sol/Build_CMAQ/src/ioapi/Linux2_x86_64ifort/libioapi.a(dscgrid.o): in function `dscgrid_':
dscgrid.f:(.text+0x1f9): undefined reference to `for_len_trim'
/usr/bin/ld: dscgrid.f:(.text+0x255): undefined reference to `for_write_int_fmt'
/usr/bin/ld: dscgrid.f:(.text+0x286): undefined reference to `for_write_int_fmt_xmit'
/usr/bin/ld: dscgrid.f:(.text+0x2b1): undefined reference to `for_write_int_fmt_xmit'
/usr/bin/ld: dscgrid.f:(.text+0x2c0): undefined reference to `for_len_trim'
/usr/bin/ld: dscgrid.f:(.text+0x2de): undefined reference to `for_write_int_fmt_xmit'
/usr/bin/ld: dscgrid.f:(.text+0x327): undefined reference to `for_cpystr'
/usr/bin/ld: dscgrid.f:(.text+0x49d): undefined reference to `for_cpystr'
/usr/bin/ld: dscgrid.f:(.text+0x596): undefined reference to `for_trim'
/usr/bin/ld: dscgrid.f:(.text+0x5ee): undefined reference to `for_trim'
/usr/bin/ld: dscgrid.f:(.text+0x626): undefined reference to `for_concat'
/usr/bin/ld: dscgrid.f:(.text+0x6d3): undefined reference to `for_read_seq_fmt'
/usr/bin/ld: dscgrid.f:(.text+0x75b): undefined reference to `for_read_seq_lis'
/usr/bin/ld: dscgrid.f:(.text+0x7dd): undefined reference to `for_read_seq_lis'
/usr/bin/ld: dscgrid.f:(.text+0x817): undefined reference to `for_read_seq_lis_xmit'
/usr/bin/ld: dscgrid.f:(.text+0x851): undefined reference to `for_read_seq_lis_xmit'
/usr/bin/ld: dscgrid.f:(.text+0x88b): undefined reference to `for_read_seq_lis_xmit'
/usr/bin/ld: dscgrid.f:(.text+0x8c1): undefined reference to `for_read_seq_lis_xmit'
/usr/bin/ld: dscgrid.f:(.text+0x8f7): undefined reference to `for_read_seq_lis_xmit'
/usr/bin/ld: dscgrid.f:(.text+0x95c): undefined reference to `for_write_int_fmt'
/usr/bin/ld: dscgrid.f:(.text+0x97a): undefined reference to `for_write_int_fmt_xmit'
/usr/bin/ld: dscgrid.f:(.text+0x9a5): undefined reference to `for_write_int_fmt_xmit'
/usr/bin/ld: dscgrid.f:(.text+0x9c2): undefined reference to `for_write_int_fmt_xmit'
/usr/bin/ld: dscgrid.f:(.text+0xa45): undefined reference to `for_write_int_fmt'
/usr/bin/ld: dscgrid.f:(.text+0xa67): undefined reference to `for_write_int_fmt_xmit'
/usr/bin/ld: dscgrid.f:(.text+0xa92): undefined reference to `for_write_int_fmt_xmit'
/usr/bin/ld: dscgrid.f:(.text+0xab2): undefined reference to `for_write_int_fmt_xmit'
/usr/bin/ld: dscgrid.f:(.text+0xb29): undefined reference to `for_read_seq_lis'
/usr/bin/ld: dscgrid.f:(.text+0xbbe): undefined reference to `for_read_seq_lis'
/usr/bin/ld: dscgrid.f:(.text+0xbf8): undefined reference to `for_read_seq_lis_xmit'
/usr/bin/ld: dscgrid.f:(.text+0xc32): undefined reference to `for_read_seq_lis_xmit'
/usr/bin/ld: dscgrid.f:(.text+0xc6c): undefined reference to `for_read_seq_lis_xmit'
/usr/bin/ld: dscgrid.f:(.text+0xca6): undefined reference to `for_read_seq_lis_xmit'
/usr/bin/ld: dscgrid.f:(.text+0xce0): undefined reference to `for_read_seq_lis_xmit'

Maybe this is related to the fact that I have IOAPI compiled with ifort?

Thank you very much for your help
Kind regards
Solange

“Maybe this is related to the fact that I have IOAPI compiled with ifort?”:

Yes, different Fortran compilers use different compiler-vendor-supplied libraries to implement things like the Fortran WRITE command (and sometimes even different libraries for things like different comiler-options!). That is why, for example, the different I/O API binary types are mostly classified by what Fortran compiler is being used… You need to compile everything with the same compiler set (and ideally the same compile-flags). See https://www.cmascenter.org/ioapi/documentation/all_versions/html/ERRORS.html#ccfc

Thank you for your answer. Do you know if it is possible to compile Megan with ifort and, if that is the case, where can I find how to replace all flags?

Hello there.

So i recompiled everything with gfortran, but when I try to run the makefile I get a lot of errors, that I believe are not related to the compiler anymore.

Removing *.o
rm: No match.
rm: No match.
Make all programs
gfortran -c  -I/home/sol/Build_CMAQ/src/ioapi/ioapi/fixed_src met2mgn.f
fields.inc:43:72:

   43 |      &     lucx(mnxc,mnyc,11)
      |                                                                        1
Error: Expected another dimension in array declaration at (1)
fields.inc:49:70:

   49 |      &                 cod,rain,pstar,tsfc,rground,pblc,z0c,topcx,lucx
      |                                                                      1
Error: Symbol ‘lucx’ at (1) has no IMPLICIT type
fields.inc:49:55:

   49 |      &                 cod,rain,pstar,tsfc,rground,pblc,z0c,topcx,lucx
      |                                                       1
Error: Symbol ‘pblc’ at (1) has no IMPLICIT type; did you mean ‘pbl’?
fields.inc:49:37:

   49 |      &                 cod,rain,pstar,tsfc,rground,pblc,z0c,topcx,lucx
      |                                     1
Error: Symbol ‘pstar’ at (1) has no IMPLICIT type; did you mean ‘istat’?
fields.inc:49:31:

   49 |      &                 cod,rain,pstar,tsfc,rground,pblc,z0c,topcx,lucx
      |                               1
Error: Symbol ‘rain’ at (1) has no IMPLICIT type; did you mean ‘rainr’?
fields.inc:49:50:

   49 |      &                 cod,rain,pstar,tsfc,rground,pblc,z0c,topcx,lucx
      |                                                  1
Error: Symbol ‘rground’ at (1) has no IMPLICIT type; did you mean ‘rgrnd’?
fields.inc:49:65:

   49 |      &                 cod,rain,pstar,tsfc,rground,pblc,z0c,topcx,lucx
      |                                                                 1
Error: Symbol ‘topcx’ at (1) has no IMPLICIT type; did you mean ‘topo’?
fields.inc:49:42:

   49 |      &                 cod,rain,pstar,tsfc,rground,pblc,z0c,topcx,lucx
      |                                          1
Error: Symbol ‘tsfc’ at (1) has no IMPLICIT type; did you mean ‘tac’?
fields.inc:49:59:

   49 |      &                 cod,rain,pstar,tsfc,rground,pblc,z0c,topcx,lucx
      |                                                           1
Error: Symbol ‘z0c’ at (1) has no IMPLICIT type; did you mean ‘z0’?
make: *** [makefile:44: met2mgn.o] Error 1
gfortran -O3 -ffixed-line-length-132 -ffast-math -funroll-loops -m64 -fopenmp -I/home/sol/Build_CMAQ/src/ioapi/ioapi/fixed_src -I/home/sol/Build_CMAQ/LIBRARIES/netcdf/include -I/home/sol/MEGANv2.10_beta/MEGANv2.10/src/TXT2IOAPI/INCLDIR -c -o parsline.o parsline.f
gfortran -O3 -ffixed-line-length-132 -ffast-math -funroll-loops -m64 -fopenmp -I/home/sol/Build_CMAQ/src/ioapi/ioapi/fixed_src -I/home/sol/Build_CMAQ/LIBRARIES/netcdf/include -I/home/sol/MEGANv2.10_beta/MEGANv2.10/src/TXT2IOAPI/INCLDIR -c -o checkmem.o checkmem.f
gfortran -O3 -ffixed-line-length-132 -ffast-math -funroll-loops -m64 -fopenmp -I/home/sol/Build_CMAQ/src/ioapi/ioapi/fixed_src -I/home/sol/Build_CMAQ/LIBRARIES/netcdf/include -I/home/sol/MEGANv2.10_beta/MEGANv2.10/src/TXT2IOAPI/INCLDIR -c -o cnvt_efs.o cnvt_efs.F
cnvt_efs.F:51:14:

   51 |       INTEGER,         XREF(MXTCOL)
      |              1
Error: Invalid character in name at (1)
cnvt_efs.F:151:132:

  151 |         print*,'CID ',cid,inx,iny,xref
      |                                                                                                                                    1
Error: Function ‘xref’ requires an argument list at (1)
cnvt_efs.F:123:18:

  123 |                   XREF( S ) = 1
      |                  1
Error: Function ‘xref’ at (1) has no IMPLICIT type
cnvt_efs.F:124:25:

  124 |                   VNAME( XREF(S) ) = TRIM( MESG )
      |                         1
Error: Function ‘xref’ at (1) has no IMPLICIT type
cnvt_efs.F:126:18:

  126 |                   XREF( S ) = 2
      |                  1
Error: Function ‘xref’ at (1) has no IMPLICIT type
cnvt_efs.F:127:25:

  127 |                   VNAME( XREF(S) ) = TRIM( MESG )
      |                         1
Error: Function ‘xref’ at (1) has no IMPLICIT type
cnvt_efs.F:129:18:

  129 |                   XREF( S ) = 3
      |                  1
Error: Function ‘xref’ at (1) has no IMPLICIT type
cnvt_efs.F:130:25:

  130 |                   VNAME( XREF(S) ) = TRIM( MESG )
      |                         1
Error: Function ‘xref’ at (1) has no IMPLICIT type
cnvt_efs.F:132:18:

  132 |                   XREF( S ) = 4
      |                  1
Error: Function ‘xref’ at (1) has no IMPLICIT type
cnvt_efs.F:133:25:

  133 |                   VNAME( XREF(S) ) = TRIM( MESG )
      |                         1
Error: Function ‘xref’ at (1) has no IMPLICIT type
cnvt_efs.F:137:18:

  137 |                   XREF( S ) = N + 4
      |                  1
Error: Function ‘xref’ at (1) has no IMPLICIT type
cnvt_efs.F:138:25:

  138 |                   VNAME( XREF(S) ) = 'EF_'//TRIM( MESG )
      |                         1
Error: Function ‘xref’ at (1) has no IMPLICIT type
cnvt_efs.F:143:42:

  143 |                PRINT*,'READ VNAME:',VNAME(XREF(S))
      |                                          1
Error: Function ‘xref’ at (1) has no IMPLICIT type
cnvt_efs.F:157:18:

  157 |             IBUFF(XREF(S),INX,INY) = STR2REAL( SEGMENT( 3+S ) )  ! convert char to real
      |                  1
Error: Function ‘xref’ at (1) has no IMPLICIT type
make: *** [makefile:26: cnvt_efs.o] Error 1
gfortran -c -O3 -ffixed-line-length-132 -ffast-math -funroll-loops -m64 -fopenmp -I/home/sol/Build_CMAQ/src/ioapi/ioapi/fixed_src -I/home/sol/Build_CMAQ/LIBRARIES/netcdf/include -I/home/sol/MEGANv2.10_beta/MEGANv2.10/src/EMPROC/INCLDIR gamma_etc.f
EACO.EXT:487:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:486:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:485:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:484:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:483:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:482:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:481:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:480:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:479:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:478:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:477:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:476:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:475:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:474:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:473:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:472:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:351:16:

Warning: Initialization string at (1) was truncated to fit the variable (16/18)
EACO.EXT:184:16:

Warning: Initialization string at (1) was truncated to fit the variable (16/18)
EACO.EXT:119:16:

Warning: Initialization string at (1) was truncated to fit the variable (16/18)
EACO.EXT:37:16:

Warning: Initialization string at (1) was truncated to fit the variable (16/18)
EACO.EXT:487:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:486:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:485:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:484:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:483:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:482:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:481:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:480:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:479:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:478:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:477:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:476:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:475:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:474:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:473:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:472:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:351:16:

Warning: Initialization string at (1) was truncated to fit the variable (16/18)
EACO.EXT:184:16:

Warning: Initialization string at (1) was truncated to fit the variable (16/18)
EACO.EXT:119:16:

Warning: Initialization string at (1) was truncated to fit the variable (16/18)
EACO.EXT:37:16:

Warning: Initialization string at (1) was truncated to fit the variable (16/18)
EACO.EXT:487:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:486:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:485:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:484:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:483:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:482:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:481:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:480:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:479:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:478:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:477:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:476:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:475:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:474:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:473:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:472:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:351:16:

Warning: Initialization string at (1) was truncated to fit the variable (16/18)
EACO.EXT:184:16:

Warning: Initialization string at (1) was truncated to fit the variable (16/18)
EACO.EXT:119:16:

Warning: Initialization string at (1) was truncated to fit the variable (16/18)
EACO.EXT:37:16:

Warning: Initialization string at (1) was truncated to fit the variable (16/18)
gfortran -c -O3 -ffixed-line-length-132 -ffast-math -funroll-loops -m64 -fopenmp -I/home/sol/Build_CMAQ/src/ioapi/ioapi/fixed_src -I/home/sol/Build_CMAQ/LIBRARIES/netcdf/include -I/home/sol/MEGANv2.10_beta/MEGANv2.10/src/EMPROC/INCLDIR checkmem.f
gfortran -c -O3 -ffixed-line-length-132 -ffast-math -funroll-loops -m64 -fopenmp -I/home/sol/Build_CMAQ/src/ioapi/ioapi/fixed_src -I/home/sol/Build_CMAQ/LIBRARIES/netcdf/include -I/home/sol/MEGANv2.10_beta/MEGANv2.10/src/EMPROC/INCLDIR canopy.f
canopy.f:168:132:

  168 |      &              NrTyp)
      |                                                                                                                                    1
Warning: Type mismatch in argument ‘cantype’ at (1); passed REAL(4) to INTEGER(4) [-Wargument-mismatch]
canopy.f:172:18:

  172 |       Trate    =  Stability(Canopychar, Cantype, Solar , NrCha, NrTyp)
      |                  1
Warning: Type mismatch in argument ‘cantype’ at (1); passed REAL(4) to INTEGER(4) [-Wargument-mismatch]
canopy.f:179:132:

  179 |      &                NrCha, NrTyp, Ws0, TairK0, HumidairPa0)
      |                                                                                                                                    1
Warning: Type mismatch in argument ‘cantype’ at (1); passed REAL(4) to INTEGER(4) [-Wargument-mismatch]
EACO.EXT:487:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:486:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:485:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:484:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:483:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:482:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:481:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:480:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:479:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:478:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:477:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:476:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:475:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:474:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:473:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:472:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:351:16:

Warning: Initialization string at (1) was truncated to fit the variable (16/18)
EACO.EXT:184:16:

Warning: Initialization string at (1) was truncated to fit the variable (16/18)
EACO.EXT:119:16:

Warning: Initialization string at (1) was truncated to fit the variable (16/18)
EACO.EXT:37:16:

Warning: Initialization string at (1) was truncated to fit the variable (16/18)
gfortran -c -O3 -ffixed-line-length-132 -ffast-math -funroll-loops -m64 -fopenmp -I/home/sol/Build_CMAQ/src/ioapi/ioapi/fixed_src -I/home/sol/Build_CMAQ/LIBRARIES/netcdf/include -I/home/sol/MEGANv2.10_beta/MEGANv2.10/src/EMPROC/INCLDIR solarangle.f
gfortran -c -O3 -ffixed-line-length-132 -ffast-math -funroll-loops -m64 -fopenmp -I/home/sol/Build_CMAQ/src/ioapi/ioapi/fixed_src -I/home/sol/Build_CMAQ/LIBRARIES/netcdf/include -I/home/sol/MEGANv2.10_beta/MEGANv2.10/src/EMPROC/INCLDIR findlai.f
gfortran -c -O3 -ffixed-line-length-132 -ffast-math -funroll-loops -m64 -fopenmp -I/home/sol/Build_CMAQ/src/ioapi/ioapi/fixed_src -I/home/sol/Build_CMAQ/LIBRARIES/netcdf/include -I/home/sol/MEGANv2.10_beta/MEGANv2.10/src/EMPROC/INCLDIR soilnox_fx.F
gfortran -c -O3 -ffixed-line-length-132 -ffast-math -funroll-loops -m64 -fopenmp -I/home/sol/Build_CMAQ/src/ioapi/ioapi/fixed_src -I/home/sol/Build_CMAQ/LIBRARIES/netcdf/include -I/home/sol/MEGANv2.10_beta/MEGANv2.10/src/EMPROC/INCLDIR soilnox.F
gfortran -c -O3 -ffixed-line-length-132 -ffast-math -funroll-loops -m64 -fopenmp -I/home/sol/Build_CMAQ/src/ioapi/ioapi/fixed_src -I/home/sol/Build_CMAQ/LIBRARIES/netcdf/include -I/home/sol/MEGANv2.10_beta/MEGANv2.10/src/EMPROC/INCLDIR emproc.F
CONST_MEGAN.EXT:28:36:

Error: Element in REAL(4) array constructor at (1) is INTEGER(4)
emproc.F:652:45:

  652 |      &                 NrCha,NrTyp,Canopychar, VNAME3D(s),
      |                                             1
Error: Symbol ‘canopychar’ at (1) has no IMPLICIT type
EACO.EXT:487:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:486:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:485:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:484:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:483:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:482:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:481:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:480:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:479:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:478:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:477:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:476:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:475:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:474:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:473:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:472:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
EACO.EXT:351:16:

Warning: Initialization string at (1) was truncated to fit the variable (16/18)
EACO.EXT:184:16:

Warning: Initialization string at (1) was truncated to fit the variable (16/18)
EACO.EXT:119:16:

Warning: Initialization string at (1) was truncated to fit the variable (16/18)
EACO.EXT:37:16:

Warning: Initialization string at (1) was truncated to fit the variable (16/18)
make: *** [makefile:46: emproc.o] Error 1
gfortran -c -O3 -ffixed-line-length-132 -ffast-math -funroll-loops -m64 -fopenmp -I/home/sol/Build_CMAQ/src/ioapi/ioapi/fixed_src -I/home/sol/Build_CMAQ/LIBRARIES/netcdf/include -I/home/sol/MEGANv2.10_beta/MEGANv2.10/src/MGN2MECH/INCLDIR checkmem.f
gfortran -c -O3 -ffixed-line-length-132 -ffast-math -funroll-loops -m64 -fopenmp -I/home/sol/Build_CMAQ/src/ioapi/ioapi/fixed_src -I/home/sol/Build_CMAQ/LIBRARIES/netcdf/include -I/home/sol/MEGANv2.10_beta/MEGANv2.10/src/MGN2MECH/INCLDIR growseason.f
gfortran -c -O3 -ffixed-line-length-132 -ffast-math -funroll-loops -m64 -fopenmp -I/home/sol/Build_CMAQ/src/ioapi/ioapi/fixed_src -I/home/sol/Build_CMAQ/LIBRARIES/netcdf/include -I/home/sol/MEGANv2.10_beta/MEGANv2.10/src/MGN2MECH/INCLDIR mgn2mech.F
EFS_PFT.EXT:64:41:

Error: Element in REAL(4) array constructor at (1) is INTEGER(4)
PFT_MGN.EXT:53:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
PFT_MGN.EXT:52:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
PFT_MGN.EXT:51:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
PFT_MGN.EXT:50:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
PFT_MGN.EXT:49:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
PFT_MGN.EXT:48:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
PFT_MGN.EXT:47:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
PFT_MGN.EXT:46:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
PFT_MGN.EXT:45:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
PFT_MGN.EXT:44:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
PFT_MGN.EXT:43:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
PFT_MGN.EXT:42:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
PFT_MGN.EXT:41:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
PFT_MGN.EXT:40:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
PFT_MGN.EXT:39:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
PFT_MGN.EXT:38:30:

Warning: Initialization string at (1) was truncated to fit the variable (16/36)
SPC_NOCONVER.EXT:530:13:

Warning: Initialization string at (1) was truncated to fit the variable (16/18)
mgn2mech.F:578:16:

  578 |            IF ( ef_all(1,nmpmg) .LT. 0.0) THEN
      |                1
Error: Function ‘ef_all’ at (1) has no IMPLICIT type
mgn2mech.F:598:35:

  598 |                TMP3 = TMP3 + ef_all(I,nmpmg) * effs_all(I,nmpsp)
      |                                   1
Error: Function ‘ef_all’ at (1) has no IMPLICIT type
mgn2mech.F:608:15:

  608 |            IF (ef_all(1,INO) .LT. 0.0) THEN
      |               1
Error: Function ‘ef_all’ at (1) has no IMPLICIT type
mgn2mech.F:621:17:

  621 |              IF (ef_all(1,INO) .LT. 0.0) THEN
      |                 1
Error: Function ‘ef_all’ at (1) has no IMPLICIT type
mgn2mech.F:631:49:

  631 |                  G2CRatio = ef_all(14,INO)/ef_all(I,INO)
      |                                                 1
Error: Function ‘ef_all’ at (1) has no IMPLICIT type
mgn2mech.F:647:37:

  647 |                  TMO3 = TMO3 + ef_all(I,INO)*effs_all(I,nmpsp)
      |                                     1
Error: Function ‘ef_all’ at (1) has no IMPLICIT type
mgn2mech.F:651:37:

  651 |                  TMO3 = TMO3 + ef_all(14,INO) * effs_all(I,nmpsp)
      |                                     1
Error: Function ‘ef_all’ at (1) has no IMPLICIT type
mgn2mech.F:663:17:

  663 |              IF (ef_all(1,INO) .LT. 0.0) THEN
      |                 1
Error: Function ‘ef_all’ at (1) has no IMPLICIT type
mgn2mech.F:690:37:

  690 |                  TMO3 = TMO3 + ef_all(I,INO)*effs_all(I,nmpsp)*
      |                                     1
Error: Function ‘ef_all’ at (1) has no IMPLICIT type
mgn2mech.F:694:37:

  694 |                  TMO3 = TMO3 + ef_all(I,INO)*effs_all(I,nmpsp)*
      |                                     1
Error: Function ‘ef_all’ at (1) has no IMPLICIT type
make: *** [makefile:31: mgn2mech.o] Error 1
gfortran -O3 -ffixed-line-length-132 -ffast-math -funroll-loops -m64 -fopenmp -I/home/sol/Build_CMAQ/src/ioapi/ioapi/fixed_src -c -o ioapi2uam.o ioapi2uam.f
ioapi2uam.f:165:19:

  165 |       write(*,'(2(i,f))') ibdate,btime,iedate,etime
      |                   1
Error: Nonnegative width required in format string at (1)
ioapi2uam.f:299:23:

  299 |         write(*,'(a,2(i,f))')'Writing ',ibdate,btime,iedate,etime
      |                       1
Error: Nonnegative width required in format string at (1)
make: *** [makefile:20: ioapi2uam.o] Error 1
Create symbolic links

Are these errors related to the compiler or are a whole different thing?

I see that there are similar question for Megan 3.2 where certain corrections to the code are suggested, but they are not the same errors that Im experiencing. Would you recommend change to Megan 3.2?

Thank you in advance

Which version of gfortran ? I suspect version 10 or later, since that version started taking/mandating its own idiosyncratic interpretations of the Fortran-2018 Standard.

Compare the I/O API’s ioapi/Makeinclude.Linux2_x86_64gfort10 with ioapi/Makeinclude.Linux2_x86_64gfort to see what changes to the compile-flags you will need for recent gfortrans.

Thank you for your answer.

Im actually using gfortran 9.4.0 so I believe that the “-fallow-argument-mismatch” flag is not needed.

I checked the flags in ioapi/Makeinclude.Linux2_x86_64gfort and I believe the flags Im using are correct.

In the make file:

## Module-include-directory command
MODI = -I
E132 = -ffixed-line-length-132

MFLAGS    = -ffast-math -funroll-loops -m64  #  -Wall -Wsurprising -march=native -mtune=native

OMPFLAGS  = -fopenmp
OMPLIBS   = -fopenmp
COPTFLAGS = -O3 ${MFLAGS}
FOPTFLAGS = -O3 ${MFLAGS}
FPPFLAGS  = -DF90=1
FSFLAGS   = -fno-automatic
ARCHFLAGS = \
 -DAUTO_ARRAYS=1 \
 -DF90=1 -DFLDMN=1 \
 -DFSTR_L=int \
 -DIOAPI_NO_STDOUT=1 \
 -DNEED_ARGS=1
PARFLAGS  =
ARCHLIB   = -dynamic -L/usr/lib64 -lm -lpthread -lc

And Im using:

FFLAGS = -O3 -ffixed-line-length-132 -ffast-math -funroll-loops -m64 -fopenmp

Am I missing something?

Hello, I also encountered the same problem when compiling with gcc. Have you solved it?

Hello there.

Yes, it used the flags mentioned in this thread, but I had to make a few changes in some scripts to make it work correctly. These are the changes I did:

cd IOAPI2UAM

diff ioapi2uam.f ioapi2uam.f.old 
165c165
<       write(*,'(2(i9,f10.2))') ibdate,btime,iedate,etime
---
>       write(*,'(2(i,f))') ibdate,btime,iedate,etime
299c299
<         write(*,'(a,2(i9,f10.2))')'Writing ',ibdate,btime,iedate,etime
---
>         write(*,'(a,2(i,f))')'Writing ',ibdate,btime,iedate,etime

cd ../MET2MGN

 diff readmcip.f readmcip.f.old 
34c34
<       logical MCIP_rad,SAT_par,ENVYN,INITIAL_HOUR,ifsoil,lfirst
---
>       logical MCIP_rad,SAT_par,ENVYN,INITIAL_HOUR,ifsoil
383c383
<             if(ifsoil) then
---
>             if(isoil) then

diff readpar.f readpar.f.old 
15,20c15,16
<       INTEGER, parameter   ::  mx=350
<       INTEGER, parameter   ::  my=410
<       INTEGER, parameter   ::  mz=30
<       INTEGER, parameter   ::  nlat=61
<       INTEGER, parameter   ::  nlon=121
< 
---
>       parameter   mx=350,my=410,mz=30
>       parameter   nlat=61,nlon=121

cd ../TXT2IOAPI

diff cnvt_efs.F cnvt_efs.F.old 
51c51
<       INTEGER :: XREF(MXTCOL)
---
>       INTEGER,         XREF(MXTCOL)

diff cnvt_pft.F cnvt_pft.F.old 
55c55
<       INTEGER :: XREF(NFLD)
---
>       INTEGER,         XREF(NFLD)

 diff cnvt_lai.F cnvt_lai.F.old 
55c55
<       INTEGER :: XREF(NFLD)
---
>       INTEGER,         XREF(NFLD)

Hope it works!

2 Likes

Hi, SoIL, thank you very much, your suggestion is very useful!

By the way, have you made any changes to the EMPROC compilation? I encountered a warning when compiling:
canopy.f:166:43:
166| & Qdiffv,Obeamn, Qdiffn, Cantype, Canopychar, Sunfrac,
Warning:Dummy arguement ‘canpychar’ with INTENT(IN) in variable definition context(actual arguement to INTENT=OUT/INOUT) at (1)

Looking forward to your reply

Hello.

I dont remember encountering this problem. I believe that depending on which version compiler is being used, errors and warnings can be different.

What I get from this warning is that canpycar is declared as intent(in) and that means that that variable should not be updated but it somehow is somewhere in the script.

Maybe declaring it as intent(inout) would solve it.