build(fedora): fix rawhide build (#4821)

* build(fedora): fix rawhide build

* Patch math_functions by CUDA major; add CUDA-13

Switch math_functions.h patching from Fedora-version logic to CUDA-major selection in spec and build scripts. Add CUDA-13-specific patches for aarch64 and x86_64 and rename the existing patch to cuda-12. Update scripts/linux_build.sh to pick the correct cuda-{12,13}-math_functions.patch, handle missing files gracefully, and add Fedora 45 detection with CUDA 13 defaults.

* Install Fedora development-tools group directly

Replace use of the dev_tools_group variable with the explicit "development-tools" group name when running dnf group install. Also remove redundant dev_tools_group="development-tools" assignments from various Fedora/version and platform:f42 branches to simplify the distro detection logic and avoid relying on the variable.
This commit is contained in:
David Lane
2026-03-06 15:04:28 -05:00
committed by GitHub
parent 49abb1606a
commit bfdafa5fad
6 changed files with 173 additions and 26 deletions
+24 -7
View File
@@ -99,12 +99,18 @@ BuildRequires: gcc13-c++
%global gcc_version 13
%global cuda_version 12.9.1
%global cuda_build 575.57.08
%elif %{?fedora} >= 42
%elif 0%{?fedora} >= 42 && 0%{?fedora} <= 44
BuildRequires: gcc14
BuildRequires: gcc14-c++
%global gcc_version 14
%global cuda_version 12.9.1
%global cuda_build 575.57.08
%elif 0%{?fedora} >= 45
BuildRequires: gcc15
BuildRequires: gcc15-c++
%global gcc_version 15
%global cuda_version 13.1.1
%global cuda_build 590.48.01
%endif
%endif
@@ -239,18 +245,29 @@ function install_cuda() {
--toolkitpath="%{cuda_dir}"
rm "%{_builddir}/cuda.run"
# we need to patch math_functions.h on fedora 42+
# we need to patch math_functions.h depending on the CUDA major version
# see https://forums.developer.nvidia.com/t/error-exception-specification-is-incompatible-for-cospi-sinpi-cospif-sinpif-with-glibc-2-41/323591/3
if [ "%{?fedora}" -ge 42 ]; then
echo "Original math_functions.h:"
find "%{cuda_dir}" -name math_functions.h -exec cat {} \;
local cuda_major
cuda_major=$(echo "%{cuda_version}" | cut -d. -f1)
local patch_file=""
if [ "${cuda_major}" -eq 12 ]; then
# CUDA 12.x: the extern declarations lack noexcept(true); add it to match glibc 2.41.
patch_file="cuda-12-math_functions.patch"
elif [ "${cuda_major}" -eq 13 ]; then
# CUDA 13.x: the extern declarations already have noexcept(true), but the __func__()
# macro invocations at the bottom still lack it, causing a redeclaration conflict.
patch_file="cuda-13-math_functions.patch"
else
echo "Warning: no math_functions.h patch available for CUDA ${cuda_major}.x, skipping."
fi
# Apply the patch
if [ -n "${patch_file}" ]; then
echo "Applying CUDA patch: ${patch_file}"
patch -p2 \
--backup \
--directory="%{cuda_dir}" \
--verbose \
< "%{_builddir}/Sunshine/packaging/linux/patches/${architecture}/01-math_functions.patch"
< "%{_builddir}/Sunshine/packaging/linux/patches/${architecture}/${patch_file}"
fi
}
@@ -0,0 +1,53 @@
diff --color=auto -ur a/cuda/targets/sbsa-linux/include/crt/math_functions.h b/cuda/targets/sbsa-linux/include/crt/math_functions.h
--- a/cuda/targets/sbsa-linux/include/crt/math_functions.h
+++ b/cuda/targets/sbsa-linux/include/crt/math_functions.h
@@ -626,7 +626,7 @@
*
* \note_accuracy_double
*/
-extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ double rsqrt(double x);
+extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ double rsqrt(double x) noexcept (true);
/**
* \ingroup CUDA_MATH_SINGLE
@@ -650,7 +650,7 @@
*
* \note_accuracy_single
*/
-extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ float rsqrtf(float x);
+extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ float rsqrtf(float x) noexcept (true);
#if defined(__QNX__) && !defined(_LIBCPP_VERSION)
namespace std {
@@ -6043,18 +6043,18 @@
#endif /* _WIN32 */
-__func__(double rsqrt(double a));
+__func__(double rsqrt(double a) noexcept (true));
__func__(double rcbrt(double a));
#if ! __NV_GLIBC_PROVIDES_IEC_60559_FUNCS
-__func__(double sinpi(double a));
+__func__(double sinpi(double a) noexcept (true));
-__func__(double cospi(double a));
+__func__(double cospi(double a) noexcept (true));
-__func__(float sinpif(float a));
+__func__(float sinpif(float a) noexcept (true));
-__func__(float cospif(float a));
+__func__(float cospif(float a) noexcept (true));
#endif
__func__(void sincospi(double a, double *sptr, double *cptr));
@@ -6069,7 +6069,7 @@
__func__(double erfcx(double a));
-__func__(float rsqrtf(float a));
+__func__(float rsqrtf(float a) noexcept (true));
__func__(float rcbrtf(float a));
@@ -0,0 +1,53 @@
diff --color=auto -ur a/cuda/targets/x86_64-linux/include/crt/math_functions.h b/cuda/targets/x86_64-linux/include/crt/math_functions.h
--- a/cuda/targets/x86_64-linux/include/crt/math_functions.h
+++ b/cuda/targets/x86_64-linux/include/crt/math_functions.h
@@ -626,7 +626,7 @@
*
* \note_accuracy_double
*/
-extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ double rsqrt(double x);
+extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ double rsqrt(double x) noexcept (true);
/**
* \ingroup CUDA_MATH_SINGLE
@@ -650,7 +650,7 @@
*
* \note_accuracy_single
*/
-extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ float rsqrtf(float x);
+extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ float rsqrtf(float x) noexcept (true);
#if defined(__QNX__) && !defined(_LIBCPP_VERSION)
namespace std {
@@ -6043,18 +6043,18 @@
#endif /* _WIN32 */
-__func__(double rsqrt(double a));
+__func__(double rsqrt(double a) noexcept (true));
__func__(double rcbrt(double a));
#if ! __NV_GLIBC_PROVIDES_IEC_60559_FUNCS
-__func__(double sinpi(double a));
+__func__(double sinpi(double a) noexcept (true));
-__func__(double cospi(double a));
+__func__(double cospi(double a) noexcept (true));
-__func__(float sinpif(float a));
+__func__(float sinpif(float a) noexcept (true));
-__func__(float cospif(float a));
+__func__(float cospif(float a) noexcept (true));
#endif
__func__(void sincospi(double a, double *sptr, double *cptr));
@@ -6069,7 +6069,7 @@
__func__(double erfcx(double a));
-__func__(float rsqrtf(float a));
+__func__(float rsqrtf(float a) noexcept (true));
__func__(float rcbrtf(float a));