-
Notifications
You must be signed in to change notification settings - Fork 37
Description
Hi,
The configure script of AFiD fails if HDF5 was built with CMake and not with autotools.
HDF5 will drop the possibility to build the software with autotools and will only support building HDF5 with CMake in the upcoming 2.0.0 release. Some package managers (like SPACK, which I use to build software) already don't allow to build HDF5 with autotools any more (also older versions).
As you can see from
The CMake build of HDF5 returns a different string for "h5fc -showconfig" than the autotools build.
Your configure script parses the output of "h5fc -showconfig" in the following section:
# if HDF5_ROOT not set, look for it in a standard directory.
if test "x${HDF5_ROOT}" == "x"; then
HDF5_ROOT=$(eval $H5FC -showconfig \
| $GREP 'Installation point:' \
| $AWK -F: '{print $2}' )
fi
HDF5_AM_LDFLAGS=$(eval $H5FC -showconfig \
| $GREP 'AM_LDFLAGS:' \
| $AWK -F: '{print $2}' )
HDF5_EXTRALIBS=$(eval $H5FC -showconfig \
| $GREP 'Extra libraries:' \
| $AWK -F: '{print $2}' )
HDF5_LDFLAGS="-L${HDF5_ROOT}/lib ${HDF5_AM_LDFLAGS}"
dummy_FCFLAGS=$FCFLAGS
dummy_LDFLAGS=$LDFLAGS
dummy_LIBS=$LIBS
HDF5_LIBS="-lhdf5_fortran -lhdf5 ${HDF5_EXTRALIBS}"
This will no longer work. If I run the same commands on our system (it does not matter if I use HDF5 1.8.x, 1.10.x, 1.12.x or 1.14.x as all of them are built with CMake), then I get a string which cannot be used to link against HDF5:
[sfux@eu-login-10 afid-1.1]$ h5fc -showconfig | grep "Extra libraries:" | awk -F: '{print $2}'
m;dl;/cluster/software/stacks/2024-06/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-12.2.0/openmpi-4.1.6-carqrgaphesqd6gv2ei55htn6sxpngvt/lib/libmpi.so
[sfux@eu-login-10 afid-1.1]$
In my case, when running the configure script of AFiD, the variable HDF5_LIBS is set to
-lhdf5_fortran -lhdf5 m;dl;/cluster/software/stacks/2024-06/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-12.2.0/openmpi-4.1.6-carqrgaphesqd6gv2ei55htn6sxpngvt/lib/libmpi.so
which makes the linker fail to compile the example to detect a parallel HDF5 fortran library:
configure:6437: mpif90 -o conftest -I /cluster/software/stacks/2024-06/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-12.2.0/hdf5-1.8.23-xt5yjkl7rx4x6pmfew3cauftrjqf54ze/include -L /cluster/software/stacks/2024-06/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-12.2.0/hdf5-1.8.23-xt5yjkl7rx4x6pmfew3cauftrjqf54ze/lib conftest.f90 -lhdf5_fortran -lhdf5 m;dl;/cluster/software/stacks/2024-06/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-12.2.0/openmpi-4.1.6-carqrgaphesqd6gv2ei55htn6sxpngvt/lib/libmpi.so >&5
/cluster/software/stacks/2024-06/sfos/ld: cannot find m;dl;/cluster/software/stacks/2024-06/spack/opt/spack/linux-ubuntu22.04-x86_64_v3/gcc-12.2.0/openmpi-4.1.6-carqrgaphesqd6gv2ei55htn6sxpngvt/lib/libmpi.so: No such file or directory
collect2: error: ld returned 1 exit status
Could you please consider adapting your configure script to also allow to use HDF5 libraries that were built with HDF5.
Best regards
Sam