# MPI is not found by find\_library(ParaView) in v5.9 but it works in v5.8

**URL:** https://discourse.paraview.org/t/mpi-is-not-found-by-find-library-paraview-in-v5-9-but-it-works-in-v5-8/7242
**Category:** Development
**Created:** [May 18, 2021, 7:56am UTC](https://discourse.paraview.org/t/mpi-is-not-found-by-find-library-paraview-in-v5-9-but-it-works-in-v5-8/7242 "2021-05-18T07:56:44Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![lhofmann](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/l/9e8a1a/32.png) [@lhofmann](https://discourse.paraview.org/u/lhofmann)
#### Post date: [May 18, 2021, 7:56am UTC](https://discourse.paraview.org/t/mpi-is-not-found-by-find-library-paraview-in-v5-9-but-it-works-in-v5-8/7242/1 "2021-05-18T07:56:44Z")

</div>

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

```auto
-- 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:

```auto
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

```

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [May 18, 2021, 8:21am UTC](https://discourse.paraview.org/t/mpi-is-not-found-by-find-library-paraview-in-v5-9-but-it-works-in-v5-8/7242/2 "2021-05-18T08:21:09Z")

</div>

> [@lhofmann](#):
>
> lib/cmake/paraview-5.9/vtk/vtkm/cmake/FindMPI.cmake

where is this file from ?

---

<div class="post-metadata">

### Author: ![lhofmann](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/l/9e8a1a/32.png) [@lhofmann](https://discourse.paraview.org/u/lhofmann)
#### Post date: [May 18, 2021, 9:20am UTC](https://discourse.paraview.org/t/mpi-is-not-found-by-find-library-paraview-in-v5-9-but-it-works-in-v5-8/7242/3 "2021-05-18T09:20:53Z")

</div>

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

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [May 18, 2021, 9:21am UTC](https://discourse.paraview.org/t/mpi-is-not-found-by-find-library-paraview-in-v5-9-but-it-works-in-v5-8/7242/4 "2021-05-18T09:21:53Z")

</div>

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 ?

---

<div class="post-metadata">

### Author: ![lhofmann](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/l/9e8a1a/32.png) [@lhofmann](https://discourse.paraview.org/u/lhofmann)
#### Post date: [May 18, 2021, 9:40am UTC](https://discourse.paraview.org/t/mpi-is-not-found-by-find-library-paraview-in-v5-9-but-it-works-in-v5-8/7242/5 "2021-05-18T09:40:23Z")

</div>

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).

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [May 18, 2021, 9:42am UTC](https://discourse.paraview.org/t/mpi-is-not-found-by-find-library-paraview-in-v5-9-but-it-works-in-v5-8/7242/6 "2021-05-18T09:42:09Z")

</div>

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

---

<div class="post-metadata">

### Author: ![lhofmann](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/l/9e8a1a/32.png) [@lhofmann](https://discourse.paraview.org/u/lhofmann)
#### Post date: [May 18, 2021, 9:51am UTC](https://discourse.paraview.org/t/mpi-is-not-found-by-find-library-paraview-in-v5-9-but-it-works-in-v5-8/7242/7 "2021-05-18T09:51:23Z")

</div>

A CMakeLists.txt like this already fails:

```auto
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 😉

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [May 18, 2021, 9:56am UTC](https://discourse.paraview.org/t/mpi-is-not-found-by-find-library-paraview-in-v5-9-but-it-works-in-v5-8/7242/8 "2021-05-18T09:56:10Z")

</div>

Which cmake are you using ?

---

<div class="post-metadata">

### Author: ![lhofmann](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/l/9e8a1a/32.png) [@lhofmann](https://discourse.paraview.org/u/lhofmann)
#### Post date: [May 18, 2021, 9:57am UTC](https://discourse.paraview.org/t/mpi-is-not-found-by-find-library-paraview-in-v5-9-but-it-works-in-v5-8/7242/9 "2021-05-18T09:57:13Z")

</div>

cmake 3.20.2

(updated my system yesterday)

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.paraview.org/u/ben.boeckel)
#### Post date: [May 18, 2021, 1:37pm UTC](https://discourse.paraview.org/t/mpi-is-not-found-by-find-library-paraview-in-v5-9-but-it-works-in-v5-8/7242/10 "2021-05-18T13:37:24Z")

</div>

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