Compilation error : Target "cmTC_3823b" requires the language dialect "CXX17"

GROMACS version: 2021.2
GROMACS modification: No

Dear users,

I am facing a compilation error when trying to install Gromacs on Centos 7.9 :

/tmp/cmake-3.20.2-linux-x86_64/bin/cmake --trace …

CMake Error in /tmp/gromacs-2021.2/build-gromacs/CMakeFiles/CMakeTmp/CMakeLists.txt:
Target “cmTC_f65d6” requires the language dialect “CXX17” , but CMake does
not know the compile flags to use to enable it.

CMake Error at /tmp/cmake-3.20.2-linux-x86_64/share/cmake-3.20/Modules/FindOpenMP.cmake:214 (try_compile):
Failed to generate test project build system.
Call Stack (most recent call first):
/tmp/cmake-3.20.2-linux-x86_64/share/cmake-3.20/Modules/FindOpenMP.cmake:459 (_OPENMP_GET_FLAGS)
cmake/gmxManageOpenMP.cmake:43 (find_package)
CMakeLists.txt:292 (include)

I am running the latest cmake version available.

Logs and a trace on cmake do not show more information.

Do you have any idea on how to solve this issue?

Thank you for any suggestions.



Hello, I get the same error here and could not find a solution either.


The new version gcc would be the key to slove the problem.


the default C++ compiler on CentOS is too old to compile C++17 that is needed for newer versions of GROMACS. You can try loading one of the devtoolsets to get a more recent version that works.



Although a new version gcc is a good solution, notice that better earlier than 9.x version and I set up a 7.3.0 version successfully. Because gcc 9.2.0 is too high to be suitable for cuda 10.1 version which need to be set up at the option GPU=CUDA when the cmake procedure is performed

I had the same problem. Fixed by using the flag
I am using centos 7 and GCC 9
Hope this helps.