[airs2m3] Error

Hello,

I was trying to install ioapi-3.2 through intel compiler, but keep getting the following error message:
“…/CMAQv5.3.2/src/ioapi-3.2/Linux2_x86_64ifort/libnetcdff.a(nf_var1io.o): In function nf_put_var1_int64_': ../CMAQv5.3.2/src/netcdf-fortran-4.5.3/fortran/nf_var1io.F90:354: multiple definition of nf_put_var1_int64_’
…/CMAQv5.3.2/src/ioapi-3.2/Linux2_x86_64ifort/libioapi.a(modncfio.o):modncfio.F90:(.text+0x71360): first defined here
…/CMAQv5.3.2/src/ioapi-3.2/Linux2_x86_64ifort/libnetcdff.a(nf_var1io.o): In function nf_get_var1_real': ../INTEL/CMAQv5.3.2/src/netcdf-fortran-4.5.3/fortran/nf_var1io.F90:733: multiple definition of nf_get_var1_int64_’
…/CMAQv5.3.2/src/ioapi-3.2/Linux2_x86_64ifort/libioapi.a(modncfio.o):modncfio.F90:(.text+0x71380): first defined here
…/CMAQv5.3.2/src/ioapi-3.2/Linux2_x86_64ifort/libnetcdff.a(nf_varaio.o): In function nf_put_vara_int64_': ../CMAQv5.3.2/src/netcdf-fortran-4.5.3/fortran/nf_varaio.F90:440: multiple definition of nf_put_vara_int64_’
…/INTEL/CMAQv5.3.2/src/ioapi-3.2/Linux2_x86_64ifort/libioapi.a(modncfio.o):modncfio.F90:(.text+0x713a0): first defined here
…/CMAQv5.3.2/src/ioapi-3.2/Linux2_x86_64ifort/libnetcdff.a(nf_varaio.o): In function nf_get_vara_double': ../CMAQv5.3.2/src/netcdf-fortran-4.5.3/fortran/nf_varaio.F90:933: multiple definition of nf_get_vara_int64_’
…/CMAQv5.3.2/src/ioapi-3.2/Linux2_x86_64ifort/libioapi.a(modncfio.o):modncfio.F90:(.text+0x713c0): first defined here
make[1]: *** [airs2m3] Error 1
make[1]: Leaving directory `…/CMAQv5.3.2/src/ioapi-3.2/m3tools’
make: *** [all] Error 2”

I searched the solution over the forum, but neither works for me. For your reference, I compiled netcdf by --disable-netcdf4, --disable-netcdf-dap, and succeed. I linked “libnetcdff.a” and “libnetcdf.a” from netcdf library directory to the directory “ioapi-3.2/Linux2_x86_64ifort”. and run make under Base directory. Could you suggest me how to resolve this error?

Thanks very much,

Best,
Xiangyu

2 Likes

This is in fact a repetition of a recent issue.

See this section of the I/O API build directions: https://cjcoats.github.io/ioapi/AVAIL.html#ncf4:

If you build netCDF-4 without the --disable-netcdf4, you will also need to add -DIOAPI_NCF4=1 either to the ARCHFLAGS in your Makeinclude.${BIN} or to the DEFINEFLAGS in your Makefile, since defining netCDF-4 causes netCDF to change parts of the netCDF-3 interface.

Or if the command

nm libnetcdff.a | grep nf_get_vara_int64_

gives a result… you need to re-build the I/O API library with that extra flag -DIOAPI_NCF4=1

1 Like

Thanks you very much for the information, Carlie! It seems that only change the DEFINEFLAGS in the ioapi/Makefile doesn’t work for me. Once I aslo add -DIOAPI_NCF4=1 to the ARCHFLAGS in the ioapi/Makeinclude.${BIN}, then re-build works! :smiley:

Best,
Xiangyu

1 Like

Thank you for the guidance. Adding to the Makeinclude.Linux2_x86_64gfort_gcc_9.1.0:
-DIAOPI_NCF4=1
as well as
=std=legacy
worked for me.

See https://www.cmascenter.org/ioapi/documentation/all_versions/html/ERRORS.html#gfort10
and the *ioapi/Makeinclude.Linux2_x86_64gfort10 * – versions 10 and later of gfortran changed their definition of Fortran; the more-precise compile-flag for those compilers is
-fallow-argument-mismatch
The earlier-suggested -std=legacy flag introduces a potential can of worms of other difficulties ;-(

1 Like

As an update, both of those solutions have helped me in compiling CAMx as well. (Updating the Makefile for v7.20)

1 Like