Undefined Reference to * when building icon in CMAQ

Hi all,

I got an error when I tried to build ICON. I have tried to install CMAQ several times, the last time the same error occurred when compiling CCTM, and this time occurred when compiling ICON. I think there is something wrong on my hdf5 or ioapi, so I recompiled hdf5 several times, but it still doesn’t work. Please, I need your help.

I used the netcdf-c-.7.4.; netcdf-fortran-4.5.3; ioapi-3.2; hdf5-1.8.22; zlib-1.2.8.

Here are some error messages:

Makefile generated
mpiifort UTILIO_DEFN.o HGRD_DEFN.o IC_PARMS.o CGRID_SPCS.o VGRD_DEFN.o findex.o gc_spc_map.o get_envlist.o icon.o lat_lon.o lr_interp.o lst_spc_map.o ngc_spc_map.o opn_ic_file.o setup_logdev.o subhdomain.o prof_driver.o prof_icout.o prof_vinterp.o -L/home/test/models/CMAQ/CMAQ-5.2/lib/ioapi/Linux2_x86_64ifort -lioapi -L/home/test/models/CMAQ/CMAQ-5.2/lib/netcdf/lib -lnetcdff -lnetcdf -o ICON_v52_profile.exe
/home/test/models/CMAQ/CMAQ-5.2/lib/ioapi/Linux2_x86_64ifort/libnetcdff.a(nf_var1io.o): In function nf_put_var1_int64_': /home/test/Downloads/netcdf-fortran-4.5.3/fortran/nf_var1io.F90:354: multiple definition of nf_put_var1_int64_’
/home/test/models/CMAQ/CMAQ-5.2/lib/ioapi/Linux2_x86_64ifort/libioapi.a(modncfio.o):modncfio.F90:(.text+0x71360): first defined here
/home/test/models/CMAQ/CMAQ-5.2/lib/ioapi/Linux2_x86_64ifort/libnetcdff.a(nf_var1io.o): In function nf_get_var1_real': /home/test/Downloads/netcdf-fortran-4.5.3/fortran/nf_var1io.F90:733: multiple definition of nf_get_var1_int64_’
/home/test/models/CMAQ/CMAQ-5.2/lib/ioapi/Linux2_x86_64ifort/libioapi.a(modncfio.o):modncfio.F90:(.text+0x71380): first defined here
/home/test/models/CMAQ/CMAQ-5.2/lib/ioapi/Linux2_x86_64ifort/libnetcdff.a(nf_varaio.o): In function nf_put_vara_int64_': /home/test/Downloads/netcdf-fortran-4.5.3/fortran/nf_varaio.F90:440: multiple definition of nf_put_vara_int64_’
/home/test/models/CMAQ/CMAQ-5.2/lib/ioapi/Linux2_x86_64ifort/libioapi.a(modncfio.o):modncfio.F90:(.text+0x713a0): first defined here
/home/test/models/CMAQ/CMAQ-5.2/lib/ioapi/Linux2_x86_64ifort/libnetcdff.a(nf_varaio.o): In function nf_get_vara_double': /home/test/Downloads/netcdf-fortran-4.5.3/fortran/nf_varaio.F90:933: multiple definition of nf_get_vara_int64_’
/home/test/models/CMAQ/CMAQ-5.2/lib/ioapi/Linux2_x86_64ifort/libioapi.a(modncfio.o):modncfio.F90:(.text+0x713c0): first defined here
/home/test/models/CMAQ/CMAQ-5.2/lib/ioapi/Linux2_x86_64ifort/libnetcdf.a(libnchdf5_la-hdf5file.o): In function nc4_enddef_netcdf4_file': hdf5file.c:(.text+0x3ac): undefined reference to H5Fflush’
/home/test/models/CMAQ/CMAQ-5.2/lib/ioapi/Linux2_x86_64ifort/libnetcdf.a(libnchdf5_la-hdf5file.o): In function NC4_sync': hdf5file.c:(.text+0x73a): undefined reference to H5Fflush’
/home/test/models/CMAQ/CMAQ-5.2/lib/ioapi/Linux2_x86_64ifort/libnetcdf.a(libnchdf5_la-hdf5file.o): In function nc4_close_hdf5_file': hdf5file.c:(.text+0xaa3): undefined reference to H5Fflush’
/home/test/models/CMAQ/CMAQ-5.2/lib/ioapi/Linux2_x86_64ifort/libnetcdf.a(libnchdf5_la-hdf5file.o): In function nc4_close_netcdf4_file': hdf5file.c:(.text+0xbcb): undefined reference to H5Fclose’
hdf5file.c:(.text+0xc81): undefined reference to H5Fget_obj_count' /home/test/models/CMAQ/CMAQ-5.2/lib/ioapi/Linux2_x86_64ifort/libnetcdf.a(libnchdf5_la-hdf5filter.o): In function nc4_global_filter_action’:
hdf5filter.c:(.text+0x16f): undefined reference to H5Zunregister' hdf5filter.c:(.text+0x248): undefined reference to H5Zregister’
/home/test/models/CMAQ/CMAQ-5.2/lib/ioapi/Linux2_x86_64ifort/libnetcdf.a(libnchdf5_la-hdf5grp.o): In function NC4_rename_grp': hdf5grp.c:(.text+0x22f): undefined reference to H5Gclose’
hdf5grp.c:(.text+0x263): undefined reference to H5Lmove' hdf5grp.c:(.text+0x279): undefined reference to H5Gopen2’
/home/test/models/CMAQ/CMAQ-5.2/lib/ioapi/Linux2_x86_64ifort/libnetcdf.a(libnchdf5_la-hdf5internal.o): In function nc4_rec_find_hdf_type': hdf5internal.c:(.text+0x8a): undefined reference to H5Tequal’
/home/test/models/CMAQ/CMAQ-5.2/lib/ioapi/Linux2_x86_64ifort/libnetcdf.a(libnchdf5_la-hdf5internal.o): In function nc4_find_dim_len': hdf5internal.c:(.text+0x262): undefined reference to H5Dget_space’
hdf5internal.c:(.text+0x28e): undefined reference to H5Sget_simple_extent_type' hdf5internal.c:(.text+0x2cc): undefined reference to H5Sget_simple_extent_ndims’
hdf5internal.c:(.text+0x2f2): undefined reference to H5Sclose' hdf5internal.c:(.text+0x39e): undefined reference to H5Sget_simple_extent_dims’
/home/test/models/CMAQ/CMAQ-5.2/lib/ioapi/Linux2_x86_64ifort/libnetcdf.a(libnchdf5_la-hdf5internal.o): In function delete_dimscale_dataset': hdf5internal.c:(.text+0x613): undefined reference to H5Dclose’
hdf5internal.c:(.text+0x62a): undefined reference to H5Gunlink' /home/test/models/CMAQ/CMAQ-5.2/lib/ioapi/Linux2_x86_64ifort/libnetcdf.a(libnchdf5_la-hdf5internal.o): In function nc4_reform_coord_var’:
hdf5internal.c:(.text+0x728): undefined reference to H5Dclose' hdf5internal.c:(.text+0x825): undefined reference to H5Gunlink’
hdf5internal.c:(.text+0x883): undefined reference to H5DSdetach_scale' /home/test/models/CMAQ/CMAQ-5.2/lib/ioapi/Linux2_x86_64ifort/libnetcdf.a(libnchdf5_la-hdf5internal.o): In function nc4_rec_grp_HDF5_del’:
hdf5internal.c:(.text+0xa3e): undefined reference to H5Tclose' hdf5internal.c:(.text+0xae3): undefined reference to H5Dclose’
hdf5internal.c:(.text+0xb3f): undefined reference to H5Tclose' hdf5internal.c:(.text+0xb58): undefined reference to H5Tclose’
hdf5internal.c:(.text+0xbd7): undefined reference to H5Tclose' hdf5internal.c:(.text+0xc7e): undefined reference to H5Dclose’
hdf5internal.c:(.text+0xd0d): undefined reference to H5Tclose' hdf5internal.c:(.text+0xd23): undefined reference to H5Tclose’
hdf5internal.c:(.text+0xd6c): undefined reference to H5Gclose' /home/test/models/CMAQ/CMAQ-5.2/lib/ioapi/Linux2_x86_64ifort/libnetcdf.a(libnchdf5_la-hdf5internal.o): In function nc4_hdf5_initialize’:
hdf5internal.c:(.text+0x1198): undefined reference to H5Eset_auto2' /home/test/models/CMAQ/CMAQ-5.2/lib/ioapi/Linux2_x86_64ifort/libnetcdf.a(libnchdf5_la-hdf5open.o): In function dimscale_visitor’:
hdf5open.c:(.text+0x1c): undefined reference to H5Gget_objinfo' /home/test/models/CMAQ/CMAQ-5.2/lib/ioapi/Linux2_x86_64ifort/libnetcdf.a(libnchdf5_la-hdf5open.o): In function rec_read_metadata’:
hdf5open.c:(.text+0xce): undefined reference to H5Gopen2' hdf5open.c:(.text+0xe2): undefined reference to H5Gget_create_plist’
hdf5open.c:(.text+0x11d): undefined reference to H5Oclose' hdf5open.c:(.text+0x14d): undefined reference to H5Gopen2’
hdf5open.c:(.text+0x172): undefined reference to H5Pget_link_creation_order' hdf5open.c:(.text+0x1ab): undefined reference to H5Literate’
hdf5open.c:(.text+0x244): undefined reference to H5Pclose' /home/test/models/CMAQ/CMAQ-5.2/lib/ioapi/Linux2_x86_64ifort/libnetcdf.a(libnchdf5_la-hdf5open.o): In function create_phony_dims’:
hdf5open.c:(.text+0x5f2): undefined reference to H5Dget_space' hdf5open.c:(.text+0x648): undefined reference to H5Sclose’
hdf5open.c:(.text+0x689): undefined reference to H5Sget_simple_extent_type' hdf5open.c:(.text+0x765): undefined reference to H5Sget_simple_extent_dims’

……
……
make: *** [ICON_v52_profile.exe] Error 1
ERROR while running make command

else
endif
mv Makefile Makefile.intel
mv: ‘Makefile’ and ‘Makefile.intel’ are the same file
ln -s Makefile.intel Makefile
ln: failed to create symbolic link ‘Makefile’: File exists
if ( 1 != 0 ) then
echo *** failure in /home/test/models/CMAQ/CMAQ-5.2/UTIL/bldmake/bldmake_intel.exe -serial -verbose ***
*** failure in /home/test/models/CMAQ/CMAQ-5.2/UTIL/bldmake/bldmake_intel.exe -serial -verbose ***

There are tutorials provided in the documentation on how to compile the libraries for CMAQ.

This version of the tutorial, uses the gfortran compiler, building netCDF without the compression capabilities of netCDF4.

./configure --prefix=$cwd/../netcdf --disable-netcdf-4 --disable-dap

If you need to read input files that use netcdf-4 compression, then there is a different tutorial that you can try.

You can’t mix and match the libraries, they need to be consistent, and the explanation of why is in @cjcoats documentation on I/O API build and installation instructions:

https://www.cmascenter.org/ioapi/documentation/all_versions/html/AVAIL.html