EDmodel / ED2

Ecosystem Demography Model
79 stars 113 forks source link

hdf5.mod file not found #403

Open dburnarddata opened 3 months ago

dburnarddata commented 3 months ago

Hi there, I am following the instructions detailed on https://github.com/EDmodel/ED2/wiki/Quick-start, and I keep getting an error that the hdf5.mod file cannot be located even though it is there and file path specified. This error is appearing with all compiler options. Can you please advise?

mpaiao commented 3 months ago

Hello @dburnarddata, this error suggests that the compilation is either not finding the hdf5 libraries, or the hdf5 libraries are not compatible with the fortran/c compiler you are using.

There may be two ways of identifying the HDF5 libraries in your system:

Method 1. On your terminal, type locate libhdf5_fortran and locate libdhf5_hl. If these commands work, they should return a list of paths, something like:

/some/path/lib/libhdf5_fortran.a
/some/path/lib/libhdf5_fortran.so
/some/path/lib/libhdf5_fortran.so.310

If this works. then search libz too (locate libz). This will likely return many more paths, look for the ones that show libz.a and/or libz.so (or libz.dylib if running on a Mac). For example:

/another/path/lib/libz.a
/another/path/lib/libz.so

Method 2. If locate doesn't work, try which h5dump. If this works, it should return something like:

/some/path/bin/h5dump

You may need to search for libz.a manually (maybe others have better ideas). Then check that you have libhdf5_fortran by typing ls /some/path/lib/libhdf5_fortran.*, which should show files.

If none of them work, it's likely that you don't have hdf5 installed correctly. If one of them works, them the path you are interested is /some/path (or the equivalent in your path, without the last lib or bin). Then go to the include.mk.???? file that you are using for compiling ED2, and make the following edits:

ZLIB_PATH=/another/path
HDF5_PATH=/some/path
HDF5_INCS=-I$(HDF5_PATH)/include
HDF5C_INCS=$(HDF5_INCS)
HDF5_LIBS=-L$(ZLIB_PATH)/lib -lz -L$(HDF5_PATH)/lib -lhdf5_fortran -lhdf5 -lhdf5_hl

This in principle should fix the hdf5 issue. If you find h5dump and find libhdf5.a or libhdf5.so, but you don't find libhdf5_fortran and/or libhdf5_hl, this means that your hdf5 is missing development features.