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

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
}