NetCDF Error When Compiling MCIP in CMAQv5.4

Hi,

To provide some context, I am currently using the Intel 15.0.1 compiler and have two versions of NetCDF installed on my system: 4.3.0 (enable-nc4) and 4.3.3.1 (disable-nc4). I have compiled IOAPI-3.2 using netCDF-4.3.3.1, but when attempting to compile MCIP, I encountered errors.

When using netCDF-4.3.3.1, the following error message (part of) is displayed:

netcdf_io_mod.f90(65): error #7002: Error in opening the compiled module file.  Check INCLUDE paths.   [NETCDF]
  USE netcdf
------^

netcdf_io_mod.f90(225): error #6404: This name does not have a type, and must have an explicit type.   [NF90_GET_VAR]
  rcode = nf90_get_var (cdfid, id_data, scalar)
----------^
compilation aborted for netcdf_io_mod.f90 (code 1)
make[1]: *** [netcdf_io_mod.o] Error 1

When using netCDF-4.3.0, the following error message (part of) is shown:

chkwpshdr.o: In function `chkwpshdr_':
chkwpshdr.f90:(.text+0x44): undefined reference to `netcdf_mp_nf90_get_att_one_fourbyteint_'
chkwpshdr.f90:(.text+0x203): undefined reference to `netcdf_mp_nf90_get_att_one_fourbyteint_'
outncf.o: In function `outncf_':
outncf.f90:(.text+0x288): undefined reference to `netcdf_mp_nf90_put_var_text_'
outncf.f90:(.text+0x393): undefined reference to `netcdf_mp_nf90_strerror_'
make[1]: *** [mcip.exe] Error 1

The complete log files are attached here. The name “nc2” and “nc4” refer to using netcdf version 4.3.3.1 (which disabled nc4) and 4.3.0 (which enabled nc4), respectively.
nc2_makelog.txt (6.0 KB)
nc4_makelog.txt (61.5 KB)

And here is my related Makefile content

#...Intel Fortran
FC      = ifort
#NETCDF = /GTdataserver/students/xuyf/lib/netcdf-4.3.3.1 # no-nc4
NETCDF = /opt/software/lib/netcdf #  with-nc4
IOAPI_ROOT = /GTdataserver/students/xuyf/lib/ioapi-3.2
###FFLAGS  = -g -O0 -check all -C -traceback -FR -I$(NETCDF)/include  \
###          -I$(IOAPI_ROOT)/Linux2_x86_64ifort
FFLAGS  = -O3 -traceback -FR -I$(NETCDF)/include -I$(IOAPI_ROOT)/Linux2_x86_64ifort
LIBS    = -L$(IOAPI_ROOT)/Linux2_x86_64ifort -lioapi \
          -L$(NETCDF)/lib -lnetcdff -lnetcdf -openmp

It appears that the issue is related to the netCDF configuration. I’m confused with the error and the difference between two netcdf versions. I would greatly appreciate it if you could provide guidance or suggestions.

You didn’t say anything about netCDF-Fortran — which is separate from the default netCDF-C that you describe; see https://cjcoats.github.io/ioapi/AVAIL.html#ncf4 for notes about that.

Somewhere in the netCDF-Fortran, there will be a file netcdf.mod: you need to make sure that its directory is in your compiler-line INCLUDE-path. For example, if that file is
/foo/bar/netcdf-fortran-4.4.4/fortran/netcdf.mod
then your FFLAGS needs a clause
-I/foo/bar/netcdf-fortran-4.4.4/fortran

Thanks for your help!

I compiled MCIP with a new netcdf containing c and fortran, and it worked.

1 Like