# Install GROMACS with CP2K failed during make

**URL:** <https://gromacs.bioexcel.eu/t/install-gromacs-with-cp2k-failed-during-make/5666>\
**Category:** User discussions\
**Tags:** qm-mm\
**Created:** [January 27, 2023, 9:45pm UTC](https://gromacs.bioexcel.eu/t/install-gromacs-with-cp2k-failed-during-make/5666 "2023-01-27T21:45:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lishiemil](https://avatars.discourse-cdn.com/v4/letter/l/db5fbb/32.png) [@lishiemil](https://gromacs.bioexcel.eu/u/lishiemil)\
**Post date:** [January 27, 2023, 9:45pm UTC](https://gromacs.bioexcel.eu/t/install-gromacs-with-cp2k-failed-during-make/5666/1 "2023-01-27T21:45:03Z")

</div>

GROMACS version:2022.1  
GROMACS modification: Yes/No

I am trying to compile GROMACS with CP2K package to do QM/MM simulation. I have installed CP2K and the cmake process for GROMACS configured without any problem. But the make -j N process failed at 100% Lining CXX executable …/…/bin/gmx\_mpi.  
It started to print out a long list of undefined references messages. and then failed with Linker error. Pleas e see below a part of the output print.  
I am not sure where is the problem, I did use the same library as CP2K to compile the GROMACS, and have tried multiple options, but none of them success. I will be greatly appreciated if some one can give me a suggestion where I made the mistake.

The version of my CP2k is 9.1.

Code to compile GROMACS on my cluster.  
`CC=icx CXX=icpx cmake .. -DBUILD_SHARED_LIBS=OFF -DGMXAPI=OFF -DGMX_INSTALL_NBLIB_API=OFF -DGMX_FFT_LIBRARY=mkl -DGMX_MPI=ON -DGMX_OPENMP=ON -DGMX_CYCLE_SUBCOUNTERS=ON -DGMX_GPU=OFF -DGMX_BUILD_HELP=OFF -DGMX_HWLOC=OFF -DGMX_SIMD=AVX_512_KNL -DGMX_OPENMP_MAX_THREADS=256 -DGMX_CP2K=ON -DCP2K_DIR=/home/shi.li/downloads/cp2k-9.1/lib/Bebop-knl-x86-64-intel-minimal/psmp -DCMAKE_INSTALL_PREFIX=/home/shi.li/apps/gromacs_cp2k`

This configured without any problem.

`make -j 32`

…  
…  
[100%] Built target libgromacs  
[100%] **Linking CXX executable …/…/bin/gmx\_mpi**  
/home/shi.li/downloads/cp2k-9.1/lib/Bebop-knl-x86-64-intel-minimal/psmp/libcp2k.a(libcp2k.o): In function `cp2k_get_version': /gpfs/fs1/home/shi.li/downloads/cp2k-9.1/src/start/libcp2k.F:72: undefined reference to `for\_len\_trim’  
/home/shi.li/downloads/cp2k-9.1/lib/Bebop-knl-x86-64-intel-minimal/psmp/libcp2k.a(libcp2k.o): In function `cp2k_create_force_env': /gpfs/fs1/home/shi.li/downloads/cp2k-9.1/src/start/libcp2k.F:137: undefined reference to `for\_cpystr’  
/gpfs/fs1/home/shi.li/downloads/cp2k-9.1/src/start/libcp2k.F:137: undefined reference to `for_cpystr' ... ... ... gpfs/fs1/home/shi.li/downloads/cp2k-9.1/exts/dbcsr/src/core/dbcsr_list_timerenv.F:21: undefined reference to `for\_dealloc\_allocatable’  
/gpfs/fs1/home/shi.li/downloads/cp2k-9.1/exts/dbcsr/src/core/dbcsr\_list\_timerenv.F:21: undefined reference to `for_dealloc_allocatable' /home/shi.li/downloads/cp2k-9.1/lib/Bebop-knl-x86-64-intel-minimal/psmp/exts/dbcsr/libdbcsr.a(dbcsr_list_timerenv.o): In function `dbcsr\_list\_timerenv\_mp\_list\_timerenv\_init\_‘:  
/gpfs/fs1/home/shi.li/downloads/cp2k-9.1/exts/dbcsr/src/core/dbcsr\_list\_timerenv.F:21: undefined reference to `for_check_mult_overflow64' /gpfs/fs1/home/shi.li/downloads/cp2k-9.1/exts/dbcsr/src/core/dbcsr_list_timerenv.F:21: undefined reference to `for\_allocate’  
/gpfs/fs1/home/shi.li/downloads/cp2k-9.1/exts/dbcsr/src/core/dbcsr\_list\_timerenv.F:21: undefined reference to `for\_check\_mult\_overflow64’  
clang++: **error:** **linker command failed with exit code 1 (use -v to see invocation)**  
make[2]: \*\*\* [bin/gmx\_mpi] Error 1  
make[1]: \*\*\* [src/programs/CMakeFiles/gmx.dir/all] Error 2  
make: \*\*\* [all] Error 2
