build(linux): compile with gcc13+ and bump cuda (#4136)

This commit is contained in:
ReenigneArcher 2025-08-07 20:13:25 -04:00 committed by GitHub
commit a28c20df18
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 117 additions and 80 deletions

View file

@ -56,6 +56,7 @@ jobs:
uses: LizardByte/.github/.github/workflows/__call-docker.yml@master uses: LizardByte/.github/.github/workflows/__call-docker.yml@master
with: with:
maximize_build_space: true maximize_build_space: true
maximize_build_space_root_reserve_size: 32768
publish_release: ${{ needs.release-setup.outputs.publish_release }} publish_release: ${{ needs.release-setup.outputs.publish_release }}
release_commit: ${{ needs.release-setup.outputs.release_commit }} release_commit: ${{ needs.release-setup.outputs.release_commit }}
release_tag: ${{ needs.release-setup.outputs.release_tag }} release_tag: ${{ needs.release-setup.outputs.release_tag }}

View file

@ -3,8 +3,8 @@
# platforms: linux/amd64 # platforms: linux/amd64
# platforms_pr: linux/amd64 # platforms_pr: linux/amd64
# no-cache-filters: toolchain-base,toolchain # no-cache-filters: toolchain-base,toolchain
ARG BASE=ubuntu ARG BASE=debian
ARG TAG=22.04 ARG TAG=trixie-slim
FROM ${BASE}:${TAG} AS toolchain-base FROM ${BASE}:${TAG} AS toolchain-base
ENV DEBIAN_FRONTEND=noninteractive ENV DEBIAN_FRONTEND=noninteractive
@ -25,11 +25,11 @@ set -e
apt-get update -y apt-get update -y
apt-get install -y --no-install-recommends \ apt-get install -y --no-install-recommends \
build-essential \ build-essential \
cmake=3.22.* \ cmake=3.31.* \
ca-certificates \ ca-certificates \
doxygen \ doxygen \
gcc=4:11.2.* \ gcc=4:14.2.* \
g++=4:11.2.* \ g++=4:14.2.* \
gdb \ gdb \
git \ git \
graphviz \ graphviz \
@ -59,20 +59,13 @@ apt-get install -y --no-install-recommends \
xvfb xvfb
apt-get clean apt-get clean
rm -rf /var/lib/apt/lists/* rm -rf /var/lib/apt/lists/*
# Install Node
wget --max-redirect=0 -qO- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash
source "$HOME/.nvm/nvm.sh"
nvm install node
nvm use node
nvm alias default node
_DEPS _DEPS
# install cuda # install cuda
WORKDIR /build/cuda WORKDIR /build/cuda
# versions: https://developer.nvidia.com/cuda-toolkit-archive # versions: https://developer.nvidia.com/cuda-toolkit-archive
ENV CUDA_VERSION="11.8.0" ENV CUDA_VERSION="12.9.1"
ENV CUDA_BUILD="520.61.05" ENV CUDA_BUILD="575.57.08"
RUN <<_INSTALL_CUDA RUN <<_INSTALL_CUDA
#!/bin/bash #!/bin/bash
set -e set -e
@ -83,18 +76,31 @@ if [[ "${TARGETPLATFORM}" == 'linux/arm64' ]]; then
fi fi
url="${cuda_prefix}${CUDA_VERSION}/local_installers/cuda_${CUDA_VERSION}_${CUDA_BUILD}_linux${cuda_suffix}.run" url="${cuda_prefix}${CUDA_VERSION}/local_installers/cuda_${CUDA_VERSION}_${CUDA_BUILD}_linux${cuda_suffix}.run"
echo "cuda url: ${url}" echo "cuda url: ${url}"
wget "$url" --progress=bar:force:noscroll -q --show-progress -O ./cuda.run tmpfile="/tmp/cuda.run"
chmod a+x ./cuda.run wget "$url" --progress=bar:force:noscroll --show-progress -O "$tmpfile"
./cuda.run --silent --toolkit --toolkitpath=/usr/local --no-opengl-libs --no-man-page --no-drm chmod a+x "${tmpfile}"
rm ./cuda.run "${tmpfile}" --silent --toolkit --toolkitpath=/usr/local --no-opengl-libs --no-man-page --no-drm
rm -f "${tmpfile}"
_INSTALL_CUDA _INSTALL_CUDA
WORKDIR / WORKDIR /
# Write a shell script that starts Xvfb and then runs a shell # install node
RUN <<_INSTALL_NODE
#!/bin/bash
set -e
wget --max-redirect=0 -qO- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash
source "$HOME/.nvm/nvm.sh"
nvm install node
nvm use node
nvm alias default node
_INSTALL_NODE
WORKDIR /toolchain
# Create a shell script that starts Xvfb and then runs a shell
RUN <<_ENTRYPOINT RUN <<_ENTRYPOINT
#!/bin/bash #!/bin/bash
set -e set -e
cat <<EOF > /entrypoint.sh cat <<EOF > entrypoint.sh
#!/bin/bash #!/bin/bash
Xvfb ${DISPLAY} -screen 0 1024x768x24 & Xvfb ${DISPLAY} -screen 0 1024x768x24 &
if [ "\$#" -eq 0 ]; then if [ "\$#" -eq 0 ]; then
@ -105,11 +111,11 @@ fi
EOF EOF
# Make the script executable # Make the script executable
chmod +x /entrypoint.sh chmod +x entrypoint.sh
# Note about CLion # Note about CLion
echo "ATTENTION: CLion will override the entrypoint, you can disable this in the toolchain settings" echo "ATTENTION: CLion will override the entrypoint, you can disable this in the toolchain settings"
_ENTRYPOINT _ENTRYPOINT
# Use the shell script as the entrypoint # Use the shell script as the entrypoint
ENTRYPOINT ["/entrypoint.sh"] ENTRYPOINT ["/toolchain/entrypoint.sh"]

View file

@ -4,7 +4,7 @@
# platforms_pr: linux/amd64 # platforms_pr: linux/amd64
# no-cache-filters: sunshine-base,artifacts,sunshine # no-cache-filters: sunshine-base,artifacts,sunshine
ARG BASE=debian ARG BASE=debian
ARG TAG=bookworm ARG TAG=trixie
FROM ${BASE}:${TAG} AS sunshine-base FROM ${BASE}:${TAG} AS sunshine-base
ENV DEBIAN_FRONTEND=noninteractive ENV DEBIAN_FRONTEND=noninteractive
@ -32,6 +32,7 @@ RUN <<_BUILD
set -e set -e
chmod +x ./scripts/linux_build.sh chmod +x ./scripts/linux_build.sh
./scripts/linux_build.sh \ ./scripts/linux_build.sh \
--cuda-patches \
--publisher-name='LizardByte' \ --publisher-name='LizardByte' \
--publisher-website='https://app.lizardbyte.dev' \ --publisher-website='https://app.lizardbyte.dev' \
--publisher-issue-url='https://app.lizardbyte.dev/support' \ --publisher-issue-url='https://app.lizardbyte.dev/support' \

View file

@ -35,7 +35,8 @@ chmod +x ./scripts/linux_build.sh
--publisher-name='LizardByte' \ --publisher-name='LizardByte' \
--publisher-website='https://app.lizardbyte.dev' \ --publisher-website='https://app.lizardbyte.dev' \
--publisher-issue-url='https://app.lizardbyte.dev/support' \ --publisher-issue-url='https://app.lizardbyte.dev/support' \
--sudo-off --sudo-off \
--ubuntu-test-repo
apt-get clean apt-get clean
rm -rf /var/lib/apt/lists/* rm -rf /var/lib/apt/lists/*
_BUILD _BUILD

View file

@ -3,6 +3,15 @@ Sunshine binaries are built using [CMake](https://cmake.org) and requires `cmake
## Building Locally ## Building Locally
### Compiler
It is recommended to use one of the following compilers:
| Compiler | Version |
|:------------|:--------|
| GCC | 13+ |
| Clang | 17+ |
| Apple Clang | 15+ |
### Dependencies ### Dependencies
#### Linux #### Linux
@ -16,7 +25,7 @@ Sunshine requires CUDA Toolkit for NVFBC capture. There are two caveats to CUDA:
1. The version installed depends on the version of GCC. 1. The version installed depends on the version of GCC.
2. The version of CUDA you use will determine compatibility with various GPU generations. 2. The version of CUDA you use will determine compatibility with various GPU generations.
At the time of writing, the recommended version to use is CUDA ~11.8. At the time of writing, the recommended version to use is CUDA ~12.9.
See [CUDA compatibility](https://docs.nvidia.com/deploy/cuda-compatibility/index.html) for more info. See [CUDA compatibility](https://docs.nvidia.com/deploy/cuda-compatibility/index.html) for more info.
@tip{To install older versions, select the appropriate run file based on your desired CUDA version and architecture @tip{To install older versions, select the appropriate run file based on your desired CUDA version and architecture

View file

@ -31,7 +31,7 @@ See [Docker](../DOCKER_README.md) for more information.
CUDA is used for NVFBC capture. CUDA is used for NVFBC capture.
@tip{See [CUDA GPUS](https://developer.nvidia.com/cuda-gpus) to cross-reference Compute Capability to your GPU. @tip{See [CUDA GPUS](https://developer.nvidia.com/cuda-gpus) to cross-reference Compute Capability to your GPU.
The table below applies to packages provided by LizardByte. If you use an official LizardByte package then you do not The table below applies to packages provided by LizardByte. If you use an official LizardByte package, then you do not
need to install CUDA.} need to install CUDA.}
<table> <table>
@ -43,9 +43,9 @@ need to install CUDA.}
<th>Package</th> <th>Package</th>
</tr> </tr>
<tr> <tr>
<td rowspan="3">11.8.0</td> <td rowspan="8">12.9.1</td>
<td rowspan="3">450.80.02</td> <td rowspan="8">575.57.08</td>
<td rowspan="3">35;50;52;60;61;62;70;72;75;80;86;87;89;90</td> <td rowspan="8">50;52;60;61;62;70;72;75;80;86;87;89;90</td>
<td>sunshine.AppImage</td> <td>sunshine.AppImage</td>
</tr> </tr>
<tr> <tr>
@ -55,27 +55,18 @@ need to install CUDA.}
<td>sunshine-ubuntu-24.04-{arch}.deb</td> <td>sunshine-ubuntu-24.04-{arch}.deb</td>
</tr> </tr>
<tr> <tr>
<td rowspan="1">12.0.0</td> <td>sunshine-debian-trixie-{arch}.deb</td>
<td rowspan="1">525.60.13</td>
<td rowspan="5">50;52;60;61;62;70;72;75;80;86;87;89;90</td>
<td>sunshine-debian-bookworm-{arch}.deb</td>
</tr> </tr>
<tr> <tr>
<td rowspan="2">12.6.2</td>
<td rowspan="2">560.35.03</td>
<td>sunshine_{arch}.flatpak</td> <td>sunshine_{arch}.flatpak</td>
</tr> </tr>
<tr> <tr>
<td>Sunshine (copr - Fedora 41)</td> <td>Sunshine (copr - Fedora 41)</td>
</tr> </tr>
<tr> <tr>
<td rowspan="1">12.8.1</td>
<td rowspan="1">570.124.06</td>
<td>Sunshine (copr - Fedora 42)</td> <td>Sunshine (copr - Fedora 42)</td>
</tr> </tr>
<tr> <tr>
<td rowspan="1">12.9.1</td>
<td rowspan="1">575.57.08</td>
<td>sunshine.pkg.tar.zst</td> <td>sunshine.pkg.tar.zst</td>
</tr> </tr>
</table> </table>
@ -89,13 +80,15 @@ According to AppImageLint the supported distro matrix of the AppImage is below.
- ✔ Debian bookworm - ✔ Debian bookworm
- ✔ Debian trixie - ✔ Debian trixie
- ✔ Debian sid - ✔ Debian sid
- ✔ Ubuntu plucky
- ✔ Ubuntu noble - ✔ Ubuntu noble
- ✔ Ubuntu jammy - ✔ Ubuntu jammy
- ✖ Ubuntu focal - ✖ Ubuntu focal
- ✖ Ubuntu bionic - ✖ Ubuntu bionic
- ✖ Ubuntu xenial - ✖ Ubuntu xenial
- ✖ Ubuntu trusty - ✖ Ubuntu trusty
- ✖ CentOS 7 - ✖ Rocky Linux 8
- ✖ Rocky Linux 9
##### Install ##### Install
1. Download [sunshine.AppImage](https://github.com/LizardByte/Sunshine/releases/latest/download/sunshine.AppImage) 1. Download [sunshine.AppImage](https://github.com/LizardByte/Sunshine/releases/latest/download/sunshine.AppImage)

View file

@ -56,18 +56,18 @@ BuildRequires: which
BuildRequires: xorg-x11-server-Xvfb BuildRequires: xorg-x11-server-Xvfb
# Conditional BuildRequires for cuda-gcc based on Fedora version # Conditional BuildRequires for cuda-gcc based on Fedora version
%if 0%{?fedora} >= 40 && 0%{?fedora} <= 41 %if 0%{?fedora} <= 41
BuildRequires: gcc13 BuildRequires: gcc13
BuildRequires: gcc13-c++ BuildRequires: gcc13-c++
%global gcc_version 13 %global gcc_version 13
%global cuda_version 12.6.3 %global cuda_version 12.9.1
%global cuda_build 560.35.05 %global cuda_build 575.57.08
%elif %{?fedora} >= 42 %elif %{?fedora} >= 42
BuildRequires: gcc14 BuildRequires: gcc14
BuildRequires: gcc14-c++ BuildRequires: gcc14-c++
%global gcc_version 14 %global gcc_version 14
%global cuda_version 12.8.1 %global cuda_version 12.9.1
%global cuda_build 570.124.06 %global cuda_build 575.57.08
%endif %endif
%global cuda_dir %{_builddir}/cuda %global cuda_dir %{_builddir}/cuda
@ -171,7 +171,7 @@ function install_cuda() {
--backup \ --backup \
--directory="%{cuda_dir}" \ --directory="%{cuda_dir}" \
--verbose \ --verbose \
< "%{_builddir}/Sunshine/packaging/linux/fedora/patches/f42/${architecture}/01-math_functions.patch" < "%{_builddir}/Sunshine/packaging/linux/patches/${architecture}/01-math_functions.patch"
fi fi
} }

View file

@ -19,8 +19,8 @@
"only-arches": [ "only-arches": [
"x86_64" "x86_64"
], ],
"url": "https://developer.download.nvidia.com/compute/cuda/12.6.2/local_installers/cuda_12.6.2_560.35.03_linux.run", "url": "https://developer.download.nvidia.com/compute/cuda/12.9.1/local_installers/cuda_12.9.1_575.57.08_linux.run",
"sha256": "3729a89cb58f7ca6a46719cff110d6292aec7577585a8d71340f0dbac54fb237", "sha256": "0f6d806ddd87230d2adbe8a6006a9d20144fdbda9de2d6acc677daa5d036417a",
"dest-filename": "cuda.run" "dest-filename": "cuda.run"
}, },
{ {
@ -28,8 +28,8 @@
"only-arches": [ "only-arches": [
"aarch64" "aarch64"
], ],
"url": "https://developer.download.nvidia.com/compute/cuda/12.6.2/local_installers/cuda_12.6.2_560.35.03_linux_sbsa.run", "url": "https://developer.download.nvidia.com/compute/cuda/12.9.1/local_installers/cuda_12.9.1_575.57.08_linux_sbsa.run",
"sha256": "2249408848b705c18b9eadfb5161b52e4e36fcc5753647329cce93db141e5466", "sha256": "64f47ab791a76b6889702425e0755385f5fa216c5a9f061875c7deed5f08cdb6",
"dest-filename": "cuda.run" "dest-filename": "cuda.run"
} }
] ]

View file

@ -3,6 +3,7 @@ set -e
# Default value for arguments # Default value for arguments
appimage_build=0 appimage_build=0
cuda_patches=0
num_processors=$(nproc) num_processors=$(nproc)
publisher_name="Third Party Publisher" publisher_name="Third Party Publisher"
publisher_website="" publisher_website=""
@ -28,6 +29,7 @@ Options:
-h, --help Display this help message. -h, --help Display this help message.
-s, --sudo-off Disable sudo command. -s, --sudo-off Disable sudo command.
--appimage-build Compile for AppImage, this will not create the AppImage, just the executable. --appimage-build Compile for AppImage, this will not create the AppImage, just the executable.
--cuda-patches Apply cuda patches.
--num-processors The number of processors to use for compilation. Default is the value of 'nproc'. --num-processors The number of processors to use for compilation. Default is the value of 'nproc'.
--publisher-name The name of the publisher (not developer) of the application. --publisher-name The name of the publisher (not developer) of the application.
--publisher-website The URL of the publisher's website. --publisher-website The URL of the publisher's website.
@ -55,6 +57,9 @@ while getopts ":hs-:" opt; do
appimage_build=1 appimage_build=1
skip_libva=1 skip_libva=1
;; ;;
cuda-patches)
cuda_patches=1
;;
num-processors=*) num-processors=*)
num_processors="${OPTARG#*=}" num_processors="${OPTARG#*=}"
;; ;;
@ -185,7 +190,15 @@ function add_debian_based_deps() {
fi fi
} }
function add_test_ppa() {
if [ "$ubuntu_test_repo" == 1 ]; then
$package_install_command "software-properties-common"
${sudo_cmd} add-apt-repository ppa:ubuntu-toolchain-r/test -y
fi
}
function add_debian_deps() { function add_debian_deps() {
add_test_ppa
add_debian_based_deps add_debian_based_deps
dependencies+=( dependencies+=(
"libayatana-appindicator3-dev" "libayatana-appindicator3-dev"
@ -193,11 +206,7 @@ function add_debian_deps() {
} }
function add_ubuntu_deps() { function add_ubuntu_deps() {
if [ "$ubuntu_test_repo" == 1 ]; then add_test_ppa
# allow newer gcc
${sudo_cmd} add-apt-repository ppa:ubuntu-toolchain-r/test -y
fi
add_debian_based_deps add_debian_based_deps
dependencies+=( dependencies+=(
"libappindicator3-dev" "libappindicator3-dev"
@ -298,6 +307,24 @@ function install_cuda() {
"${build_dir}/cuda.run" --silent --toolkit --toolkitpath="${build_dir}/cuda" --no-opengl-libs --no-man-page --no-drm "${build_dir}/cuda.run" --silent --toolkit --toolkitpath="${build_dir}/cuda" --no-opengl-libs --no-man-page --no-drm
rm "${build_dir}/cuda.run" rm "${build_dir}/cuda.run"
nvcc_path="${build_dir}/cuda/bin/nvcc" nvcc_path="${build_dir}/cuda/bin/nvcc"
# run cuda patches
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"
patch -p2 \
--backup \
--directory="${build_dir}/cuda" \
--verbose \
< "$patch"
done
else
echo "No patches found for architecture: $architecture"
fi
fi
} }
function check_version() { function check_version() {
@ -536,27 +563,26 @@ elif grep -q "Debian GNU/Linux 12 (bookworm)" /etc/os-release; then
version="12" version="12"
package_update_command="${sudo_cmd} apt-get update" package_update_command="${sudo_cmd} apt-get update"
package_install_command="${sudo_cmd} apt-get install -y" package_install_command="${sudo_cmd} apt-get install -y"
cuda_version="12.0.0" cuda_version="12.9.1"
cuda_build="525.60.13" cuda_build="575.57.08"
gcc_version="12"
nvm_node=0
elif grep -q "PLATFORM_ID=\"platform:f40\"" /etc/os-release; then
distro="fedora"
version="40"
package_update_command="${sudo_cmd} dnf update -y"
package_install_command="${sudo_cmd} dnf install -y"
cuda_version=12.6.3
cuda_build=560.35.05
gcc_version="13" gcc_version="13"
nvm_node=0 nvm_node=0
dev_tools_group="Development Tools" elif grep -q "Debian GNU/Linux 13 (trixie)" /etc/os-release; then
distro="debian"
version="13"
package_update_command="${sudo_cmd} apt-get update"
package_install_command="${sudo_cmd} apt-get install -y"
cuda_version="12.9.1"
cuda_build="575.57.08"
gcc_version="14"
nvm_node=0
elif grep -q "PLATFORM_ID=\"platform:f41\"" /etc/os-release; then elif grep -q "PLATFORM_ID=\"platform:f41\"" /etc/os-release; then
distro="fedora" distro="fedora"
version="41" version="41"
package_update_command="${sudo_cmd} dnf update -y" package_update_command="${sudo_cmd} dnf update -y"
package_install_command="${sudo_cmd} dnf install -y" package_install_command="${sudo_cmd} dnf install -y"
cuda_version=12.6.3 cuda_version="12.9.1"
cuda_build=560.35.05 cuda_build="575.57.08"
gcc_version="13" gcc_version="13"
nvm_node=0 nvm_node=0
dev_tools_group="development-tools" dev_tools_group="development-tools"
@ -565,8 +591,8 @@ elif grep -q "PLATFORM_ID=\"platform:f42\"" /etc/os-release; then
version="42" version="42"
package_update_command="${sudo_cmd} dnf update -y" package_update_command="${sudo_cmd} dnf update -y"
package_install_command="${sudo_cmd} dnf install -y" package_install_command="${sudo_cmd} dnf install -y"
cuda_version=12.8.1 cuda_version="12.9.1"
cuda_build=570.124.06 cuda_build="575.57.08"
gcc_version="14" gcc_version="14"
nvm_node=0 nvm_node=0
dev_tools_group="development-tools" dev_tools_group="development-tools"
@ -575,27 +601,27 @@ elif grep -q "Ubuntu 22.04" /etc/os-release; then
version="22.04" version="22.04"
package_update_command="${sudo_cmd} apt-get update" package_update_command="${sudo_cmd} apt-get update"
package_install_command="${sudo_cmd} apt-get install -y" package_install_command="${sudo_cmd} apt-get install -y"
cuda_version="11.8.0" cuda_version="12.9.1"
cuda_build="520.61.05" cuda_build="575.57.08"
gcc_version="11" gcc_version="13"
nvm_node=1 nvm_node=1
elif grep -q "Ubuntu 24.04" /etc/os-release; then elif grep -q "Ubuntu 24.04" /etc/os-release; then
distro="ubuntu" distro="ubuntu"
version="24.04" version="24.04"
package_update_command="${sudo_cmd} apt-get update" package_update_command="${sudo_cmd} apt-get update"
package_install_command="${sudo_cmd} apt-get install -y" package_install_command="${sudo_cmd} apt-get install -y"
cuda_version="11.8.0" cuda_version="12.9.1"
cuda_build="520.61.05" cuda_build="575.57.08"
gcc_version="11" gcc_version="14"
nvm_node=0 nvm_node=0
elif grep -q "Ubuntu 25.04" /etc/os-release; then elif grep -q "Ubuntu 25.04" /etc/os-release; then
distro="ubuntu" distro="ubuntu"
version="25.04" version="25.04"
package_update_command="${sudo_cmd} apt-get update" package_update_command="${sudo_cmd} apt-get update"
package_install_command="${sudo_cmd} apt-get install -y" package_install_command="${sudo_cmd} apt-get install -y"
cuda_version="11.8.0" cuda_version="12.9.1"
cuda_build="520.61.05" cuda_build="575.57.08"
gcc_version="11" gcc_version="14"
nvm_node=0 nvm_node=0
else else
echo "Unsupported Distro or Version" echo "Unsupported Distro or Version"