I am trying to build HDF-EOS2 for an Ubuntu 20.04 system and for Fortran, and have been following the steps presented in here https://www.hdfeos.org/software/hdfeos.php.
All of the dependencies of HDF-EOS2 were built from source and are installed in a non-default directory. The version of the dependencies for HDF4 that I use are the following:
- ZLIB (1.2.11)
- SZIP (2.1.1)
- JPEG (9e)
No additional options were added upon installing these--the only option that I used was the --prefix
.
For installing HDF4 2.16-2, I used the following options:
--with-zlib=$ZLIB_DIR --with-jpeg=$JPEG_DIR --with-szlib=$SZIP_DIR --prefix=$HDF4_DIR --enable-fortran
I am trying to build it with --enable-shared
but without much success, I am told by the error log to disable Fortran if I were to generate a shared library. Finally, I built HDF-EOS2 3.0 with the following options:
--prefix=$HDFEOS_DIR CC=h4cc --with-szlib=$SZIP_DIR --enable_fortran
Comparing with the tutorial above, I have removed the -Df2cFortran
option for the CC variable because it doesn't seem to do anything and the enable-install-include
option is unrecognized. The installation was successful. However, when I try to call gdopen
from a Fortran code, it returns an undefined reference to 'gdopen'
error.
I have no idea why this occurs because I have linked the hdfeos
library (which defines gdopen
) when compiling the Fortran code (let's call it read_hdfeos.f90
). The options for compilation are shown below,
h4fc -fno-underscoring -L$(HDFEOS_DIR)/lib read_hdfeos.f90 -lhdfeos -lGctp -o read_hdfeos.exe