MPI is not found by find_library(ParaView) in v5.9 but it works in v5.8

I’m building ParaView from source on a current Arch Linux. During build, MPI is found just fine, but calling find_library(ParaView) results in error

-- Could NOT find MPI_CXX (missing: MPI_CXX_WORKS) 
CMake Error at /usr/share/cmake-3.20/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find MPI (missing: MPI_C_FOUND MPI_CXX_FOUND)
Call Stack (most recent call first):
  /usr/share/cmake-3.20/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
  /home/lhofmann/Libraries/paraview/ParaView-v5.9.1/lib/cmake/paraview-5.9/vtk/vtkm/cmake/FindMPI.cmake:1705 (find_package_handle_standard_args)
  /home/lhofmann/Libraries/paraview/ParaView-v5.9.1/lib/cmake/paraview-5.9/vtk/vtkm/cmake/VTKmWrappers.cmake:18 (find_package)
  /home/lhofmann/Libraries/paraview/ParaView-v5.9.1/lib/cmake/paraview-5.9/vtk/vtkm/VTKmConfig.cmake:149 (include)
  /home/lhofmann/Libraries/paraview/ParaView-v5.9.1/lib/cmake/paraview-5.9/vtk/vtk-config.cmake:124 (find_package)
  /home/lhofmann/Libraries/paraview/ParaView-v5.9.1/lib/cmake/paraview-5.9/paraview-config.cmake:53 (find_package)
  CMakeLists.txt:108 (find_package)

ParaView v5.8.0 works just fine, when built with exact same configuration. Even if I copy FindMPI.cmake from v5.8.0 to v5.9.1 it still fails.

I have found two workarounds:

  • call find_library(MPI) before find_library(ParaView)
  • delete lib/cmake/paraview-5.9/vtk/vtkm/cmake/FindMPI.cmake

I’m not really sure if this is a problem with my system or a bug.

My cmake config is as follows:

cmake "../ParaView-${paraview_version}-src" \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX=../ParaView-${paraview_version} \
    -DPARAVIEW_ENABLE_FFMPEG=ON \
    -DPARAVIEW_ENABLE_GDAL=ON \
    -DPARAVIEW_ENABLE_MOTIONFX=ON \
    -DPARAVIEW_ENABLE_PDAL=ON \
    -DPARAVIEW_ENABLE_VISITBRIDGE=ON \
    -DPARAVIEW_ENABLE_XDMF3=ON \
    -DPARAVIEW_INSTALL_DEVELOPMENT_FILES=ON \
    -DPARAVIEW_USE_MPI=ON \
    -DPARAVIEW_USE_PYTHON=ON \
    -DPARAVIEW_USE_RAYTRACING=OFF \
    -DPARAVIEW_BUILD_WITH_EXTERNAL=ON \
    -DVTK_MODULE_USE_EXTERNAL_VTK_gl2ps=OFF \
    -DVTK_MODULE_USE_EXTERNAL_VTK_libharu=OFF \
    -DVTK_SMP_IMPLEMENTATION_TYPE=TBB \
    -DVTKm_ENABLE_MPI=ON \
    -DVTK_MODULE_ENABLE_VTK_IOGDAL=YES \
    -DVTK_MODULE_ENABLE_VTK_IOPDAL=YES \
    -DCMAKE_C_FLAGS="-DH5_USE_110_API" \
    -DCMAKE_CXX_FLAGS="-DH5_USE_110_API" \
    -DVTK_MODULE_USE_EXTERNAL_VTK_pegtl=OFF \
    -GNinja
cmake --build . --target install

where is this file from ?

I’m guessing that this file is installed by VTK-m that ships with ParaView.

so you have an installed paraview in your system (installed using pacman?) and during compilatio of ParaView, this file is being picked up by cmake, but it shouldn’t, is that correct ?

No, I install paraview into an empty directory in my home dir. I don’t have the paraview package installed.

During find_package(ParaView) (where I specified that directory via ParaView_DIR), it correctly picks up the files in ParaView_DIR. This causes CMake to use FindMPI.cmake that comes with VTK-m, which for some reason fails on my system (but only in paraview v5.9, it works fine with v5.8).

Can you share an example ? Examples plugins are building fine here.

A CMakeLists.txt like this already fails:

cmake_minimum_required(VERSION 3.12)
find_package(ParaView REQUIRED)%

cmake . -DParaView_DIR=/home/lhofmann/Libraries/paraview/ParaView-v5.9.1/lib/cmake/paraview-5.9

But I guess this is not a bug but something weird with my system then. I will stick with removing FindMPI.cmake from my paraview install for now :wink:

Which cmake are you using ?

cmake 3.20.2

(updated my system yesterday)

I suspect that the FindMPI is broken in some way. This, unfortunately, is the state of FindMPI in a number of its corner cases :frowning: . I recommend nuking the VTK-m copy so that the CMake-shipped copy is used instead.