mirror of
https://github.com/LizardByte/Sunshine.git
synced 2026-08-07 10:13:31 +00:00
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:
@@ -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));
|
||||
+43
-19
@@ -388,17 +388,35 @@ function install_cuda() {
|
||||
if [[ "$cuda_patches" == 1 ]]; then
|
||||
echo "Applying CUDA patches"
|
||||
local patch_dir="${script_dir}/../packaging/linux/patches/${architecture}"
|
||||
if [[ -d "$patch_dir" ]]; then
|
||||
for patch in "$patch_dir"/*.patch; do
|
||||
echo "Applying patch: $patch"
|
||||
local patch_file=""
|
||||
|
||||
# Select the patch based on the CUDA major version, not the distro version.
|
||||
# see https://forums.developer.nvidia.com/t/error-exception-specification-is-incompatible-for-cospi-sinpi-cospif-sinpif-with-glibc-2-41/323591/3
|
||||
local cuda_major="${cuda_version%%.*}"
|
||||
if [[ "${cuda_major}" -eq 12 ]]; then
|
||||
# CUDA 12.x: the extern declarations lack noexcept(true); add it to match glibc 2.41.
|
||||
patch_file="${patch_dir}/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="${patch_dir}/cuda-13-math_functions.patch"
|
||||
else
|
||||
echo "Warning: no math_functions.h patch available for CUDA ${cuda_major}.x, skipping."
|
||||
fi
|
||||
|
||||
if [[ -n "$patch_file" ]]; then
|
||||
if [[ -f "$patch_file" ]]; then
|
||||
echo "Applying patch: $patch_file"
|
||||
patch -p2 \
|
||||
--backup \
|
||||
--directory="${build_dir}/cuda" \
|
||||
--verbose \
|
||||
< "$patch"
|
||||
done
|
||||
< "$patch_file"
|
||||
else
|
||||
echo "Patch file not found: $patch_file"
|
||||
fi
|
||||
else
|
||||
echo "No patches found for architecture: $architecture"
|
||||
echo "No CUDA patch required for ${distro} ${version}"
|
||||
fi
|
||||
fi
|
||||
return 0
|
||||
@@ -452,7 +470,7 @@ function run_step_deps() {
|
||||
add_ubuntu_deps
|
||||
elif [[ "$distro" == "fedora" ]]; then
|
||||
add_fedora_deps
|
||||
${sudo_cmd} dnf group install "$dev_tools_group" -y
|
||||
${sudo_cmd} dnf group install "development-tools" -y
|
||||
fi
|
||||
|
||||
# Install the dependencies
|
||||
@@ -705,16 +723,6 @@ elif grep -q "Debian GNU/Linux 13 (trixie)" /etc/os-release; then
|
||||
cuda_build="575.57.08"
|
||||
gcc_version="14"
|
||||
nvm_node=0
|
||||
elif grep -q "PLATFORM_ID=\"platform:f41\"" /etc/os-release; then
|
||||
distro="fedora"
|
||||
version="41"
|
||||
package_update_command="${sudo_cmd} dnf update -y"
|
||||
package_install_command="${sudo_cmd} dnf install -y"
|
||||
cuda_version="12.9.1"
|
||||
cuda_build="575.57.08"
|
||||
gcc_version="13"
|
||||
nvm_node=0
|
||||
dev_tools_group="development-tools"
|
||||
elif grep -q "PLATFORM_ID=\"platform:f42\"" /etc/os-release; then
|
||||
distro="fedora"
|
||||
version="42"
|
||||
@@ -724,7 +732,6 @@ elif grep -q "PLATFORM_ID=\"platform:f42\"" /etc/os-release; then
|
||||
cuda_build="575.57.08"
|
||||
gcc_version="14"
|
||||
nvm_node=0
|
||||
dev_tools_group="development-tools"
|
||||
elif grep -q '^ID=fedora$' /etc/os-release && grep -q '^VERSION_ID=43$' /etc/os-release; then
|
||||
distro="fedora"
|
||||
version="43"
|
||||
@@ -734,7 +741,24 @@ elif grep -q '^ID=fedora$' /etc/os-release && grep -q '^VERSION_ID=43$' /etc/os-
|
||||
cuda_build="575.57.08"
|
||||
gcc_version="14"
|
||||
nvm_node=0
|
||||
dev_tools_group="development-tools"
|
||||
elif grep -q '^ID=fedora$' /etc/os-release && grep -q '^VERSION_ID=44$' /etc/os-release; then
|
||||
distro="fedora"
|
||||
version="44"
|
||||
package_update_command="${sudo_cmd} dnf update -y"
|
||||
package_install_command="${sudo_cmd} dnf install -y"
|
||||
cuda_version="12.9.1"
|
||||
cuda_build="575.57.08"
|
||||
gcc_version="14"
|
||||
nvm_node=0
|
||||
elif grep -q '^ID=fedora$' /etc/os-release && grep -q '^VERSION_ID=45$' /etc/os-release; then
|
||||
distro="fedora"
|
||||
version="45"
|
||||
package_update_command="${sudo_cmd} dnf update -y"
|
||||
package_install_command="${sudo_cmd} dnf install -y"
|
||||
cuda_version="13.1.1"
|
||||
cuda_build="590.48.01"
|
||||
gcc_version="15"
|
||||
nvm_node=0
|
||||
elif grep -q "Ubuntu 22.04" /etc/os-release; then
|
||||
distro="ubuntu"
|
||||
version="22.04"
|
||||
|
||||
Reference in New Issue
Block a user