Fixes esmf-org/esmf#136, fix cygwin build #348
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
At Deltares we rely on a Cygwin build of ESMF. There was an attempt at updating ESMF two few years ago, see #136. I have now managed to create a working build of ESMF 8.8.0, and it required me to make a few changes to build everything (including PIO) for Windows.
I installed the following packages in cygwin (not 100% sure that this list is exhaustive, since some other packages were already installed):
The issues that I encountered:
-std=c++11
turns off GNU extensions of the compiler. I had toexport ESMF_CXXSTD=sysdefault
to ensure that the standard used is-std=gnu++17
so that GNU extensions were turned on. Going to C++17 did not give any issues.${SIZEOF_SIZE_T} EQUAL ${SIZEOF_LONG_LONG}
evaluates to false in CMake. I have added a small fix for this that does nothing if either returns an empty string.-lnetcdff -lnetcdf -lpioc
, but since pioc requires NetCDF, it will add a bunch of extra missing symbols that then cannot be found any more. It could be fixed through a bit of a hack (I setexport ESMF_NETCDF_LIBS="-lpioc -lnetcdff -lnetcdf"
, in hindsight I should have probablyexport ESMF_PIO_LIBS="-lpioc -lnetcdf"
). Instead, I now reordered PIO and NetCDF in the makefile for third party components, so that the-lpioc
flag gets added before netcdf.export ESMF_RANLIB=true
, sincetrue
is a no-op command in bash. This was also a bit of a hack.This PR addresses points 2, 3, and 4. Please let me know if I can do more to get this merged!