Nvcc error when running CMake

GROMACS version: 2024.6
GROMACS modification: No
CMake version: 3.31.6

I keep encountering an error when trying to build GROMACS 2024.6. Error message:

-- Found CUDA: /usr/local/cuda-12.8 (found suitable version "12.8", 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/local/cuda-12.8/bin/nvcc'
-- Check for working NVCC/C compiler combination - broken
-- /usr/local/cuda-12.8/bin/nvcc standard output: ''
-- /usr/local/cuda-12.8/bin/nvcc standard error:  'nvcc warning : Support for offline compilation for architectures prior to '<compute/sm/lto>_75' will be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).
/usr/include/bits/mathcalls.h(79): error: exception specification is incompatible with that of previous function "cospi" (declared at line 2601 of /usr/local/cuda-12.8/bin/../targets/x86_64-linux/include/crt/math_functions.h)
   extern double cospi (double __x) noexcept (true); extern double __cospi (double __x) noexcept (true);
                                    ^

/usr/include/bits/mathcalls.h(81): error: exception specification is incompatible with that of previous function "sinpi" (declared at line 2556 of /usr/local/cuda-12.8/bin/../targets/x86_64-linux/include/crt/math_functions.h)
   extern double sinpi (double __x) noexcept (true); extern double __sinpi (double __x) noexcept (true);
                                    ^

/usr/include/bits/mathcalls.h(79): error: exception specification is incompatible with that of previous function "cospif" (declared at line 2623 of /usr/local/cuda-12.8/bin/../targets/x86_64-linux/include/crt/math_functions.h)
   extern float cospif (float __x) noexcept (true); extern float __cospif (float __x) noexcept (true);
                                   ^

/usr/include/bits/mathcalls.h(81): error: exception specification is incompatible with that of previous function "sinpif" (declared at line 2579 of /usr/local/cuda-12.8/bin/../targets/x86_64-linux/include/crt/math_functions.h)
   extern float sinpif (float __x) noexcept (true); extern float __sinpif (float __x) noexcept (true);
                                   ^

4 errors detected in the compilation of "/home/cyan/Desktop/Cyan/gromacs-2024.6/cmake/TestCUDA.cu".
'
CMake Error at /home/cyan/Desktop/Cyan/Desktop/Cyan/Desktop/Cyan/Desktop/Cyan/gromacs-2024.6/cmake/gmxManageNvccConfig.cmake:101 (if):
  if given arguments:

    "nvcc warning : Support for offline compilation for architectures prior to '<compute/sm/lto>_75' will be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).

  /usr/include/bits/mathcalls.h(79): error: exception specification is
  incompatible with that of previous function \"cospi\" (declared at line
  2601 of
  /usr/local/cuda-12.8/bin/../targets/x86_64-linux/include/crt/math_functions.h)


     extern double cospi (double __x) noexcept (true)" " extern double __cospi (double __x) noexcept (true)" "
                                      ^

  

  /usr/include/bits/mathcalls.h(81): error: exception specification is
  incompatible with that of previous function \"sinpi\" (declared at line
  2556 of
  /usr/local/cuda-12.8/bin/../targets/x86_64-linux/include/crt/math_functions.h)


     extern double sinpi (double __x) noexcept (true)" " extern double __sinpi (double __x) noexcept (true)" "
                                      ^

  

  /usr/include/bits/mathcalls.h(79): error: exception specification is
  incompatible with that of previous function \"cospif\" (declared at line
  2623 of
  /usr/local/cuda-12.8/bin/../targets/x86_64-linux/include/crt/math_functions.h)


     extern float cospif (float __x) noexcept (true)" " extern float __cospif (float __x) noexcept (true)" "
                                     ^

  

  /usr/include/bits/mathcalls.h(81): error: exception specification is
  incompatible with that of previous function \"sinpif\" (declared at line
  2579 of
  /usr/local/cuda-12.8/bin/../targets/x86_64-linux/include/crt/math_functions.h)


     extern float sinpif (float __x) noexcept (true)" " extern float __sinpif (float __x) noexcept (true)" "
                                     ^

  

  4 errors detected in the compilation of
  \"/home/cyan/Desktop/Cyan/gromacs-2024.6/cmake/TestCUDA.cu\".

  " "MATCHES" "nsupported"

  Unknown arguments specified
Call Stack (most recent call first):
  /home/cyan/Desktop/Cyan/Desktop/Cyan/Desktop/Cyan/Desktop/Cyan/gromacs-2024.6/cmake/gmxManageCuda.cmake:110 (include)
  /home/cyan/Desktop/Cyan/Desktop/Cyan/gromacs-2024.6/CMakeLists.txt:700 (include)


-- Configuring incomplete, errors occurred!

Previous to this, I had another error complaining that my gcc was too new (Fedora 42 ships with gcc 15). I subsequently installed gcc-14 and defined the CC and CXX environment variables to point to the correct executables. After that, I’m getting the above error message, which persists on fresh attempts of creating the build directory and running CMake

More info that may be pertinent:

nvidia-smi:

> nvidia-smi
Tue Aug 26 21:37:56 2025       
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 575.64.05              Driver Version: 575.64.05      CUDA Version: 12.9     |
|-----------------------------------------+------------------------+----------------------+
| GPU  Name                 Persistence-M | Bus-Id          Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |           Memory-Usage | GPU-Util  Compute M. |
|                                         |                        |               MIG M. |
|=========================================+========================+======================|
|   0  NVIDIA GeForce RTX 3060 Ti     Off |   00000000:07:00.0  On |                  N/A |
| 31%   31C    P8             12W /  200W |    1760MiB /   8192MiB |      0%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+

nvcc --version

> nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2025 NVIDIA Corporation
Built on Fri_Feb_21_20:23:50_PST_2025
Cuda compilation tools, release 12.8, V12.8.93
Build cuda_12.8.r12.8/compiler.35583870_0

$CC --version

> $CC --version
gcc-14 (GCC) 14.2.1 20250210 (Red Hat 14.2.1-8)
Copyright (C) 2024 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Full output of cmake:

> cmake .. -DGMX_BUILD_OWN_FFTW=ON -DGMX_GPU=CUDA --fresh
-- The C compiler identification is GNU 14.2.1
-- The CXX compiler identification is GNU 14.2.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/gcc-14 - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/g++-14 - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Python3: /home/cyan/Desktop/Cyan/Desktop/Cyan/miniconda3/bin/python3.12 (found suitable version "3.12.9", minimum required is "3.7") found components: Interpreter Development Development.Module Development.Embed
-- Selected GPU FFT library - cuFFT
-- Found OpenMP_C: -fopenmp (found version "4.5")
-- Found OpenMP_CXX: -fopenmp (found version "4.5")
-- Found OpenMP: TRUE (found version "4.5")
-- Performing Test CFLAGS_WARN_NO_MISSING_FIELD_INITIALIZERS
-- Performing Test CFLAGS_WARN_NO_MISSING_FIELD_INITIALIZERS - Success
-- Performing Test CFLAGS_EXCESS_PREC
-- Performing Test CFLAGS_EXCESS_PREC - Success
-- Performing Test CFLAGS_COPT
-- Performing Test CFLAGS_COPT - Success
-- Performing Test CFLAGS_NOINLINE
-- Performing Test CFLAGS_NOINLINE - Success
-- Performing Test CXXFLAGS_WARN_NO_MISSING_FIELD_INITIALIZERS
-- Performing Test CXXFLAGS_WARN_NO_MISSING_FIELD_INITIALIZERS - Success
-- Performing Test CXXFLAGS_EXCESS_PREC
-- Performing Test CXXFLAGS_EXCESS_PREC - Success
-- Performing Test CXXFLAGS_COPT
-- Performing Test CXXFLAGS_COPT - Success
-- Performing Test CXXFLAGS_NOINLINE
-- Performing Test CXXFLAGS_NOINLINE - Success
-- Looking for include file unistd.h
-- Looking for include file unistd.h - found
-- Looking for include file pwd.h
-- Looking for include file pwd.h - found
-- Looking for include file dirent.h
-- Looking for include file dirent.h - found
-- Looking for include file time.h
-- Looking for include file time.h - found
-- Looking for include file sys/time.h
-- Looking for include file sys/time.h - found
-- Looking for include file io.h
-- Looking for include file io.h - not found
-- Looking for include file sched.h
-- Looking for include file sched.h - found
-- Looking for include file xmmintrin.h
-- Looking for include file xmmintrin.h - found
-- Looking for gettimeofday
-- Looking for gettimeofday - found
-- Looking for sysconf
-- Looking for sysconf - found
-- Looking for nice
-- Looking for nice - found
-- Looking for fsync
-- Looking for fsync - found
-- Looking for _fileno
-- Looking for _fileno - not found
-- Looking for fileno
-- Looking for fileno - found
-- Looking for _commit
-- Looking for _commit - not found
-- Looking for sigaction
-- Looking for sigaction - found
-- Performing Test HAVE_BUILTIN_CLZ
-- Performing Test HAVE_BUILTIN_CLZ - Success
-- Performing Test HAVE_BUILTIN_CLZLL
-- Performing Test HAVE_BUILTIN_CLZLL - Success
-- Looking for clock_gettime in rt
-- Looking for clock_gettime in rt - found
-- Looking for feenableexcept in m
-- Looking for feenableexcept in m - found
-- Looking for fedisableexcept in m
-- Looking for fedisableexcept in m - found
-- Checking for sched.h GNU affinity API
-- Performing Test sched_affinity_compile
-- Performing Test sched_affinity_compile - Success
-- Looking for include file mm_malloc.h
-- Looking for include file mm_malloc.h - found
-- Looking for include file malloc.h
-- Looking for include file malloc.h - found
-- Checking for _mm_malloc()
-- Checking for _mm_malloc() - supported
-- Looking for posix_memalign
-- Looking for posix_memalign - found
-- Looking for memalign
-- Looking for memalign - not found
-- Using default binary suffix: ""
-- Using default library suffix: ""
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Looking for C++ include pthread.h
-- Looking for C++ include pthread.h - found
-- Performing Test TEST_ATOMICS
-- Performing Test TEST_ATOMICS - Success
-- Atomic operations found
-- Performing Test PTHREAD_SETAFFINITY
-- Performing Test PTHREAD_SETAFFINITY - Success
-- Detecting best SIMD instructions for this CPU
-- Checking for GCC x86 inline asm
-- Checking for GCC x86 inline asm - supported
-- Detected build CPU features - aes amd apic avx avx2 clfsh cmov cx8 cx16 f16c fma htt lahf misalignsse mmx msr nonstop_tsc pclmuldq pdpe1gb popcnt pse rdrnd rdtscp sha sse2 sse3 sse4a sse4.1 sse4.2 ssse3 x2apic
-- Detected build CPU brand - AMD Ryzen 5 5600X 6-Core Processor
-- Detected build CPU family - 25
-- Detected build CPU model - 33
-- Detected best SIMD instructions for this CPU - AVX2_256
-- Performing Test C_mavx2_mfma_FLAG_ACCEPTED
-- Performing Test C_mavx2_mfma_FLAG_ACCEPTED - Success
-- Performing Test C_mavx2_mfma_COMPILE_WORKS
-- Performing Test C_mavx2_mfma_COMPILE_WORKS - Success
-- Performing Test CXX_mavx2_mfma_FLAG_ACCEPTED
-- Performing Test CXX_mavx2_mfma_FLAG_ACCEPTED - Success
-- Performing Test CXX_mavx2_mfma_COMPILE_WORKS
-- Performing Test CXX_mavx2_mfma_COMPILE_WORKS - Success
-- Enabling 256-bit AVX2 SIMD instructions using CXX flags:  -mavx2 -mfma
-- Detecting flags to enable runtime detection of AVX-512 units on newer CPUs
-- Performing Test C_march_skylake_avx512_FLAG_ACCEPTED
-- Performing Test C_march_skylake_avx512_FLAG_ACCEPTED - Success
-- Performing Test C_march_skylake_avx512_COMPILE_WORKS
-- Performing Test C_march_skylake_avx512_COMPILE_WORKS - Success
-- Performing Test CXX_march_skylake_avx512_FLAG_ACCEPTED
-- Performing Test CXX_march_skylake_avx512_FLAG_ACCEPTED - Success
-- Performing Test CXX_march_skylake_avx512_COMPILE_WORKS
-- Performing Test CXX_march_skylake_avx512_COMPILE_WORKS - Success
-- Detecting flags to enable runtime detection of AVX-512 units on newer CPUs -  -march=skylake-avx512
-- Performing Test _Wno_unused_command_line_argument_FLAG_ACCEPTED
-- Performing Test _Wno_unused_command_line_argument_FLAG_ACCEPTED - Success
-- Performing Test _callconv___vectorcall
-- Performing Test _callconv___vectorcall - Failed
-- Performing Test _callconv___regcall
-- Performing Test _callconv___regcall - Failed
-- Performing Test _callconv_ 
-- Performing Test _callconv_  - Success
-- Found CUDA: /usr/local/cuda-12.8 (found suitable version "12.8", 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/local/cuda-12.8/bin/nvcc'
-- Check for working NVCC/C compiler combination - broken
-- /usr/local/cuda-12.8/bin/nvcc standard output: ''
-- /usr/local/cuda-12.8/bin/nvcc standard error:  'nvcc warning : Support for offline compilation for architectures prior to '<compute/sm/lto>_75' will be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).
/usr/include/bits/mathcalls.h(79): error: exception specification is incompatible with that of previous function "cospi" (declared at line 2601 of /usr/local/cuda-12.8/bin/../targets/x86_64-linux/include/crt/math_functions.h)
   extern double cospi (double __x) noexcept (true); extern double __cospi (double __x) noexcept (true);
                                    ^

/usr/include/bits/mathcalls.h(81): error: exception specification is incompatible with that of previous function "sinpi" (declared at line 2556 of /usr/local/cuda-12.8/bin/../targets/x86_64-linux/include/crt/math_functions.h)
   extern double sinpi (double __x) noexcept (true); extern double __sinpi (double __x) noexcept (true);
                                    ^

/usr/include/bits/mathcalls.h(79): error: exception specification is incompatible with that of previous function "cospif" (declared at line 2623 of /usr/local/cuda-12.8/bin/../targets/x86_64-linux/include/crt/math_functions.h)
   extern float cospif (float __x) noexcept (true); extern float __cospif (float __x) noexcept (true);
                                   ^

/usr/include/bits/mathcalls.h(81): error: exception specification is incompatible with that of previous function "sinpif" (declared at line 2579 of /usr/local/cuda-12.8/bin/../targets/x86_64-linux/include/crt/math_functions.h)
   extern float sinpif (float __x) noexcept (true); extern float __sinpif (float __x) noexcept (true);
                                   ^

4 errors detected in the compilation of "/home/cyan/Desktop/Cyan/gromacs-2024.6/cmake/TestCUDA.cu".
'
CMake Error at /home/cyan/Desktop/Cyan/Desktop/Cyan/Desktop/Cyan/Desktop/Cyan/gromacs-2024.6/cmake/gmxManageNvccConfig.cmake:101 (if):
  if given arguments:

    "nvcc warning : Support for offline compilation for architectures prior to '<compute/sm/lto>_75' will be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).

  /usr/include/bits/mathcalls.h(79): error: exception specification is
  incompatible with that of previous function \"cospi\" (declared at line
  2601 of
  /usr/local/cuda-12.8/bin/../targets/x86_64-linux/include/crt/math_functions.h)


     extern double cospi (double __x) noexcept (true)" " extern double __cospi (double __x) noexcept (true)" "
                                      ^

  

  /usr/include/bits/mathcalls.h(81): error: exception specification is
  incompatible with that of previous function \"sinpi\" (declared at line
  2556 of
  /usr/local/cuda-12.8/bin/../targets/x86_64-linux/include/crt/math_functions.h)


     extern double sinpi (double __x) noexcept (true)" " extern double __sinpi (double __x) noexcept (true)" "
                                      ^

  

  /usr/include/bits/mathcalls.h(79): error: exception specification is
  incompatible with that of previous function \"cospif\" (declared at line
  2623 of
  /usr/local/cuda-12.8/bin/../targets/x86_64-linux/include/crt/math_functions.h)


     extern float cospif (float __x) noexcept (true)" " extern float __cospif (float __x) noexcept (true)" "
                                     ^

  

  /usr/include/bits/mathcalls.h(81): error: exception specification is
  incompatible with that of previous function \"sinpif\" (declared at line
  2579 of
  /usr/local/cuda-12.8/bin/../targets/x86_64-linux/include/crt/math_functions.h)


     extern float sinpif (float __x) noexcept (true)" " extern float __sinpif (float __x) noexcept (true)" "
                                     ^

  

  4 errors detected in the compilation of
  \"/home/cyan/Desktop/Cyan/gromacs-2024.6/cmake/TestCUDA.cu\".

  " "MATCHES" "nsupported"

  Unknown arguments specified
Call Stack (most recent call first):
  /home/cyan/Desktop/Cyan/Desktop/Cyan/Desktop/Cyan/Desktop/Cyan/gromacs-2024.6/cmake/gmxManageCuda.cmake:110 (include)
  /home/cyan/Desktop/Cyan/Desktop/Cyan/gromacs-2024.6/CMakeLists.txt:700 (include)


-- Configuring incomplete, errors occurred!

Thanks in advance for the help.

Hi,

This looks like the problem with too-new glibc library, described in

You’re right. I did some further digging after making the post and came across that forum post myself. Applying the ‘fixes’ to the respective math_functions.h resulted in a successful compilation, and all the tests ran successfully.

1 Like