Correct flags for HDF5 during compiling code

Hi,

Hope you are doing well.

I am compiling a code that required hdf5 for data analysis. I plan to run the code on a cluster which already has a module for hdf5.

So first I am doing

module load hdf5

The version is hdf5-1.10.7. Now in my Makefile.h file for the code:

HDF5_PATH = $(HDF5_ROOT)
FCOMP = $(HDF5_PATH)/bin/h5pfc
CCOMP = $(HDF5_PATH)/bin/h5pcc
LINK = $(HDF5_PATH)/bin/h5pfc -std=c++14
FFLAGS_HDF5 = -I${HDF5_PATH}/include -DH5_USE_18_API
CFLAGS_HDF5 = -I{HDF5_PATH}/include -DH5_USE_18_API
LIB_HDF5 = -L${HDF5_PATH}/lib -lhdf5_fortran -lhdf5 -lz

When I try to compile , I get the following error:
dir is /cvmfs/hpcsw.umd.edu/spack-software/2022.06.15/linux-rhel8-zen2/gcc-9.4.0/hdf5-1.10.7-fjan65etjt7gsfdld7em6n2jmsh5mhxi
/cvmfs/hpcsw.umd.edu/spack-software/2022.06.15/linux-rhel8-zen2/gcc-9.4.0/hdf5-1.10.7-fjan65etjt7gsfdld7em6n2jmsh5mhxi/lib: file not recognized: Is a directory

From what I can gather, the compilation is trying to find a particular file instead of the lib directory. Do I change any of the flags?. Should I change the HDF5_PATH?

Best wishes,
Shantanu

Since you are using the compilation wrappers, you should not need to set all the links, includes, etc.
All you need to do is h5pcc your_program.c in your makefile. If you need to set additional options, use HDF5_CPPFLAGS, HDF5_CFLAGS, etc. See h5pcc -help for more information.