On 2022-11-06 15:22, Gilles Filippini wrote:

h5pcc is showing an unexpected default configuration:

$ h5pcc --showconfig
gcc -I/usr/include/hdf5/openmpi -L/usr/lib/x86_64-linux-gnu/hdf5/openmpi /usr/lib/x86_64-linux-gnu/hdf5/openmpi/libhdf5_hl.a /usr/lib/x86_64-linux-gnu/hdf5/openmpi/libhdf5.a -lcrypto -lcurl -lsz -lz -ldl -lm -Wl,-rpath -Wl,/usr/lib/x86_64-linux-gnu/hdf5/openmpi -I/usr/lib/x86_64-linux-gnu/openmpi/include -I/usr/lib/x86_64-linux-gnu/openmpi/include/openmpi -L/usr/lib/x86_64-linux-gnu/openmpi/lib -lmpi

Note how it includes static linking to libhdf5_hl.a and libhdf5.a

This is the expected behavior as documented by upstream:

       -shlib Compile with shared HDF5 libraries [default for hdf5
built without static libraries]

       -noshlib
              Compile with static HDF5 libraries [default for hdf5
built with static libraries]
...
As far as I can tell, the default static linking is causing the RC
Bug#1020054 reported against h5py.

Could be fixed using `HDF5_USE_SHLIB=yes`:
         PYBUILD_NAME=$(PYBUILD_NAME_MPI) CC=h5pcc HDF5_USE_SHLIB=yes
HDF5_MPI=ON HDF5_PKGCONFIG_NAME=hdf5-mpi H5PY_SYSTEM_LZF=1
dh_auto_build -D $(BUILD_DIR_MPI)


h5py is building fine against the shared libraries with HDF5_USE_SHLIB=yes, but leaves a question about rpath.

Notice that `h5pcc --showconfig -shlib` includes
"-L/usr/lib/x86_64-linux-gnu/hdf5/openmpi -lhdf5_hl -lhdf5 -Wl,-rpath -Wl,/usr/lib/x86_64-linux-gnu/hdf5/openmpi"

The h5py python extensions get linked with this, such the h5py .so files are generated with
  NEEDED               libhdf5_openmpi.so.103
  RUNPATH              /usr/lib/x86_64-linux-gnu/hdf5/openmpi

In normal package policy we try to remove RUNPATH, and in the case of the hdf5 libraries libhdf5_openmpi.so.103 is available in the standard library path at /usr/lib/x86_64-linux-gnu/. In fact libhdf5_openmpi.so.103 is not even found in /usr/lib/x86_64-linux-gnu/hdf5/openmpi (instead libhdf5.so is found there as a symlink to ../../libhdf5_openmpi.so).

As far as I can tell, the -rpath entry in the h5pcc configuration is redundant, possibly even wrong (since the linked library is libhdf5_openmpi.so.103, not the more general libhdf5.so)

Should rpath be removed from the h5pcc shlib configuration?

Reply via email to