Statically link libgfortran in HDF5


#1

When compiling HDF5 with Gnu compilers, there is a dependency on libgfortran.so as a shared library. This is quite uncommon on many systems. “Regular” Fortran applications linked with gfortran can be statically linked with libgfortran with the flag “-static-libgfortran” to remove this dependency. Gcc used as a linker does not recognize this flag.

I have experimented with various options for building HDF5, but I always end up with a libhdf5_fortran.so that depend on libgfortran.so.

Does anyone know if there are any tricks to build HDF5 with Gnu compilers and statically link to libgfortran?