Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include the hdf5-config.cmake if generated #101

Open
jpfeuffer opened this issue Sep 10, 2020 · 2 comments
Open

Include the hdf5-config.cmake if generated #101

jpfeuffer opened this issue Sep 10, 2020 · 2 comments

Comments

@jpfeuffer
Copy link
Contributor

Currently, we get weird CMake errors that actually do not seem to affect the compilation of OpenMS.

-- Unable to determine HDF5 C flags from HDF5 wrapper.
-- Unable to determine HDF5 C version from HDF5 wrapper.
-- Unable to determine HDF5 CXX flags from HDF5 wrapper.
-- Unable to determine HDF5 CXX version from HDF5 wrapper.

or

-- HDF5 C compiler wrapper is unable to compile a minimal HDF5 program.
/Users/runner/work/OpenMS/OpenMS/contribbld/h5c++
dir is /Users/runner/work/OpenMS/OpenMS/contribbld
Package hdf5 was not found in the pkg-config search path.
Perhaps you should add the directory containing `hdf5.pc'
to the PKG_CONFIG_PATH environment variable
Package 'hdf5', required by 'hdf5_cpp-1.10.5', not found
/Users/runner/work/OpenMS/OpenMS/bld/src/openms/CMakeFiles/hdf5/cmake_hdf5_test.cxx:1:10: fatal error: 'H5Cpp.h' file not found
#include <H5Cpp.h>
         ^~~~~~~~~
1 error generated.
-- HDF5 CXX compiler wrapper is unable to compile a minimal HDF5 program.
-- Found HDF5: /Users/runner/work/OpenMS/OpenMS/contribbld/lib/libhdf5_cpp.a;/Users/runner/work/OpenMS/OpenMS/contribbld/lib/libhdf5.a (found version "1.10.5") found components: C CXX HL 

This is because the FindHDF5.cmake module is used, which tries to infer compile options from the hdf5 compiler wrappers (hdf5c++, etc.).
Those wrappers are not correctly built in our contrib, e.g. on macOS it has stuff like a hardcoded compiler path in it:

#! /bin/sh
##
# Copyright by The HDF Group....

prg=$0
if [ ! -e "$prg" ]; then
  case $prg in
    (*/*) exit 1;;
    (*) prg=$(command -v -- "$prg") || exit;;
  esac
fi
dir=$(
  cd -P -- "$(dirname -- "$prg")/.." && pwd -P
) || exit
prg=$dir/$(basename -- "$prg") || exit

printf '%s\n' "$prg"
printf 'dir is %s\n' "$dir"

export PKG_CONFIG_PATH=$dir/lib/pkgconfig

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ `pkg-config --define-variable=prefix=$dir --cflag --libs hdf5_cpp-1.10.5` $@

and probably the try_compile commands of the Find module do not specify the sysroot always correctly.

Therefore I think it is better to rely on an hdf5-config.cmake if present and therefore use find_package(HDF5 ... NO_MODULE) in OpenMS.

@timosachsenberg
Copy link
Contributor

outdated?

@jpfeuffer
Copy link
Contributor Author

No

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants