CMAKE build error with Gromacs 2024.1 and Intel oneAPI 2024

I am trying to build Gromacs 2024.1 using the Intel oneAPI compiler version 2024.

I am running into an error that seems to be related to how the icpx compiler is handling the C++17 standard, or at least how cmake appears to be handling it.

The following is my cmake command:

cmake -DCMAKE_CXX_COMPILER=`which icpx` -DCMAKE_C_COMPILER=`which icx` -DCMAKE_EXE_LINKER_FLAGS="-std=c++17 -lstdc++fs" -DGMX_MPI=off -DGMX_SIMD=AVX_256 -DCMAKE_INSTALL_PREFIX=$PWD/../../install -DGMX_DOUBLE=off -DGMX_FFT_LIBRARY=mkl -DGMX_GPU=off ..

Based on the debug information I can pull from the cmake build directory, I am seeing the following error in the linking of a test module:

Run Build Command(s):/storage/icds/RISE/sw8/cmake-3.26.3-gcc/bin/cmake - E env VERBOSE=1 /usr/bin/gmake -f Makefile cmTC_20231/fast && /usr/bin/gmake -f CMakeFiles/cmTC_20231.dir/build.make CMakeFiles/cmTC_20231.dir/build gmake[1]: Entering directory '/storage/group/RISE/nucci/gromacs/gromacs- 2024.1/build/CMakeFiles/CMakeScratch/TryCompile-670qe1' Building CXX object CMakeFiles/cmTC_20231.dir/src.cxx.o /storage/icds/RISE/sw8/intel/2024.0/oneapi/compiler/2024.0/bin/icpx -DCXX17_COMPILES_WITH_HELP --gcc-toolchain=/usr/ -std=c++17 -MD -MT CMakeFiles/cmTC_20231.dir/src.cxx.o -MF CMakeFiles/cmTC_20231.dir/src.cxx.o.d -o CMakeFiles/cmTC_20231.dir/src.cxx.o -c /storage/home/nucci/group/gromacs/gromacs-2024.1/build/CMakeFiles/CMakeScratch/TryCompile-670qe1/src.cxx Linking CXX executable cmTC_20231 /storage/icds/RISE/sw8/cmake-3.26.3-gcc/bin/cmake -E cmake_link_script CMakeFiles/cmTC_20231.dir/link.txt --verbose=1 /storage/icds/RISE/sw8/intel/2024.0/oneapi/compiler/2024.0/bin/icpx --gcc-toolchain=/usr/ -std=c++17 -lstdc++fs CMakeFiles/cmTC_20231.dir/src.cxx.o -o cmTC_20231 CMakeFiles/cmTC_20231.dir/src.cxx.o: In function `foo()': src.cxx:(.text+0xd1): undefined reference to `std::filesystem::current_path[abi:cxx11]()' icpx: error: linker command failed with exit code 1 (use -v to see invocation) gmake[1]: *** [CMakeFiles/cmTC_20231.dir/build.make:100: cmTC_20231] Error 1

The error “undefined reference to `std::filesystem::current_pathabi:cxx11” should have been resolved by including the “-lstdc++fs” link option as seen in the command line. (Testing this with sample codes shows correct compilations with this link flag).

However the cmake operation continues to fail, despite this option being passed. I tried also including the option “-std=c++17” but that did not help any.

Can anyone shed guidance on what I may be doing incorrectly, or supply a “more correct” set of cmake build options for Gromacs using the Intel oneAPI comilers?

Thanks.

Did you try -std=c++11 instead since that is the path is missing in the error?

Jeff - since this is on our system, can you send me where you are hitting that bug or source and I can give it a whirl. I promise to post the solution here (if I find it) so we all know. - Chuck

PS: just send me the code path in ICDS Slack

It requires c++17, which I did have in the path.