# Errors while compiling MPI-based GROMACS

**URL:** <https://gromacs.bioexcel.eu/t/errors-while-compiling-mpi-based-gromacs/1406>\
**Category:** User discussions\
**Created:** [January 8, 2021, 5:23pm UTC](https://gromacs.bioexcel.eu/t/errors-while-compiling-mpi-based-gromacs/1406 "2021-01-08T17:23:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![roshanshrestha](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/roshanshrestha/32/515_2.png) [@roshanshrestha](https://gromacs.bioexcel.eu/u/roshanshrestha)\
**Post date:** [January 8, 2021, 5:23pm UTC](https://gromacs.bioexcel.eu/t/errors-while-compiling-mpi-based-gromacs/1406/1 "2021-01-08T17:23:57Z")

</div>

GROMACS version: 2020.4  
GROMACS modification: No  
Compiling gromacs-2020.4 fetched me these errors when I gave this command in the terminal:

> cmake … -DCMAKE\_C\_COMPILER=mpicc -DCMAKE\_CXX\_COMPILER=mpicxx -DGMX\_MPI=ON -DGMX\_DOUBLE=OFF -DGMX\_BUILD\_OWN\_FFTW=ON -DREGRESSIONTEST\_DOWNLOAD=ON -DGMX\_GPU=on

Errors are given below  
– The C compiler identification is GNU 10.2.0  
– The CXX compiler identification is GNU 10.2.0  
– Check for working C compiler: /usr/bin/mpicc  
– Check for working C compiler: /usr/bin/mpicc – broken  
CMake Error at /usr/share/cmake-3.16/Modules/CMakeTestCCompiler.cmake:60 (message):  
The C compiler

```
"/usr/bin/mpicc"

```

is not able to compile a simple test program.

It fails with the following output:

```
Change Dir: /home/roshan/gromacs-2020.4/build/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/gmake cmTC_20912/fast && /usr/bin/gmake -f CMakeFiles/cmTC_20912.dir/build.make CMakeFiles/cmTC_20912.dir/build
gmake[1]: Entering directory '/home/roshan/gromacs-2020.4/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_20912.dir/testCCompiler.c.o
/usr/bin/mpicc -o CMakeFiles/cmTC_20912.dir/testCCompiler.c.o -c /home/roshan/gromacs-2020.4/build/CMakeFiles/CMakeTmp/testCCompiler.c
Linking C executable cmTC_20912
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_20912.dir/link.txt --verbose=1
/usr/bin/mpicc CMakeFiles/cmTC_20912.dir/testCCompiler.c.o -o cmTC_20912 
/usr/bin/ld: cannot find -lmpi
/usr/bin/ld: cannot find -lopen-rte
/usr/bin/ld: cannot find -lopen-pal
/usr/bin/ld: cannot find -lhwloc
/usr/bin/ld: cannot find -levent
/usr/bin/ld: cannot find -levent_pthreads
collect2: error: ld returned 1 exit status
gmake[1]: *** [CMakeFiles/cmTC_20912.dir/build.make:87: cmTC_20912] Error 1
gmake[1]: Leaving directory '/home/roshan/gromacs-2020.4/build/CMakeFiles/CMakeTmp'
gmake: *** [Makefile:121: cmTC_20912/fast] Error 2

```

CMake will not be able to correctly generate this project.  
Call Stack (most recent call first):  
CMakeLists.txt:58 (project)

– Configuring incomplete, errors occurred!  
See also “/home/roshan/gromacs-2020.4/build/CMakeFiles/CMakeOutput.log”.  
See also “/home/roshan/gromacs-2020.4/build/CMakeFiles/CMakeError.log”.

When I checked the error log file, I can see the following warnings:  
/usr/bin/ld: cannot find -lmpi\_cxx  
/usr/bin/ld: cannot find -lmpi  
/usr/bin/ld: cannot find -lopen-rte  
/usr/bin/ld: cannot find -lopen-pal  
/usr/bin/ld: cannot find -lhwloc  
/usr/bin/ld: cannot find -levent  
/usr/bin/ld: cannot find -levent\_pthreads

Looking forward to your suggestions. Thanks.

---

<div class="post-metadata">

**Author:** ![cblau](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/cblau/32/5_2.png) [@cblau](https://gromacs.bioexcel.eu/u/cblau)\
**Post date:** [January 12, 2021, 3:40pm UTC](https://gromacs.bioexcel.eu/t/errors-while-compiling-mpi-based-gromacs/1406/2 "2021-01-12T15:40:13Z")

</div>

Hi Roshan,

you might miss the the necessary `MPI` librarires. If you are using ubuntu, you should be able to get them via typing:

```auto
sudo apt install mpich

```

---

<div class="post-metadata">

**Author:** ![cblau](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/cblau/32/5_2.png) [@cblau](https://gromacs.bioexcel.eu/u/cblau)\
**Post date:** [January 12, 2021, 3:44pm UTC](https://gromacs.bioexcel.eu/t/errors-while-compiling-mpi-based-gromacs/1406/3 "2021-01-12T15:44:18Z")

</div>

And hwloc is missing, which you can get with  
`sudo apt install hwloc`
