Building HDF5 (for netcdf) - only static possible


I’m currently trying to build netcdf 4.1.1. We also need hdf functions, therefore
I’ve tried to compile HDF5. After playing around with the flags, we have now a working
HDF5 installation, but HDF5 libs(shared libs!) are missing!
I’ve tried various settings without any success.

If I add the flag “-shared” the pgcc creates a file a.out (running configure),
but this a.out crashes (seg fault).

a.out[19849]: segfault at 0000000000000001 rip 0000000000000001 rsp 00007fff8dbc6fa8 error 14

pgcc -shared -O conftest.c
seg… fault

pgcc -fpic -O conftest.c

So within the configure script testing for creating shared libs is not working.

Any idea ???

“checking whether the pgf90 -fpic linker (pgf90 -m elf_x86_64) supports shared libraries… no”

export CPPFLAGS="-D__FUNCTION__=func -DpgiFortran"
export CC=pgcc
export F90=pgf90
export CXX=pgCC
export CC=pgCC
export CXX=pgcpp
export LD=pgf90
export CFLAGS="-O2 -fpic"
export FFLAGS="-O2 -Msignextend -fpic"
export FC=pgf90
./configure --enable-fortran --enable-shared --prefix=/usr/local/apps/hdf/hdf5_pgi

Hi pekompi,

Which version of HDF5 are you using?


Can you build shared Fortran libraries in HDF5 ?

Shared Fortran libraries are not supported in the HDF5 1.6 branch, but they are supported for some platforms in the HDF5 1.8 branch. Refer to the Supported Configuration Features Summary in the 1.8.0 release notes for more details.

In 1.8.4 Patch 1, although the release notes say that Shared Fortran libs are supported with PGI on Linux, when I use the configure option “–disable-static” to ensure that I only build the shared libs, the following error occurs:

checking for mpirun… /usr/pgi/linux86-64/2010/mpi/mpich/bin/mpirun
shared libraries explicitly enabled by user
configure: WARNING: shared libraries are not supported; disabling shared Fortran libraries
configure: error: both static and shared Fortran libraries are disabled

Looks like shared Fortran libs are still not supported.


Are you trying to build parallel HDF5? If so, parallel HDF5 shared libraries are not supported at all (both C and Fortran)

Elena Pourmal

The HDF Group


I’m trying to build the normal sequential lib’s.
I was able to build it with the sun sudio 12.1 on the same machine.

I just wanted to setup the same env for sun and pgi comipler.