# Cmake error when trying to build GROMACS version 2022.3 on WSL Ubuntu

**URL:** <https://gromacs.bioexcel.eu/t/cmake-error-when-trying-to-build-gromacs-version-2022-3-on-wsl-ubuntu/4856>\
**Category:** User discussions\
**Tags:** installation-error\
**Created:** [September 24, 2022, 8:18am UTC](https://gromacs.bioexcel.eu/t/cmake-error-when-trying-to-build-gromacs-version-2022-3-on-wsl-ubuntu/4856 "2022-09-24T08:18:59Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![FreaX\_997](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/freax_997/32/2031_2.png) [@FreaX\_997](https://gromacs.bioexcel.eu/u/FreaX_997)\
**Post date:** [September 24, 2022, 8:18am UTC](https://gromacs.bioexcel.eu/t/cmake-error-when-trying-to-build-gromacs-version-2022-3-on-wsl-ubuntu/4856/1 "2022-09-24T08:18:59Z")

</div>

GROMACS version: 2022.3

Hello all!

I’m trying to install GROMACS on WSL2 using Ubuntu 22.04.1. Since I have an NVIDIA GeForce RTX 3060 GPU, CUDA enabled, I want to install GROMACS on the GPU.

However when I run this cmake command:

cmake … -DGMX\_BUILD\_OWN\_FFTW=ON -DREGRESSIONTEST\_DOWNLOAD=ON -DGMX\_MPI=ON -DGMX\_GPU=CUDA -DCUDA\_TOOLKIT\_ROOT\_DIR=/usr/local/cuda

I get the following error:

CMake Error in /mnt/d/d/GROMACS stuff/gromacs-2022.3/build/CMakeFiles/CMakeTmp/CMakeLists.txt:  
Imported target “MPI::MPI\_CXX” includes non-existent path

```
"/usr/lib/x86_64-linux-gnu/openmpi/include"

```

in its INTERFACE\_INCLUDE\_DIRECTORIES. Possible reasons include:

- The path was deleted, renamed, or moved to another location.

- An install or uninstall procedure did not complete successfully.

- The installation package was faulty and references files it does not  
provide.

CMake Error in /mnt/d/d/GROMACS stuff/gromacs-2022.3/build/CMakeFiles/CMakeTmp/CMakeLists.txt:  
Imported target “MPI::MPI\_CXX” includes non-existent path

```
"/usr/lib/x86_64-linux-gnu/openmpi/include"

```

in its INTERFACE\_INCLUDE\_DIRECTORIES. Possible reasons include:

- The path was deleted, renamed, or moved to another location.

- An install or uninstall procedure did not complete successfully.

- The installation package was faulty and references files it does not  
provide.

CMake Error at /usr/share/cmake-3.22/Modules/FindMPI.cmake:1264 (try\_compile):  
Failed to generate test project build system.  
Call Stack (most recent call first):  
/usr/share/cmake-3.22/Modules/FindMPI.cmake:1315 (\_MPI\_try\_staged\_settings)  
/usr/share/cmake-3.22/Modules/FindMPI.cmake:1638 (\_MPI\_check\_lang\_works)  
cmake/gmxManageMPI.cmake:65 (find\_package)  
CMakeLists.txt:426 (include)

– Configuring incomplete, errors occurred!  
See also “/mnt/d/d/GROMACS stuff/gromacs-2022.3/build/CMakeFiles/CMakeOutput.log”.  
See also “/mnt/d/d/GROMACS stuff/gromacs-2022.3/build/CMakeFiles/CMakeError.log”.

I have installed both openMPI and MPICH.  
I have no idea why this error occurs and don’t know how to fix it since I am very new to MD simulation software and do not have a Computer Science background at all.

I would be very grateful for any and all help I can get here.

Thank You,  
Sarthak

---

<div class="post-metadata">

**Author:** ![alevilla](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/alevilla/32/439_2.png) [@alevilla](https://gromacs.bioexcel.eu/u/alevilla)\
**Post date:** [September 30, 2022, 11:49am UTC](https://gromacs.bioexcel.eu/t/cmake-error-when-trying-to-build-gromacs-version-2022-3-on-wsl-ubuntu/4856/2 "2022-09-30T11:49:12Z")

</div>

HI,

> [@FreaX\_997](#):
>
> I have installed both openMPI and MPICH.

It may be that you have installed openMPI and MPICH in a location different that the one gromacs is looking at. You could check that your installation were properly terminated and that the location (PATH) corresponds to the one that GROMACS is looking.

\Alessandra

---

<div class="post-metadata">

**Author:** ![FreaX\_997](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/freax_997/32/2031_2.png) [@FreaX\_997](https://gromacs.bioexcel.eu/u/FreaX_997)\
**Post date:** [September 30, 2022, 4:26pm UTC](https://gromacs.bioexcel.eu/t/cmake-error-when-trying-to-build-gromacs-version-2022-3-on-wsl-ubuntu/4856/3 "2022-09-30T16:26:53Z")

</div>

Hey Alessandra

Thanks for the reply.

Can you tell me how I can check the locations where I openMPI and MPICH have been installed?

---

<div class="post-metadata">

**Author:** ![alevilla](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/alevilla/32/439_2.png) [@alevilla](https://gromacs.bioexcel.eu/u/alevilla)\
**Post date:** [October 5, 2022, 7:57am UTC](https://gromacs.bioexcel.eu/t/cmake-error-when-trying-to-build-gromacs-version-2022-3-on-wsl-ubuntu/4856/4 "2022-10-05T07:57:31Z")

</div>

Hi,  
Probably in this case the best is to look back how you performed the installation. From the installation procedure, you might understand the location  
\Alessandra

---

<div class="post-metadata">

**Author:** ![liuke](https://avatars.discourse-cdn.com/v4/letter/l/96bed5/32.png) [@liuke](https://gromacs.bioexcel.eu/u/liuke)\
**Post date:** [March 21, 2024, 1:14am UTC](https://gromacs.bioexcel.eu/t/cmake-error-when-trying-to-build-gromacs-version-2022-3-on-wsl-ubuntu/4856/5 "2024-03-21T01:14:59Z")

</div>

You need to install the lib of mpi  
“sudo apt install libopenmpi\*”

> sudo apt install libopenmpi

---

<div class="post-metadata">

**Author:** ![obZehn](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/obzehn/32/2629_2.png) [@obZehn](https://gromacs.bioexcel.eu/u/obZehn)\
**Post date:** [March 21, 2024, 8:13am UTC](https://gromacs.bioexcel.eu/t/cmake-error-when-trying-to-build-gromacs-version-2022-3-on-wsl-ubuntu/4856/6 "2024-03-21T08:13:33Z")

</div>

Are you sure you need MPI? If not, set -DGMX\_MPI=NO, which will solve this issue automatically.

Otherwise, from the look of it the installation is failing because the installer can’t find an MPI installation, so you should or add the mpi installation to the PATH variable or use cmake to point to the directories where mpi has been installed. What do you get for example if you type which mpirun?
