Difficulties in installing GROMACS

GROMACS version:2023.2
GROMACS modification: Yes/No
Here post your question

(base) pc07@pc07-HP-Z440-Workstation:~/Desktop/MD_GROMACS/gromacs-2023.2/build$ cmake . -DGMX_GPU=CUDA -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda
– Checking for module ‘mpi-c’
– No package ‘mpi-c’ found
– Checking for module ‘mpi-cxx’
– No package ‘mpi-cxx’ found
– Found CUDA: /usr/local/cuda (found suitable version “11.5”, minimum required is “11.0”)
– Adding work-around for issue compiling CUDA code with glibc 2.23 string.h
– Check for working NVCC/C++ compiler combination with nvcc ‘/usr/bin/nvcc’
– Check for working NVCC/C compiler combination - broken
– /usr/bin/nvcc standard output: ‘’
– /usr/bin/nvcc standard error: '/usr/include/c++/11/bits/std_function.h:435:145: error: parameter packs not expanded with ‘…’:
435 | function(_Functor&& __f)
| ^
/usr/include/c++/11/bits/std_function.h:435:145: note: ‘_ArgTypes’
/usr/include/c++/11/bits/std_function.h:530:146: error: parameter packs not expanded with ‘…’:
530 | operator=(_Functor&& __f)
| ^
/usr/include/c++/11/bits/std_function.h:530:146: note: ‘_ArgTypes’

CMake Error at cmake/gmxManageNvccConfig.cmake:110 (message):
CUDA compiler does not seem to be functional or is not compatible with the
host compiler. Set the GMX_NVCC_WORKS CMake cache variable to bypass this
check if you know what you are doing.
Call Stack (most recent call first):
cmake/gmxManageCuda.cmake:105 (include)
CMakeLists.txt:656 (include)

– Configuring incomplete, errors occurred!
See also “/home/pc07/Desktop/MD_GROMACS/gromacs-2023.2/build/CMakeFiles/CMakeOutput.log”.
See also “/home/pc07/Desktop/MD_GROMACS/gromacs-2023.2/build/CMakeFiles/CMakeError.log”.

Hi! There is a known issue that CUDA 11.5, e.g. bundled with Ubuntu, is not compatible with GCC 11: https://manual.gromacs.org/current/user-guide/known-issues.html#unable-to-build-with-cuda-11-5-11-6-and-gcc-11-on-ubuntu-22-04. You can try either upgrading CUDA or using older GCC (sudo apt install gcc-9 g++-9, and then add -DCMAKE_C_COMPILER=gcc-9 -DCMAKE_CXX_COMPILER=g++-9 to your CMake cll)