Icon : Build CMAQ executables Error building ICON

desc3.F:(.text+0x35d): undefined reference to ncagtc_' desc3.F:(.text+0x39a): undefined reference toncagt_’
desc3.F:(.text+0x3ce): undefined reference to ncagt_' desc3.F:(.text+0x400): undefined reference toncagt_’
opnfil3.F:(.text+0x1d2): undefined reference to ncagt_' opnfil3.F:(.text+0x237): undefined reference toncagt_’
opnfil3.F:(.text+0x273): undefined reference to ncagt_' opnfil3.F:(.text+0x2ab): undefined reference toncagt_’
opnfil3.F:(.text+0x54d): undefined reference to ncvid_' opnfil3.F:(.text+0x5c2): undefined reference toncagtc_’
opnfil3.F:(.text+0x646): undefined reference to ncvinq_' opnfil3.F:(.text+0x69d): undefined reference toncagtc_’
opnfil3.F:(.text+0x6e7): undefined reference to ncvid_' opnfil3.F:(.text+0x7fd): undefined reference to
crdict3.f:(.text+0x178): undefined reference to ncvdef_' crdict3.f:(.text+0x1d4): undefined reference toncaptc_’
crdict3.f:(.text+0x226): undefined reference to ncaptc_' crdict3.f:(.text+0xdb0): undefined reference toncapt_’
crdict3.f:(.text+0xe1c): undefined reference to ncaptc_' crdict3.f:(.text+0xe71): undefined reference toncvdef_’
crdict3.f:(.text+0xee1): undefined reference to ncvdef_' crdict3.f:(.text+0xf3d): undefined reference toncvdef_’

make: *** [ICON_D502a_Linux3_x86_64gcc] Error 1
ERROR while running make command

Which I/O API version? Which netCDF version?

See https://www.cmascenter.org/ioapi/documentation/all_versions/html/AVAIL.html#ncf4:
Evidently, starting with netCDF-Fortran 4.4.2, UCAR in their wisdom decided to silently eliminate the CALL NC*() Fortran interfaces in terms of which the I/O API was originally implemented. [If you can find any documentation indicating this intent on the web, I would enjoy seeing it; I can’t find it.]

I/O API Version 3.2 was tediously re-coded to replace all 943 of these calls by the newer IERR=NF_*() Fortran interfaces that are still supported. Prior editions of the I/O API will have link errors with netCDF-Fortran 4.4.2 or later, because routines such as NCCLOS() are no longer in that library.

…which is exactly what you’re seeing,

Carlie J. Coats, Jr., Ph.D.                    cjcoats@email.unc.edu
Senior Software Engineer                   I/O API Author/Maintainer
Center for Environmental Modeling for Policy Development,
UNC Institute for the Environment                     www.ie.unc.edu
100 Europa Dr., Suite 490 Rm 4051 / Campus Box 1105     919.843.5951
Chapel Hill, NC 27599-1105                          Fax 919.966.9920

netcdf-4.1.3 IOAPI 3.1

So (thanks to the fact that netCDF4 is not backwards compatible with its predecessors, you need to be using I/O API 3.2:

Start from a “new” directory, and
git clone https://github.com/cjcoats/ioapi-3.2.git
or
wget https://www.cmascenter.org/ioapi/download/ioapi-3.2.tar.gz ; tar xvfz ioapi-3.2.tar.gz
[etc.: see https://www.cmascenter.org/ioapi/documentation/all_versions/html/AVAIL.html#build for build-instructions

Hello,

Below is what I got while building CCTM:

STATE3.EXT:174:27:

Error: Syntax error in COMMON statement at (1)
STATE3.EXT:191:27:

Error: Syntax error in COMMON statement at (1)
Makefile:414: recipe for target ‘pinterpb.o’ failed
make: *** [pinterpb.o] Error 1
ERROR while running make command

else if ( 0 ) then
endif
mv Makefile Makefile.gcc7.3.0
if ( -e Makefile.gcc7.3.0 && -e Makefile ) rm Makefile
ln -s Makefile.gcc7.3.0 Makefile
if ( 0 != 0 ) then
if ( -e /home/catalyst/Desktop/Build_WRF/CMAQ-5.2/CCTM/scripts/BLD_CCTM_v52_gcc7.3.0/CCTM_v52.cfg ) then
mv CCTM_v52.cfg.bld /home/catalyst/Desktop/Build_WRF/CMAQ-5.2/CCTM/scripts/BLD_CCTM_v52_gcc7.3.0/CCTM_v52.cfg
exit

I need your help please. Thanks

See the I/O API Troubleshooting document: https://www.cmascenter.org/ioapi/documentation/all_versions/html/AVAIL.html#cmaq

According to the ISO Fortran Standard, there are two “source formats” for Fortran source code – the older ( f77 ) “fixed” format with code in columns 7-72 and continuation markers in column 6, and the ( f90 ) “free” format, with source in columns 1-132 and ampersand ("&") for trailing continuation markers, as well as a specification for code which is acceptable to both forms.

Since it is used by various models that use “free” format, the I/O API carefully follows the Standard in this regard, and uses the ISO-approved “both-form” format for its Fortran INCLUDE files.

Some of the models—in particular, CMAQ and SMOKE however, do not—instead using a “fixed-132” format. The I/O API Makefile has a way of dealing with this; the commands

> cd <installation directory>/ioapi
> make fixed_src

will create a new directory ioapi/fixed_src and populate it with copies of the INCLUDE files that have been edited to work with the non-Standard “fixed-132” format. You will need to use these INCLUDE files with CMAQ and SMOKE.

Thanks for your guide.
However, the CCTM is yet to compile as I got this response:

collect2: error: ld returned 1 exit status
Makefile:408: recipe for target ‘CCTM_v52.exe’ failed
make: *** [CCTM_v52.exe] Error 1
ERROR while running make command

else if ( 0 ) then
endif
mv Makefile Makefile.gcc7.3.0
if ( -e Makefile.gcc7.3.0 && -e Makefile ) rm Makefile
ln -s Makefile.gcc7.3.0 Makefile
if ( 0 != 0 ) then
if ( -e /home/catalyst/Desktop/Build_WRF/CMAQ-5.2/CCTM/scripts/BLD_CCTM_v52_gcc7.3.0/CCTM_v52.cfg ) then
mv CCTM_v52.cfg.bld /home/catalyst/Desktop/Build_WRF/CMAQ-5.2/CCTM/scripts/BLD_CCTM_v52_gcc7.3.0/CCTM_v52.cfg
exit

Kindly help me out. Thanks.