FindHDF5 module failing

Hi everyone,
I am trying to compile a project that uses HDF5. It configures fine on 99% of our platforms, however we are encountering the following error on one:

CMake Error: Generator: execution of make failed. Make command was: /opt/conda/conda-bld/openms-meta_1622795184146/_build_env/bin/make -f Makefile cmTC_f1897/fast &&
 -- HDF5 C compiler wrapper is unable to compile a minimal HDF5 program.
CMake Error: Generator: execution of make failed. Make command was: /opt/conda/conda-bld/openms-meta_1622795184146/_build_env/bin/make -f Makefile cmTC_e45cd/fast &&
 -- HDF5 CXX compiler wrapper is unable to compile a minimal HDF5 program.

The make command, which I suspect comes from CMake’s try_compile, is obviously wrong since it adds an “&&” at the end. But I don’t know if it is because of wrong parameters from the find module or some specifics of our setup (a bioconda build with CMake 3.20.3: https://app.circleci.com/pipelines/github/bioconda/bioconda-recipes/47347/workflows/298078ce-2021-4564-b50b-19a523c1063f/jobs/156410)

Any help on how to further debug would be appreciated :pray:

FYI, your CI link is behind a login. Could you paste the relevant information? I see the && logic and it is only added if it is not at the end of the command list. Maybe there is an empty string as the next command which then expands improperly here?

Oh sorry, you are right. Which relevant information would you be looking for?
The usage of the find_package command for HDF5?
find_package(HDF5 COMPONENTS C CXX HL REQUIRED)

More output from the log? I created a gist of the relevant parts but I am not sure if it helps and it is quite verbose (ignore the warnings, they are fixed in more recent versions). I identified the lines above to be the problem since there is a build of another configuration succeeding right before it, in the same build directory, where it prints

 -- HDF5 C compiler wrapper is unable to compile a minimal HDF5 program.
 -- HDF5 CXX compiler wrapper is unable to compile a minimal HDF5 program.

instead and succeeds with exit code 0. I suspect somehow that the FindHDF5 module does not handle an existing cache correctly? I have no idea how the command is generated by try_compile in a way that would lead to an empty string as last argument.

FindHDF5 is one of those things that tends to get copied and patched. I would see if it is using the CMake-provided FindHDF5 first. If not, then I’d investigate the diff there. Otherwise, if this can be trimmed down to a small conda recipe that reproduces the problem, that would help quite a bit.

I added that try_compile to FindHDF5 in FindHDF5: check that compiler wrapper can compile a minimal program · Kitware/CMake@d9e39f3 (github.com), which was necessary for systems with “conda” or similar programs that provide a broken “h5cc” or similar compiler wrapper.

I think the file that’s needed for more detailed insights is under the build directory like “build/CMakeFiles/CMakeError.log”
If you can get this error to happen on your laptop it might be easier as you’d have to tell CircleCI to upload that file artifact.

Thanks a lot! That pointed to the problem. “make” was not available since I did not include “make” in the host requirements. I was pretty sure it worked before and I thought “cmake” would transitively require “make”. But maybe in my previous recipes, something else included “make” or I am just wrong.

Thanks for the help finding the error.