Scheduled Downtime
On Friday 21 April 2023 @ 5pm MT, this website will be down for maintenance and expected to return online the morning of 24 April 2023 at the latest

Grid Rotate Makefile Errors

This post was from a previous version of the WRF&MPAS-A Support Forum. New replies have been disabled and if you have follow up questions related to this post, then please start a new thread from the forum home page.

Nickhalden1

New member
I am attempting to make the grid_rotate executable following the standard instructions in 2.1 here: http://www2.mmm.ucar.edu/projects/mpas/tutorial/UK2015/

My command to make the executable is as follows: mpif90 grid_rotate.f90 -o grid_rotate -ffree-line-length-none -I/root/mpas/libraries/include -L/root/mpas/libraries/lib -lnetcdff -lnetcdf

However when doing so I receive multiple errors, such as these:

/root/mpas/libraries/lib/libnetcdf.a(libnetcdf4_la-nc4hdf.o): In function `var_exists':
nc4hdf.c:(.text+0x4d12): undefined reference to `H5Lexists'

/root/mpas/libraries/lib/libnetcdf.a(libnetcdfp_la-ncpdispatch.o): In function `NCP_get_vara':
ncpdispatch.c:(.text+0x1363): undefined reference to `ncmpi_inq_varndims'
ncpdispatch.c:(.text+0x1428): undefined reference to `ncmpi_inq_vartype'

/root/mpas/libraries/lib/libnetcdf.a(libnetcdfp_la-ncpdispatch.o): In function `NCP_create':
ncpdispatch.c:(.text+0x12a): undefined reference to `ncmpi_create'

Note: I have compiled all required to run MPAS in /root/mpas/libraries/ - and from this configuration have ran successful simulations with quasi-uniform meshes.

I have the following configurations for NetCDF Fortran and NetCDF C.

nf-config --all
This netCDF-Fortran 4.4.3 has been built with the following features:
--cc -> gcc
--cflags -> -I/root/mpas/libraries/include -I/root/mpas/libraries/include
--fc -> mpif90
--fflags -> -I/root/mpas/libraries/include
--flibs -> -L/root/mpas/libraries/lib -lnetcdff -L/root/mpas/libraries/lib -lnetcdf -lnetcdf -lnetcdf -lhdf5_hl -lhdf5 -lz -ldl
--has-f90 -> no
--has-f03 -> yes
--has-nc2 -> no
--has-nc4 -> yes
--prefix -> /root/mpas/libraries
--includedir-> /root/mpas/libraries/include
--version -> netCDF-Fortran 4.4.3

nc-config --all
This netCDF 4.5.0 has been built with the following features:
--cc -> mpicc
--cflags -> -I/root/mpas/libraries/include -I/root/mpas/libraries/include
--libs -> -L/root/mpas/libraries/lib -L/root/mpas/libraries/lib -lnetcdf -lpnetcdf -lhdf5_hl -lhdf5 -ldl -lm -lhdf5_hl -lhdf5 -lz -ldl
--has-c++ -> no
--cxx ->
--has-c++4 -> no
--cxx4 ->
--has-fortran-> yes
--fc -> mpif90
--fflags -> -I/root/mpas/libraries/include
--flibs -> -L/root/mpas/libraries/lib -lnetcdff -L/root/mpas/libraries/lib -lnetcdf -lnetcdf -lnetcdf -lhdf5_hl -lhdf5 -lz -ldl
--has-f90 -> no
--has-f03 -> yes
--has-dap -> no
--has-dap4 -> no
--has-nc2 -> yes
--has-nc4 -> yes
--has-hdf5 -> yes
--has-hdf4 -> no
--has-logging-> no
--has-pnetcdf-> yes
--has-szlib -> no
--has-parallel -> yes
--has-cdf5 -> no
--prefix -> /root/mpas/libraries
--includedir-> /root/mpas/libraries/include
--libdir -> /root/mpas/libraries/lib
--version -> netCDF 4.5.0

Where am I making an error? Thank you very much in advance!
 
Since your netCDF library was built with support for reading/writing in HDF5 format and via the pnetcdf library, I think you'll just need to add a few extra libraries in your build command. Could you try
Code:
mpif90 grid_rotate.f90 -o grid_rotate -ffree-line-length-none -I/root/mpas/libraries/include -L/root/mpas/libraries/lib -lnetcdff -lnetcdf -lpnetcdf -lhdf5_hl -lhdf5 -lz -ldl -lm
? These extra libraries can be found in the output of nc-config in the "--libs" line.

As a side note, there is an updated version of the tutorial here: http://www2.mmm.ucar.edu/projects/mpas/tutorial/Boulder2018/index.html .
 
Top