Commit 01d46862 authored by Gaetan Lepage's avatar Gaetan Lepage
Browse files

cudaPackages.cuda_crt: do not patch math headers on >=13.2

parent ef56d563
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@
  lib,
  backendStdenv,
  buildRedist,
  cudaOlder,
  glibc,
}:
buildRedist {
@@ -11,10 +12,11 @@ buildRedist {
  outputs = [ "out" ];

  # Fix compatibility with glibc 2.42:
  # CUDA >= 13.0 fixed sinpi/cospi (using __NV_IEC_60559_FUNCS_EXCEPTION_SPECIFIER), but
  # - CUDA >= 13.0 fixed sinpi/cospi (using __NV_IEC_60559_FUNCS_EXCEPTION_SPECIFIER), but
  #   rsqrt/rsqrtf in math_functions.h still lack noexcept, conflicting with glibc 2.42's
  #   declarations.
  postInstall = lib.optionalString (lib.versionAtLeast glibc.version "2.42") ''
  # - CUDA >= 13.2 fixed rsqrt/rsqrtf as well (using _NV_RSQRT_SPECIFIER).
  postInstall = lib.optionalString (cudaOlder "13.2" && lib.versionAtLeast glibc.version "2.42") ''
    nixLog "Patching math_functions.h rsqrt signatures to match glibc's ones"
    substituteInPlace "''${!outputInclude:?}/include/crt/math_functions.h" \
      --replace-fail \