computationalgeography / lue

LUE Scientific Database and Environmental Modelling Framework
https://lue.computationalgeography.org
MIT License
12 stars 4 forks source link

Build failure 'mpi.h' file not found #593

Open OliverSchmitz opened 11 months ago

OliverSchmitz commented 11 months ago

On my local machine

[ 19%] Built target process_component
[ 19%] Building CXX object source/data_model/hdf5/CMakeFiles/lue_hdf5.dir/src/attribute.cpp.o
In file included from /home/github/lue/source/data_model/hdf5/src/attribute.cpp:1:
In file included from /home/github/lue/source/data_model/hdf5/include/lue/hdf5/attribute.hpp:2:
In file included from /home/github/lue/source/data_model/hdf5/include/lue/hdf5/dataspace.hpp:2:
In file included from /home/github/lue/source/data_model/hdf5/include/lue/hdf5/identifier.hpp:2:
In file included from /home/github/lue/source/data_model/hdf5/include/lue/hdf5/object_info.hpp:2:
In file included from /usr/include/hdf5/openmpi/hdf5.h:21:
/usr/include/hdf5/openmpi/H5public.h:67:10: fatal error: 'mpi.h' file not found
#include <mpi.h>
         ^~~~~~~
1 error generated.

I configure with

cmake -G "Unix Makefiles" \
    -S ${SOURCE} \
    -B . \
    -D FETCHCONTENT_QUIET=FALSE \
    -D CMAKE_C_COMPILER=clang-16 \
    -D CMAKE_CXX_COMPILER=clang++-16 \
    -D CMAKE_BUILD_TYPE=Release \
    -D CMAKE_INSTALL_PREFIX=${PREFIX} \
    -D LUE_BUILD_DATA_MODEL=TRUE \
    -D LUE_DATA_MODEL_WITH_PYTHON_API=TRUE \
    -D LUE_DATA_MODEL_WITH_UTILITIES=TRUE \
    -D LUE_BUILD_VIEW=OFF \
    -D LUE_BUILD_FRAMEWORK=TRUE \
    -D LUE_FRAMEWORK_WITH_PYTHON_API=TRUE \
    -D LUE_BUILD_HPX=TRUE \
    -D HPX_WITH_EXAMPLES=OFF \
    -D HPX_WITH_TESTS=OFF \
    -D HPX_USE_CMAKE_CXX_STANDARD=ON \
    -D HPX_WITH_MALLOC="system" \
    -D HPX_WITH_PKGCONFIG=OFF

I can circumvent this with export CONDA_BUILD=1, then serial hdf5 will be selected instead of parallel hdf5

kordejong commented 11 months ago

There is a HDF5_PREFER_PARALLEL flag (https://cmake.org/cmake/help/latest/module/FindHDF5.html#hints). LUE sets it to TRUE preferring the HDF5 build that supports parallel I/O if it is installed. Otherwise the HDF5 build that does not support parallel I/O is used. Parallel I/O depends on mpi. Removing the parallel HDF5 library will solve the issue in your case. You can safely do this since it is not useful ATM anyway.

Before setting HDF5_PREFER_PARALLEL LUE should check whether the user explicitly set it already. If so, don't touch its setting. Keeping this issue open to make this change.