Open Roadelse opened 10 months ago
I forgot to say, the version is WRF 4.5.1
@islas Do you think PR#1935 would address this?
@weiwangncar Not exactly but it is in the same scope of issue - NETCDF4_DEP_LIB
as it is written right now tries to do a lot of extra logic that nc-config --libs
already provides. Ideally we should only be using nc-config --libs
to inform any netCDF linkage and not providing anything on top of that.
The way this affects this issue is that NETCDF4_DEP_LIB
is being used as a stand-in for nc-config --libs
in a particular area where -lnetcdf
is being used.
considering the line in external/io_netcdf/makefile
:
LIBFFS = $(LIB_LOCAL) -L$(NETCDFPATH)/lib -lnetcdff -lnetcdf $(NETCDF4_DEP_LIB)
however, the $(NETCDF4_DEP_LIB)
just makes no sense since it is empty if we don't pass the variable to it, when calling this makefile from WRF/Makefile
Going through PRs for v4.5.2, I realized #1923 should solve this. It also slightly addresses my previous point of better utilizing nc-config --libs
as the main way to link in netCDF
I was compiling WRF and encounter the error of "undefined H5... " in producing external/io_netcdf/diffwrf. I find the detailed statement doesn't contain "-lhdf5_hl -lhdf5", and the NETCDF4_DEP_LIB in external/io_netcdf/makefile is empty. Since the NETCDF4_DEP_LIB in WRF/Makefile is an internal variable rather than environment variable, it will not be inherited when calling a "make" in some places. When I added
NETCDF4_DEP_LIB=$(NETCDF4_DEP_LIB)
to this statement ($(MAKE) ... ... diffwrf
, near Line 927 of WRF/Makefile):the compilation then work correctly.