commit:     8914dbf1a4d1b4a4f687e114d25193596d3e3944
Author:     Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
AuthorDate: Tue Feb 11 22:15:18 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Feb 12 11:57:35 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8914dbf1

dev-util/nvidia-cuda-toolkit: 12.6.1-r1 adjust headers for glibc-2.41

Match the extern definitions in CUDA headers with the changes in glibc-2.41.

Signed-off-by: Paul Zander <negril.nx+gentoo <AT> gmail.com>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../files/nvidia-cuda-toolkit-glibc-2.41.patch     | 72 ++++++++++++++++++++++
 ...ebuild => nvidia-cuda-toolkit-12.6.1-r1.ebuild} |  7 ++-
 2 files changed, 78 insertions(+), 1 deletion(-)

diff --git 
a/dev-util/nvidia-cuda-toolkit/files/nvidia-cuda-toolkit-glibc-2.41.patch 
b/dev-util/nvidia-cuda-toolkit/files/nvidia-cuda-toolkit-glibc-2.41.patch
new file mode 100644
index 000000000000..c8d43014d30a
--- /dev/null
+++ b/dev-util/nvidia-cuda-toolkit/files/nvidia-cuda-toolkit-glibc-2.41.patch
@@ -0,0 +1,72 @@
+From cae8ab12c9f981f110bb2e1318d9c5306e3a2d81 Mon Sep 17 00:00:00 2001
+From: Paul Zander <[email protected]>
+Date: Sat, 8 Feb 2025 16:34:42 +0100
+Subject: [PATCH] Updates headers for glibc-2.41
+
+Match the extern definitions in cuda-crt headers with the changes in 
glibc-2.41.
+
+/usr/include/bits/mathcalls.h(79): error: exception specification is
+incompatible with that of previous function "cospi" (declared at line 2601
+of
+/opt/cuda-12.8.0/bin/../targets/x86_64-linux/include/crt/math_functions.h)
+
+   extern double cospi (double __x) noexcept (true); extern double __cospi 
(double __x) noexcept (true);
+
+See-Also: 
https://sourceware.org/git/?p=glibc.git;a=commit;h=0ae0af68d8fa3bf6cbe1e4f1de5929ff71de67b3
+Signed-off-by: Paul Zander <[email protected]>
+
+diff --git 
a/builds/cuda_nvcc/targets/x86_64-linux/include/crt/math_functions.h 
b/builds/cuda_nvcc/targets/x86_64-linux/include/crt/math_functions.h
+index d8201f9..a9b19d4 100644
+--- a/builds/cuda_nvcc/targets/x86_64-linux/include/crt/math_functions.h
++++ b/builds/cuda_nvcc/targets/x86_64-linux/include/crt/math_functions.h
+@@ -2553,7 +2553,11 @@ extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ 
float                  rcbrt
+  *
+  * \note_accuracy_double
+  */
++#if __GLIBC_USE (IEC_60559_FUNCS_EXT_C23)
++extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ double                 
sinpi(double x) noexcept (true);
++#else
+ extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ double                 
sinpi(double x);
++#endif
+ /**
+  * \ingroup CUDA_MATH_SINGLE
+  * \brief Calculate the sine of the input argument 
+@@ -2576,7 +2580,11 @@ extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ 
double                 sinpi
+  *
+  * \note_accuracy_single
+  */
++#if __GLIBC_USE (IEC_60559_FUNCS_EXT_C23)
++extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ float                  
sinpif(float x) noexcept (true);
++#else
+ extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ float                  
sinpif(float x);
++#endif
+ /**
+  * \ingroup CUDA_MATH_DOUBLE
+  * \brief Calculate the cosine of the input argument 
+@@ -2598,7 +2606,11 @@ extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ 
float                  sinpi
+  *
+  * \note_accuracy_double
+  */
++#if __GLIBC_USE (IEC_60559_FUNCS_EXT_C23)
++extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ double                 
cospi(double x) noexcept (true);
++#else
+ extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ double                 
cospi(double x);
++#endif
+ /**
+  * \ingroup CUDA_MATH_SINGLE
+  * \brief Calculate the cosine of the input argument 
+@@ -2620,7 +2632,11 @@ extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ 
double                 cospi
+  *
+  * \note_accuracy_single
+  */
++#if __GLIBC_USE (IEC_60559_FUNCS_EXT_C23)
++extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ float                  
cospif(float x) noexcept (true);
++#else
+ extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ float                  
cospif(float x);
++#endif
+ /**
+  * \ingroup CUDA_MATH_DOUBLE
+  * \brief  Calculate the sine and cosine of the first input argument 
+-- 
+2.48.1
+

diff --git a/dev-util/nvidia-cuda-toolkit/nvidia-cuda-toolkit-12.6.1.ebuild 
b/dev-util/nvidia-cuda-toolkit/nvidia-cuda-toolkit-12.6.1-r1.ebuild
similarity index 98%
rename from dev-util/nvidia-cuda-toolkit/nvidia-cuda-toolkit-12.6.1.ebuild
rename to dev-util/nvidia-cuda-toolkit/nvidia-cuda-toolkit-12.6.1-r1.ebuild
index 32ef330046ed..449229fd2631 100644
--- a/dev-util/nvidia-cuda-toolkit/nvidia-cuda-toolkit-12.6.1.ebuild
+++ b/dev-util/nvidia-cuda-toolkit/nvidia-cuda-toolkit-12.6.1-r1.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2024 Gentoo Authors
+# Copyright 1999-2025 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
@@ -59,6 +59,11 @@ src_prepare() {
                "${FILESDIR}"/cuda-config.in > "${T}"/cuda-config || die
 
        default
+
+       # we assume you can't downgrade glibc
+       if has_version ">=sys-libs/glibc-2.41"; then
+               eapply "${FILESDIR}/nvidia-cuda-toolkit-glibc-2.41.patch"
+       fi
 }
 
 src_install() {

Reply via email to