[mpas-developers] netCDF Fortran library
Michael Duda
duda at ucar.edu
Wed Jan 2 11:42:06 MST 2013
Hi, Folks.
It seems that some compilers are particular about the order of libraries
that are passed to the linker; specifically, listing the base netCDF
library before the Fortran interface library doesn't always work.
There are a couple of approaches to solving this problem that occurred
to me:
1) We could use nc-config to tell us which flags we need to use;
however, older versions of netCDF don't have nc-config.
2) We could modify our Makefile logic for adding the "-lnetcdff" flag to
look something like this
CPPINCLUDES = -I../inc -I$(NETCDF)/include -I$(PIO) -I$(PNETCDF)/include
FCINCLUDES = -I../inc -I$(NETCDF)/include -I$(PIO) -I$(PNETCDF)/include
NCLIB = -lnetcdf
NCLIBF = -lnetcdff
LIBS = -L$(PIO) -L$(PNETCDF)/lib -L$(NETCDF)/lib -lpio -lpnetcdf
ifneq ($(wildcard $(NETCDF)/lib/libnetcdff.*), ) # CHECK FOR NETCDF4
LIBS += $(NCLIBF)
endif # CHECK FOR NETCDF4
LIBS += $(NCLIB)
I've just tested the second option on yellowstone, and it appears to be
working, and if there is no objection to pursuing this approach, I'll
test it more thoroughly.
Does anyone else have opinions, comments, or alternatives?
Thanks,
Michael
More information about the mpas-developers
mailing list