SKPS
SKPS

Reputation: 5853

Error in opening the compiled module of HDF5

I have a Fortran program with one of the files start with line use HDF5. The program was compiled and run on a particular cluster previously. Now, I am trying to compile the program in a different cluster, which has already hdf5 installed in a particular location.

I assume that the issue is that the compiler could not understand the location of the hdf5 installation directory. I tried specifying hdf5 location by exporting with the LD_LIBRARY_PATH also. Still it does not work. Can someone help me figure what I doing wrong?

The compiler flags also include -lhdf5_fortran and -lhdf5.

UPDATE: The error list on compilation is long. But, the beginning of it looks like this:

lbe_io_hdf5.F90(7): error #7002: Error in opening the compiled module file.  Check INCLUDE paths.   [HDF5]
  use HDF5
------^
lbe_io_hdf5.F90(82): error #6683: A kind type parameter must be a compile-time constant.   [HID_T]
  integer(hid_t) :: file_id      ! File identifier

Upvotes: 0

Views: 2672

Answers (2)

Pierre de Buyl
Pierre de Buyl

Reputation: 7293

HDF5 comes with a compiler wrapper h5fc for Fortran. For a single program file:

h5fc -o my_program my_program.f90

For separate compilation and linking:

h5fc -c file1.f90
h5fc -c my_program.f90
h5fc -o my_program file1.o my_program.o

If you want to call the compiler directly, check the flags given by

h5fc -show

If there is no h5fc command, it means that you have no Fortran-enabled HDF5 install.

Upvotes: 0

SKPS
SKPS

Reputation: 5853

It appears that I have been trying to locate the hdf5 header in wrong location. Using locate hdf5.h gave me the location of the header file and including the directory using -I solved the issue.

Upvotes: 1

Related Questions