Skip to content

Commit 4f3d50a

Browse files
build(linux): enable fedora 42 (#3780)
Co-authored-by: Johnny Arcitec <[email protected]>
1 parent 39916a7 commit 4f3d50a

File tree

4 files changed

+130
-38
lines changed

4 files changed

+130
-38
lines changed

docs/getting_started.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ See [Docker](../DOCKER_README.md) for more information.
3030

3131
CUDA is used for NVFBC capture.
3232

33-
@tip{See [CUDA GPUS](https://developer.nvidia.com/cuda-gpus) to cross-reference Compute Capability to your GPU.}
33+
@tip{See [CUDA GPUS](https://developer.nvidia.com/cuda-gpus) to cross-reference Compute Capability to your GPU.
34+
The table below applies to packages provided by LizardByte. If you use an official LizardByte package then you do not
35+
need to install CUDA.}
3436

3537
<table>
3638
<caption>CUDA Compatibility</caption>
@@ -55,7 +57,7 @@ CUDA is used for NVFBC capture.
5557
<tr>
5658
<td rowspan="1">12.0.0</td>
5759
<td rowspan="2">525.60.13</td>
58-
<td rowspan="4">50;52;60;61;62;70;72;75;80;86;87;89;90</td>
60+
<td rowspan="5">50;52;60;61;62;70;72;75;80;86;87;89;90</td>
5961
<td>sunshine-debian-bookworm-{arch}.deb</td>
6062
</tr>
6163
<tr>
@@ -68,7 +70,12 @@ CUDA is used for NVFBC capture.
6870
<td>sunshine_{arch}.flatpak</td>
6971
</tr>
7072
<tr>
71-
<td>Sunshine (copr)</td>
73+
<td>Sunshine (copr - Fedora 40/41)</td>
74+
</tr>
75+
<tr>
76+
<td rowspan="1">12.8.1</td>
77+
<td rowspan="1">570.124.06</td>
78+
<td>Sunshine (copr - Fedora 42)</td>
7279
</tr>
7380
</table>
7481

packaging/linux/fedora/Sunshine.spec

Lines changed: 42 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ Source0: tarball.tar.gz
1717

1818
# BuildRequires: boost-devel >= 1.86.0
1919
BuildRequires: cmake >= 3.25.0
20-
BuildRequires: gcc
21-
BuildRequires: gcc-c++
2220
BuildRequires: libayatana-appindicator3-devel
2321
BuildRequires: libcap-devel
2422
BuildRequires: libcurl-devel
@@ -54,11 +52,22 @@ BuildRequires: which
5452
BuildRequires: xorg-x11-server-Xvfb
5553

5654
# Conditional BuildRequires for cuda-gcc based on Fedora version
57-
%if 0%{?fedora} >= 40
58-
# this package conflicts with gcc on f39
59-
BuildRequires: cuda-gcc-c++
55+
%if 0%{?fedora} >= 40 && 0%{?fedora} <= 41
56+
BuildRequires: gcc13
57+
BuildRequires: gcc13-c++
58+
%global gcc_version 13
59+
%global cuda_version 12.6.3
60+
%global cuda_build 560.35.05
61+
%elif %{?fedora} >= 42
62+
BuildRequires: gcc14
63+
BuildRequires: gcc14-c++
64+
%global gcc_version 14
65+
%global cuda_version 12.8.1
66+
%global cuda_build 570.124.06
6067
%endif
6168

69+
%global cuda_dir %{_builddir}/cuda
70+
6271
Requires: libcap >= 2.22
6372
Requires: libcurl >= 7.0
6473
Requires: libdrm > 2.4.97
@@ -88,20 +97,14 @@ ls -a %{_builddir}/Sunshine
8897
%autopatch -p1
8998

9099
%build
100+
# exit on error
101+
set -e
102+
91103
# Detect the architecture and Fedora version
92104
architecture=$(uname -m)
93-
fedora_version=%{fedora}
94105

95106
cuda_supported_architectures=("x86_64" "aarch64")
96107

97-
# set cuda_version based on Fedora version
98-
case "$fedora_version" in
99-
*)
100-
cuda_version="12.6.3"
101-
cuda_build="560.35.05"
102-
;;
103-
esac
104-
105108
# prepare CMAKE args
106109
cmake_args=(
107110
"-B=%{_builddir}/Sunshine/build"
@@ -121,27 +124,23 @@ cmake_args=(
121124
"-DSUNSHINE_PUBLISHER_ISSUE_URL=https://app.lizardbyte.dev/support"
122125
)
123126

127+
export CC=gcc-%{gcc_version}
128+
export CXX=g++-%{gcc_version}
129+
124130
function install_cuda() {
125131
# check if we need to install cuda
126-
if [ -f "%{_builddir}/cuda/bin/nvcc" ]; then
132+
if [ -f "%{cuda_dir}/bin/nvcc" ]; then
127133
echo "cuda already installed"
128134
return
129135
fi
130136

131-
if [ "$fedora_version" -ge 40 ]; then
132-
# update environment variables for CUDA, necessary when using cuda-gcc-c++
133-
export NVCC_PREPEND_FLAGS='-ccbin /usr/bin/g++-13'
134-
export PATH=/usr/bin/cuda:"%{_builddir}/cuda/bin:${PATH}"
135-
export LD_LIBRARY_PATH="%{_builddir}/cuda/lib64:${LD_LIBRARY_PATH}"
136-
fi
137-
138137
local cuda_prefix="https://developer.download.nvidia.com/compute/cuda/"
139138
local cuda_suffix=""
140139
if [ "$architecture" == "aarch64" ]; then
141140
local cuda_suffix="_sbsa"
142141
fi
143142

144-
local url="${cuda_prefix}${cuda_version}/local_installers/cuda_${cuda_version}_${cuda_build}_linux${cuda_suffix}.run"
143+
local url="${cuda_prefix}%{cuda_version}/local_installers/cuda_%{cuda_version}_%{cuda_build}_linux${cuda_suffix}.run"
145144
echo "cuda url: ${url}"
146145
wget \
147146
"$url" \
@@ -157,23 +156,31 @@ function install_cuda() {
157156
--override \
158157
--silent \
159158
--toolkit \
160-
--toolkitpath="%{_builddir}/cuda"
159+
--toolkitpath="%{cuda_dir}"
161160
rm "%{_builddir}/cuda.run"
162-
}
163161

164-
# we need to clear these flags to avoid linkage errors with cuda-gcc-c++
165-
export CFLAGS=""
166-
export CXXFLAGS=""
167-
export FFLAGS=""
168-
export FCFLAGS=""
169-
export LDFLAGS=""
170-
export CC=gcc-13
171-
export CXX=g++-13
162+
# we need to patch math_functions.h on fedora 42
163+
# see https://forums.developer.nvidia.com/t/error-exception-specification-is-incompatible-for-cospi-sinpi-cospif-sinpif-with-glibc-2-41/323591/3
164+
if [ "%{?fedora}" -eq 42 ]; then
165+
echo "Original math_functions.h:"
166+
find "%{cuda_dir}" -name math_functions.h -exec cat {} \;
167+
168+
# Apply the patch
169+
patch -p2 \
170+
--backup \
171+
--directory="%{cuda_dir}" \
172+
--verbose \
173+
< "%{_builddir}/Sunshine/packaging/linux/fedora/patches/f42/${architecture}/01-math_functions.patch"
174+
fi
175+
}
172176

173-
if [ -n "$cuda_version" ] && [[ " ${cuda_supported_architectures[@]} " =~ " ${architecture} " ]]; then
177+
if [ -n "%{cuda_version}" ] && [[ " ${cuda_supported_architectures[@]} " =~ " ${architecture} " ]]; then
174178
install_cuda
175179
cmake_args+=("-DSUNSHINE_ENABLE_CUDA=ON")
176-
cmake_args+=("-DCMAKE_CUDA_COMPILER:PATH=%{_builddir}/cuda/bin/nvcc")
180+
cmake_args+=("-DCMAKE_CUDA_COMPILER:PATH=%{cuda_dir}/bin/nvcc")
181+
cmake_args+=("-DCMAKE_CUDA_HOST_COMPILER=gcc-%{gcc_version}")
182+
else
183+
cmake_args+=("-DSUNSHINE_ENABLE_CUDA=OFF")
177184
fi
178185

179186
# setup the version
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
diff '--color=auto' -ur a/cuda/targets/sbsa-linux/include/crt/math_functions.h b/cuda/targets/sbsa-linux/include/crt/math_functions.h
2+
--- a/cuda/targets/sbsa-linux/include/crt/math_functions.h 2024-08-23 00:25:39.000000000 +0200
3+
+++ b/cuda/targets/sbsa-linux/include/crt/math_functions.h 2025-02-17 01:19:44.270292640 +0100
4+
@@ -2553,7 +2553,7 @@
5+
*
6+
* \note_accuracy_double
7+
*/
8+
-extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ double sinpi(double x);
9+
+extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ double sinpi(double x) noexcept (true);
10+
/**
11+
* \ingroup CUDA_MATH_SINGLE
12+
* \brief Calculate the sine of the input argument
13+
@@ -2576,7 +2576,7 @@
14+
*
15+
* \note_accuracy_single
16+
*/
17+
-extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ float sinpif(float x);
18+
+extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ float sinpif(float x) noexcept (true);
19+
/**
20+
* \ingroup CUDA_MATH_DOUBLE
21+
* \brief Calculate the cosine of the input argument
22+
@@ -2598,7 +2598,7 @@
23+
*
24+
* \note_accuracy_double
25+
*/
26+
-extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ double cospi(double x);
27+
+extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ double cospi(double x) noexcept (true);
28+
/**
29+
* \ingroup CUDA_MATH_SINGLE
30+
* \brief Calculate the cosine of the input argument
31+
@@ -2620,7 +2620,7 @@
32+
*
33+
* \note_accuracy_single
34+
*/
35+
-extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ float cospif(float x);
36+
+extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ float cospif(float x) noexcept (true);
37+
/**
38+
* \ingroup CUDA_MATH_DOUBLE
39+
* \brief Calculate the sine and cosine of the first input argument
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
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
2+
--- a/cuda/targets/x86_64-linux/include/crt/math_functions.h 2024-08-23 00:25:39.000000000 +0200
3+
+++ b/cuda/targets/x86_64-linux/include/crt/math_functions.h 2025-02-17 01:19:44.270292640 +0100
4+
@@ -2553,7 +2553,7 @@
5+
*
6+
* \note_accuracy_double
7+
*/
8+
-extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ double sinpi(double x);
9+
+extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ double sinpi(double x) noexcept (true);
10+
/**
11+
* \ingroup CUDA_MATH_SINGLE
12+
* \brief Calculate the sine of the input argument
13+
@@ -2576,7 +2576,7 @@
14+
*
15+
* \note_accuracy_single
16+
*/
17+
-extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ float sinpif(float x);
18+
+extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ float sinpif(float x) noexcept (true);
19+
/**
20+
* \ingroup CUDA_MATH_DOUBLE
21+
* \brief Calculate the cosine of the input argument
22+
@@ -2598,7 +2598,7 @@
23+
*
24+
* \note_accuracy_double
25+
*/
26+
-extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ double cospi(double x);
27+
+extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ double cospi(double x) noexcept (true);
28+
/**
29+
* \ingroup CUDA_MATH_SINGLE
30+
* \brief Calculate the cosine of the input argument
31+
@@ -2620,7 +2620,7 @@
32+
*
33+
* \note_accuracy_single
34+
*/
35+
-extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ float cospif(float x);
36+
+extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ float cospif(float x) noexcept (true);
37+
/**
38+
* \ingroup CUDA_MATH_DOUBLE
39+
* \brief Calculate the sine and cosine of the first input argument

0 commit comments

Comments
 (0)