# MEGAN 2.1 installation errors

**URL:** <https://forum.cmascenter.org/t/megan-2-1-installation-errors/4471>\
**Category:** MEGAN\
**Created:** [October 9, 2023, 5:41pm UTC](https://forum.cmascenter.org/t/megan-2-1-installation-errors/4471 "2023-10-09T17:41:47Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![SolL](https://avatars.discourse-cdn.com/v4/letter/s/9fc348/32.png) [@SolL](https://forum.cmascenter.org/u/SolL)\
**Post date:** [October 9, 2023, 5:41pm UTC](https://forum.cmascenter.org/t/megan-2-1-installation-errors/4471/1 "2023-10-09T17:41:47Z")

</div>

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).

```auto
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:

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

```

But then I got the following error:

```auto
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:

```auto
/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

---

<div class="post-metadata">

**Author:** ![cjcoats](https://avatars.discourse-cdn.com/v4/letter/c/ac8455/32.png) [@cjcoats](https://forum.cmascenter.org/u/cjcoats)\
**Post date:** [October 9, 2023, 6:03pm UTC](https://forum.cmascenter.org/t/megan-2-1-installation-errors/4471/2 "2023-10-09T18:03:49Z")

</div>

> “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](https://www.cmascenter.org/ioapi/documentation/all_versions/html/ERRORS.html#ccfc)

---

<div class="post-metadata">

**Author:** ![SolL](https://avatars.discourse-cdn.com/v4/letter/s/9fc348/32.png) [@SolL](https://forum.cmascenter.org/u/SolL)\
**Post date:** [October 9, 2023, 6:09pm UTC](https://forum.cmascenter.org/t/megan-2-1-installation-errors/4471/3 "2023-10-09T18:09:54Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![SolL](https://avatars.discourse-cdn.com/v4/letter/s/9fc348/32.png) [@SolL](https://forum.cmascenter.org/u/SolL)\
**Post date:** [November 1, 2023, 8:28pm UTC](https://forum.cmascenter.org/t/megan-2-1-installation-errors/4471/4 "2023-11-01T20:28:39Z")

</div>

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.

```auto
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

---

<div class="post-metadata">

**Author:** ![cjcoats](https://avatars.discourse-cdn.com/v4/letter/c/ac8455/32.png) [@cjcoats](https://forum.cmascenter.org/u/cjcoats)\
**Post date:** [November 1, 2023, 8:48pm UTC](https://forum.cmascenter.org/t/megan-2-1-installation-errors/4471/5 "2023-11-01T20:48:18Z")

</div>

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 _gfortran_s.

---

<div class="post-metadata">

**Author:** ![SolL](https://avatars.discourse-cdn.com/v4/letter/s/9fc348/32.png) [@SolL](https://forum.cmascenter.org/u/SolL)\
**Post date:** [November 1, 2023, 9:25pm UTC](https://forum.cmascenter.org/t/megan-2-1-installation-errors/4471/6 "2023-11-01T21:25:58Z")

</div>

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:

```auto
## 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:

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

```

Am I missing something?

---

<div class="post-metadata">

**Author:** ![Zhu](https://avatars.discourse-cdn.com/v4/letter/z/8dc957/32.png) [@Zhu](https://forum.cmascenter.org/u/Zhu)\
**Post date:** [June 24, 2024, 2:48am UTC](https://forum.cmascenter.org/t/megan-2-1-installation-errors/4471/7 "2024-06-24T02:48:36Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![SolL](https://avatars.discourse-cdn.com/v4/letter/s/9fc348/32.png) [@SolL](https://forum.cmascenter.org/u/SolL)\
**Post date:** [June 24, 2024, 3:58pm UTC](https://forum.cmascenter.org/t/megan-2-1-installation-errors/4471/8 "2024-06-24T15:58:57Z")

</div>

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:

```auto
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

```

```auto
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

```

```auto
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!

---

<div class="post-metadata">

**Author:** ![Zhu](https://avatars.discourse-cdn.com/v4/letter/z/8dc957/32.png) [@Zhu](https://forum.cmascenter.org/u/Zhu)\
**Post date:** [June 25, 2024, 1:08am UTC](https://forum.cmascenter.org/t/megan-2-1-installation-errors/4471/9 "2024-06-25T01:08:42Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Zhu](https://avatars.discourse-cdn.com/v4/letter/z/8dc957/32.png) [@Zhu](https://forum.cmascenter.org/u/Zhu)\
**Post date:** [June 25, 2024, 1:16am UTC](https://forum.cmascenter.org/t/megan-2-1-installation-errors/4471/10 "2024-06-25T01:16:29Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![SolL](https://avatars.discourse-cdn.com/v4/letter/s/9fc348/32.png) [@SolL](https://forum.cmascenter.org/u/SolL)\
**Post date:** [June 26, 2024, 12:05pm UTC](https://forum.cmascenter.org/t/megan-2-1-installation-errors/4471/11 "2024-06-26T12:05:39Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Jhaniele](https://avatars.discourse-cdn.com/v4/letter/j/edb3f5/32.png) [@Jhaniele](https://forum.cmascenter.org/u/Jhaniele)\
**Post date:** [June 22, 2025, 7:35am UTC](https://forum.cmascenter.org/t/megan-2-1-installation-errors/4471/12 "2025-06-22T07:35:27Z")

</div>

Hello there.  
I’m also trying to run Megan 2.1.  
met2mgn is giving me a lot of problems compiling it. I’m using gfortran compiler instead of pgf90, ioapi 3.2 and netCDF 4.9.2.  
I have the next compiling errors in met2mgn when I try to run make clean and make -f Makefile.met2mgn.64bit:

fields.inc:27:72:

27 | real qtmp(mnxc,mnyc,mnz), ptmp(mnxc,mnyc,mnz), tktmp(mnxc,mnyc,mnz)  
| 1  
Error: Expected another dimension in array declaration at (1)  
fields.inc:38:72:

38 | real pwg(mnxc,mnyc,mnzc), cod(mnxc,mnyc,mnzc), pwtr(mnxc,mnyc,mnzc)  
| 1  
Error: Expected another dimension in array declaration at (1)  
fields.inc:47:26:

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

31 | common /tmpfld/ utmp,vtmp,ttmp,qtmp,ptmp,tktmp,ztmp,cwtmp,prtmp,  
| 1  
Error: Symbol ‘ptmp’ at (1) has no IMPLICIT type; did you mean ‘pgtmp’?  
fields.inc:46:70:

46 | common /camxfld/ uac,vac,tac,qac,pac,zhc,rkv,tkc,cwc,pwr,pws,pwg,  
| 1  
Error: Symbol ‘pwg’ at (1) has no IMPLICIT type; did you mean ‘pws’?  
fields.inc:31:41:

31 | common /tmpfld/ utmp,vtmp,ttmp,qtmp,ptmp,tktmp,ztmp,cwtmp,prtmp,  
| 1  
Error: Symbol ‘qtmp’ at (1) has no IMPLICIT type; did you mean ‘ttmp’?  
fields.inc:31:52:

31 | common /tmpfld/ utmp,vtmp,ttmp,qtmp,ptmp,tktmp,ztmp,cwtmp,prtmp,  
| 1  
Error: Symbol ‘tktmp’ at (1) has no IMPLICIT type; did you mean ‘ttmp’?  
make: \*\*\* [Makefile.met2mgn.64bit:30: met2mgn.o] Error 1

Also, I would like to use data from ERA5 for the meteorological input, is that possible?do you have any idea on how to adapt met2mgn for that kind of input? or even on how to process it to convert the data into the format required for MEGAN? because I tried using CDO to change the name of the variables and do some calculus but it didn’t work when I ran emproc. That’s what made me notice met2mgn wasn’t compiled properly.

Thanks in advance for your help  
If you need any additional information please let me know  
It’s the first time I’m using the model so I’m kind of lost and I really need to get that done
