# Installation error of GMX+CP2K on WSL

**URL:** <https://gromacs.bioexcel.eu/t/installation-error-of-gmx-cp2k-on-wsl/6868>\
**Category:** User discussions\
**Tags:** installation-error\
**Created:** [July 20, 2023, 11:30pm UTC](https://gromacs.bioexcel.eu/t/installation-error-of-gmx-cp2k-on-wsl/6868 "2023-07-20T23:30:57Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![aw10279](https://avatars.discourse-cdn.com/v4/letter/a/b77776/32.png) [@aw10279](https://gromacs.bioexcel.eu/u/aw10279)\
**Post date:** [July 20, 2023, 11:30pm UTC](https://gromacs.bioexcel.eu/t/installation-error-of-gmx-cp2k-on-wsl/6868/1 "2023-07-20T23:30:57Z")

</div>

GROMACS version: 2023  
GROMACS modification: Yes/No

Dear Gromacs community：

I tried to install GROMACS 2023 in combination with CP2K.2023.1 on WSL.I successfully install cp2k.2023.1 and tried to install gromacs, then I got this error at the end:

```auto
[100%] Building CXX object src/programs/CMakeFiles/gmx_objlib.dir/gmx.cpp.o
[100%] Building CXX object src/programs/CMakeFiles/gmx_objlib.dir/legacymodules.cpp.o
[100%] Built target gmx_objlib
[100%] Linking CXX executable ../../bin/gmx_d
/usr/bin/ld: /home/fyy/soft/cp2k-2023.1/lib/local/psmp/libcp2k.a(message_passing.o): in function `__message_passing_MOD_mp_stop':
/home/fyy/soft/cp2k-2023.1/src/mpiwrap/message_passing.F:1166: undefined reference to `mpi_error_string_'
/usr/bin/ld: /home/fyy/soft/cp2k-2023.1/lib/local/psmp/libcp2k.a(message_passing.o): in function `__message_passing_MOD_mp_iallgatherv_iv_internal.constprop.0':
/home/fyy/soft/cp2k-2023.1/src/mpiwrap/message_passing.fypp:2609: undefined reference to `mpi_iallgatherv_'
......
/usr/bin/ld: /home/fyy/soft/cp2k-2023.1/lib/local/psmp/exts/dbcsr/libdbcsr.a(dbcsr_mpiwrap.o): in function `__dbcsr_mpiwrap_MOD_mp_abort':
/home/fyy/soft/cp2k-2023.1/exts/dbcsr/src/mpi/dbcsr_mpiwrap.F:730: undefined reference to `mpi_abort_'
/usr/bin/ld: /home/fyy/soft/cp2k-2023.1/lib/local/psmp/exts/dbcsr/libdbcsr.a(dbcsr_mpiwrap.o): in function `__dbcsr_mpiwrap_MOD_mp_world_finalize':
/home/fyy/soft/cp2k-2023.1/exts/dbcsr/src/mpi/dbcsr_mpiwrap.F:531: undefined reference to `mpi_barrier_'
/usr/bin/ld: /home/fyy/soft/cp2k-2023.1/exts/dbcsr/src/mpi/dbcsr_mpiwrap.F:526: undefined reference to `mpi_finalize_'
/usr/bin/ld: /home/fyy/soft/cp2k-2023.1/lib/local/psmp/exts/dbcsr/libdbcsr.a(dbcsr_mpiwrap.o): in function `__dbcsr_mpiwrap_MOD_mp_reordering':
/home/fyy/soft/cp2k-2023.1/exts/dbcsr/src/mpi/dbcsr_mpiwrap.F:480: undefined reference to `mpi_comm_group_'
/usr/bin/ld: /home/fyy/soft/cp2k-2023.1/exts/dbcsr/src/mpi/dbcsr_mpiwrap.F:504: undefined reference to `mpi_group_incl_'
/usr/bin/ld: /home/fyy/soft/cp2k-2023.1/exts/dbcsr/src/mpi/dbcsr_mpiwrap.F:480: undefined reference to `mpi_comm_create_'
/usr/bin/ld: /home/fyy/soft/cp2k-2023.1/exts/dbcsr/src/mpi/dbcsr_mpiwrap.F:480: undefined reference to `mpi_group_free_'
/usr/bin/ld: /home/fyy/soft/cp2k-2023.1/exts/dbcsr/src/mpi/dbcsr_mpiwrap.F:480: undefined reference to `mpi_group_free_'
/usr/bin/ld: /home/fyy/soft/cp2k-2023.1/lib/local/psmp/exts/dbcsr/libdbcsr.a(dbcsr_mpiwrap.o): in function `__dbcsr_mpiwrap_MOD_mp_world_init':
/home/fyy/soft/cp2k-2023.1/exts/dbcsr/src/mpi/dbcsr_mpiwrap.F:460: undefined reference to `mpi_comm_set_errhandler_'
/usr/bin/ld: /home/fyy/soft/cp2k-2023.1/exts/dbcsr/src/mpi/dbcsr_mpiwrap.F:453: undefined reference to `mpi_init_thread_'
collect2: error: ld returned 1 exit status
make[2]: *** [src/programs/CMakeFiles/gmx.dir/build.make:95: bin/gmx_d] Error 1
make[1]: *** [CMakeFiles/Makefile2:5782: src/programs/CMakeFiles/gmx.dir/all] Error 2
make: *** [Makefile:166: all] Error 2

```

I can’t understand these errors, they look like they are related to mpi and modules. I have installed fftw, plumed, mpich, openmpi and modules useing apt-get before, so I don’t know what’s the problem is. I lowered the version of gmx and cp2k but the problem is still there.

I installed cp2k with:  
`./install_cp2k_toolchain.sh --with-libxsmm=install --with-elpa=no --with-libxc=install --with-libint=install --with-gsl=no --with-libvdwxc=no --with-spglib=no --with-hdf5=no --with-spfft=no --with-cosma=no --with-libvori=no --with-sirius=no --with-scalapack=install --with-openblas=system --with-fftw=system --with-openmpi=system --with-plumed=system --with-cmake=system`

And installed gromacs with:

`sudo cmake .. -DCMAKE_INSTALL_PREFIX=/home/fyy/softwares/gmx_qm_gpu -DBUILD_SHARED_LIBS=OFF -DGMXAPI=OFF -DGMX_INSTALL_NBLIB_API=OFF -DGMX_FFT_LIBRARY=fftw3 -DGMX_SIMD=AVX2_256 -DGMX_DOUBLE=ON -DGMX_CP2K=ON -DCP2K_DIR=/home/fyy/soft/cp2k-2023.1/lib/local/psmp -DCP2K_LINKER_FLAGS="-Wl,--enable-new-dtags -pthread -L/usr/lib/x86_64-linux-gnu/openmpi/lib -L'/home/fyy/soft/cp2k-2023.1/tools/toolchain/install/fftw-3.3.10/lib' -Wl,-rpath,'/home/fyy/soft/cp2k-2023.1/tools/toolchain/install/fftw-3.3.10/lib' -L'/home/fyy/soft/cp2k-2023.1/tools/toolchain/install/libint-v2.6.0-cp2k-lmax-5/lib' -L'/home/fyy/soft/cp2k-2023.1/tools/toolchain/install/libxc-6.0.0/lib' -Wl,-rpath,'/home/fyy/soft/cp2k-2023.1/tools/toolchain/install/libxc-6.0.0/lib' -L'/home/fyy/soft/cp2k-2023.1/tools/toolchain/install/libxsmm-1.17/lib' -Wl,-rpath,'/home/fyy/soft/cp2k-2023.1/tools/toolchain/install/libxsmm-1.17/lib' -L'/home/fyy/soft/cp2k-2023.1/tools/toolchain/install/scalapack-2.2.1/lib' -Wl,-rpath,'/home/fyy/soft/cp2k-2023.1/tools/toolchain/install/scalapack-2.2.1/lib' -L'/usr/local/plumed2.90/lib' -Wl,-rpath,'/usr/local/plumed2.90/lib' -lplumed -ldl -lstdc++ -lz -ldl -lscalapack -lxsmmf -lxsmm -ldl -lpthread -lxcf03 -lxc -lint2 -lfftw3_mpi -lfftw3 -lfftw3_omp -lmpi_cxx -lmpi -lopenblas -lstdc++" -DCMAKE_PREFIX_PATH='/home/fyy/soft/cp2k-2023.1/tools/toolchain/install/fftw-3.3.10/'`

Please let me know if you have any suggestions. Thank you very much for your help!

Best

aw10279

> **Summary**
>
> This text will be hidden

---

<div class="post-metadata">

**Author:** ![dmorozov](https://avatars.discourse-cdn.com/v4/letter/d/dec6dc/32.png) [@dmorozov](https://gromacs.bioexcel.eu/u/dmorozov)\
**Post date:** [July 21, 2023, 12:17pm UTC](https://gromacs.bioexcel.eu/t/installation-error-of-gmx-cp2k-on-wsl/6868/2 "2023-07-21T12:17:59Z")

</div>

Hi,

Seems like you are compiled CP2K with MPI but GROMACS is configured without MPI

---

<div class="post-metadata">

**Author:** ![aw10279](https://avatars.discourse-cdn.com/v4/letter/a/b77776/32.png) [@aw10279](https://gromacs.bioexcel.eu/u/aw10279)\
**Post date:** [July 22, 2023, 5:14am UTC](https://gromacs.bioexcel.eu/t/installation-error-of-gmx-cp2k-on-wsl/6868/3 "2023-07-22T05:14:37Z")

</div>

This really works! I just added -DGMX\_MPI=ON and it finished perfectly! Thank you so much!

---

<div class="post-metadata">

**Author:** ![ssap](https://avatars.discourse-cdn.com/v4/letter/s/ba8739/32.png) [@ssap](https://gromacs.bioexcel.eu/u/ssap)\
**Post date:** [September 14, 2023, 7:30am UTC](https://gromacs.bioexcel.eu/t/installation-error-of-gmx-cp2k-on-wsl/6868/4 "2023-09-14T07:30:08Z")

</div>

@aw10279 can you please tell me the command you used. as i am also facing the same issue  
i am using this command:  
%%bash

wget ftp://ftp.gromacs.org/gromacs/gromacs-2021.tar.gz

tar xfz gromacs-2021.tar.gz

cd /content/gromacs-2021

mkdir /content/gromacs-2021/build

cd /content/gromacs-2021/build

cmake … -DGMX\_BUILD\_OWN\_FFTW=ON -DREGRESSIONTEST\_DOWNLOAD=ON -DGMX\_GPU=CUDA

make -j 2

make install

source /usr/local/gromacs/bin/GMXRC

---

<div class="post-metadata">

**Author:** ![aw10279](https://avatars.discourse-cdn.com/v4/letter/a/b77776/32.png) [@aw10279](https://gromacs.bioexcel.eu/u/aw10279)\
**Post date:** [September 14, 2023, 7:40am UTC](https://gromacs.bioexcel.eu/t/installation-error-of-gmx-cp2k-on-wsl/6868/5 "2023-09-14T07:40:16Z")

</div>

> [@aw10279](#):
>
> sudo cmake … -DCMAKE\_INSTALL\_PREFIX=/home/fyy/softwares/gmx\_qm\_gpu -DBUILD\_SHARED\_LIBS=OFF -DGMXAPI=OFF -DGMX\_INSTALL\_NBLIB\_API=OFF -DGMX\_FFT\_LIBRARY=fftw3 -DGMX\_SIMD=AVX2\_256 -DGMX\_DOUBLE=ON -DGMX\_CP2K=ON

my command is just like:  
sudo cmake … -DCMAKE\_INSTALL\_PREFIX=/home/fyy/softwares/gmx\_cp2k -DBUILD\_SHARED\_LIBS=OFF -DGMXAPI=OFF -DGMX\_INSTALL\_NBLIB\_API=OFF -DGMX\_SIMD=AVX2\_256 -DGMX\_DOUBLE=ON -DGMX\_CP2K=ON -DGMX\_MPI=ON

-DGMX\_DOUBLE, -DCMAKE\_INSTALL\_PREFIX and DGMX\_SIMD are optional, others must be like this.

---

<div class="post-metadata">

**Author:** ![ssap](https://avatars.discourse-cdn.com/v4/letter/s/ba8739/32.png) [@ssap](https://gromacs.bioexcel.eu/u/ssap)\
**Post date:** [September 14, 2023, 7:52am UTC](https://gromacs.bioexcel.eu/t/installation-error-of-gmx-cp2k-on-wsl/6868/6 "2023-09-14T07:52:22Z")

</div>

i am new to do this, can you please help me to modify my command ?
