mirror of
https://github.com/LizardByte/Sunshine.git
synced 2025-08-10 00:52:16 +00:00
build(linux): compile with gcc13+ and bump cuda (#4136)
This commit is contained in:
1
.github/workflows/ci.yml
vendored
1
.github/workflows/ci.yml
vendored
@@ -56,6 +56,7 @@ jobs:
|
||||
uses: LizardByte/.github/.github/workflows/__call-docker.yml@master
|
||||
with:
|
||||
maximize_build_space: true
|
||||
maximize_build_space_root_reserve_size: 32768
|
||||
publish_release: ${{ needs.release-setup.outputs.publish_release }}
|
||||
release_commit: ${{ needs.release-setup.outputs.release_commit }}
|
||||
release_tag: ${{ needs.release-setup.outputs.release_tag }}
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
# platforms: linux/amd64
|
||||
# platforms_pr: linux/amd64
|
||||
# no-cache-filters: toolchain-base,toolchain
|
||||
ARG BASE=ubuntu
|
||||
ARG TAG=22.04
|
||||
ARG BASE=debian
|
||||
ARG TAG=trixie-slim
|
||||
FROM ${BASE}:${TAG} AS toolchain-base
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
@@ -25,11 +25,11 @@ set -e
|
||||
apt-get update -y
|
||||
apt-get install -y --no-install-recommends \
|
||||
build-essential \
|
||||
cmake=3.22.* \
|
||||
cmake=3.31.* \
|
||||
ca-certificates \
|
||||
doxygen \
|
||||
gcc=4:11.2.* \
|
||||
g++=4:11.2.* \
|
||||
gcc=4:14.2.* \
|
||||
g++=4:14.2.* \
|
||||
gdb \
|
||||
git \
|
||||
graphviz \
|
||||
@@ -59,20 +59,13 @@ apt-get install -y --no-install-recommends \
|
||||
xvfb
|
||||
apt-get clean
|
||||
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
|
||||
|
||||
# install cuda
|
||||
WORKDIR /build/cuda
|
||||
# versions: https://developer.nvidia.com/cuda-toolkit-archive
|
||||
ENV CUDA_VERSION="11.8.0"
|
||||
ENV CUDA_BUILD="520.61.05"
|
||||
ENV CUDA_VERSION="12.9.1"
|
||||
ENV CUDA_BUILD="575.57.08"
|
||||
RUN <<_INSTALL_CUDA
|
||||
#!/bin/bash
|
||||
set -e
|
||||
@@ -83,18 +76,31 @@ if [[ "${TARGETPLATFORM}" == 'linux/arm64' ]]; then
|
||||
fi
|
||||
url="${cuda_prefix}${CUDA_VERSION}/local_installers/cuda_${CUDA_VERSION}_${CUDA_BUILD}_linux${cuda_suffix}.run"
|
||||
echo "cuda url: ${url}"
|
||||
wget "$url" --progress=bar:force:noscroll -q --show-progress -O ./cuda.run
|
||||
chmod a+x ./cuda.run
|
||||
./cuda.run --silent --toolkit --toolkitpath=/usr/local --no-opengl-libs --no-man-page --no-drm
|
||||
rm ./cuda.run
|
||||
tmpfile="/tmp/cuda.run"
|
||||
wget "$url" --progress=bar:force:noscroll --show-progress -O "$tmpfile"
|
||||
chmod a+x "${tmpfile}"
|
||||
"${tmpfile}" --silent --toolkit --toolkitpath=/usr/local --no-opengl-libs --no-man-page --no-drm
|
||||
rm -f "${tmpfile}"
|
||||
_INSTALL_CUDA
|
||||
|
||||
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
|
||||
#!/bin/bash
|
||||
set -e
|
||||
cat <<EOF > /entrypoint.sh
|
||||
cat <<EOF > entrypoint.sh
|
||||
#!/bin/bash
|
||||
Xvfb ${DISPLAY} -screen 0 1024x768x24 &
|
||||
if [ "\$#" -eq 0 ]; then
|
||||
@@ -105,11 +111,11 @@ fi
|
||||
EOF
|
||||
|
||||
# Make the script executable
|
||||
chmod +x /entrypoint.sh
|
||||
chmod +x entrypoint.sh
|
||||
|
||||
# Note about CLion
|
||||
echo "ATTENTION: CLion will override the entrypoint, you can disable this in the toolchain settings"
|
||||
_ENTRYPOINT
|
||||
|
||||
# Use the shell script as the entrypoint
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
ENTRYPOINT ["/toolchain/entrypoint.sh"]
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
# platforms_pr: linux/amd64
|
||||
# no-cache-filters: sunshine-base,artifacts,sunshine
|
||||
ARG BASE=debian
|
||||
ARG TAG=bookworm
|
||||
ARG TAG=trixie
|
||||
FROM ${BASE}:${TAG} AS sunshine-base
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
@@ -32,6 +32,7 @@ RUN <<_BUILD
|
||||
set -e
|
||||
chmod +x ./scripts/linux_build.sh
|
||||
./scripts/linux_build.sh \
|
||||
--cuda-patches \
|
||||
--publisher-name='LizardByte' \
|
||||
--publisher-website='https://app.lizardbyte.dev' \
|
||||
--publisher-issue-url='https://app.lizardbyte.dev/support' \
|
||||
@@ -35,7 +35,8 @@ chmod +x ./scripts/linux_build.sh
|
||||
--publisher-name='LizardByte' \
|
||||
--publisher-website='https://app.lizardbyte.dev' \
|
||||
--publisher-issue-url='https://app.lizardbyte.dev/support' \
|
||||
--sudo-off
|
||||
--sudo-off \
|
||||
--ubuntu-test-repo
|
||||
apt-get clean
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
_BUILD
|
||||
|
||||
@@ -3,6 +3,15 @@ Sunshine binaries are built using [CMake](https://cmake.org) and requires `cmake
|
||||
|
||||
## Building Locally
|
||||
|
||||
### Compiler
|
||||
It is recommended to use one of the following compilers:
|
||||
|
||||
| Compiler | Version |
|
||||
|:------------|:--------|
|
||||
| GCC | 13+ |
|
||||
| Clang | 17+ |
|
||||
| Apple Clang | 15+ |
|
||||
|
||||
### Dependencies
|
||||
|
||||
#### 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.
|
||||
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.
|
||||
|
||||
@tip{To install older versions, select the appropriate run file based on your desired CUDA version and architecture
|
||||
|
||||
@@ -31,7 +31,7 @@ See [Docker](../DOCKER_README.md) for more information.
|
||||
CUDA is used for NVFBC capture.
|
||||
|
||||
@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.}
|
||||
|
||||
<table>
|
||||
@@ -43,9 +43,9 @@ need to install CUDA.}
|
||||
<th>Package</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td rowspan="3">11.8.0</td>
|
||||
<td rowspan="3">450.80.02</td>
|
||||
<td rowspan="3">35;50;52;60;61;62;70;72;75;80;86;87;89;90</td>
|
||||
<td rowspan="8">12.9.1</td>
|
||||
<td rowspan="8">575.57.08</td>
|
||||
<td rowspan="8">50;52;60;61;62;70;72;75;80;86;87;89;90</td>
|
||||
<td>sunshine.AppImage</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -55,27 +55,18 @@ need to install CUDA.}
|
||||
<td>sunshine-ubuntu-24.04-{arch}.deb</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td rowspan="1">12.0.0</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>
|
||||
<td>sunshine-debian-trixie-{arch}.deb</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td rowspan="2">12.6.2</td>
|
||||
<td rowspan="2">560.35.03</td>
|
||||
<td>sunshine_{arch}.flatpak</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Sunshine (copr - Fedora 41)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td rowspan="1">12.8.1</td>
|
||||
<td rowspan="1">570.124.06</td>
|
||||
<td>Sunshine (copr - Fedora 42)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td rowspan="1">12.9.1</td>
|
||||
<td rowspan="1">575.57.08</td>
|
||||
<td>sunshine.pkg.tar.zst</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -89,13 +80,15 @@ According to AppImageLint the supported distro matrix of the AppImage is below.
|
||||
- ✔ Debian bookworm
|
||||
- ✔ Debian trixie
|
||||
- ✔ Debian sid
|
||||
- ✔ Ubuntu plucky
|
||||
- ✔ Ubuntu noble
|
||||
- ✔ Ubuntu jammy
|
||||
- ✖ Ubuntu focal
|
||||
- ✖ Ubuntu bionic
|
||||
- ✖ Ubuntu xenial
|
||||
- ✖ Ubuntu trusty
|
||||
- ✖ CentOS 7
|
||||
- ✖ Rocky Linux 8
|
||||
- ✖ Rocky Linux 9
|
||||
|
||||
##### Install
|
||||
1. Download [sunshine.AppImage](https://github.com/LizardByte/Sunshine/releases/latest/download/sunshine.AppImage)
|
||||
|
||||
@@ -56,18 +56,18 @@ BuildRequires: which
|
||||
BuildRequires: xorg-x11-server-Xvfb
|
||||
|
||||
# Conditional BuildRequires for cuda-gcc based on Fedora version
|
||||
%if 0%{?fedora} >= 40 && 0%{?fedora} <= 41
|
||||
%if 0%{?fedora} <= 41
|
||||
BuildRequires: gcc13
|
||||
BuildRequires: gcc13-c++
|
||||
%global gcc_version 13
|
||||
%global cuda_version 12.6.3
|
||||
%global cuda_build 560.35.05
|
||||
%global cuda_version 12.9.1
|
||||
%global cuda_build 575.57.08
|
||||
%elif %{?fedora} >= 42
|
||||
BuildRequires: gcc14
|
||||
BuildRequires: gcc14-c++
|
||||
%global gcc_version 14
|
||||
%global cuda_version 12.8.1
|
||||
%global cuda_build 570.124.06
|
||||
%global cuda_version 12.9.1
|
||||
%global cuda_build 575.57.08
|
||||
%endif
|
||||
|
||||
%global cuda_dir %{_builddir}/cuda
|
||||
@@ -171,7 +171,7 @@ function install_cuda() {
|
||||
--backup \
|
||||
--directory="%{cuda_dir}" \
|
||||
--verbose \
|
||||
< "%{_builddir}/Sunshine/packaging/linux/fedora/patches/f42/${architecture}/01-math_functions.patch"
|
||||
< "%{_builddir}/Sunshine/packaging/linux/patches/${architecture}/01-math_functions.patch"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
"only-arches": [
|
||||
"x86_64"
|
||||
],
|
||||
"url": "https://developer.download.nvidia.com/compute/cuda/12.6.2/local_installers/cuda_12.6.2_560.35.03_linux.run",
|
||||
"sha256": "3729a89cb58f7ca6a46719cff110d6292aec7577585a8d71340f0dbac54fb237",
|
||||
"url": "https://developer.download.nvidia.com/compute/cuda/12.9.1/local_installers/cuda_12.9.1_575.57.08_linux.run",
|
||||
"sha256": "0f6d806ddd87230d2adbe8a6006a9d20144fdbda9de2d6acc677daa5d036417a",
|
||||
"dest-filename": "cuda.run"
|
||||
},
|
||||
{
|
||||
@@ -28,8 +28,8 @@
|
||||
"only-arches": [
|
||||
"aarch64"
|
||||
],
|
||||
"url": "https://developer.download.nvidia.com/compute/cuda/12.6.2/local_installers/cuda_12.6.2_560.35.03_linux_sbsa.run",
|
||||
"sha256": "2249408848b705c18b9eadfb5161b52e4e36fcc5753647329cce93db141e5466",
|
||||
"url": "https://developer.download.nvidia.com/compute/cuda/12.9.1/local_installers/cuda_12.9.1_575.57.08_linux_sbsa.run",
|
||||
"sha256": "64f47ab791a76b6889702425e0755385f5fa216c5a9f061875c7deed5f08cdb6",
|
||||
"dest-filename": "cuda.run"
|
||||
}
|
||||
]
|
||||
|
||||
@@ -3,6 +3,7 @@ set -e
|
||||
|
||||
# Default value for arguments
|
||||
appimage_build=0
|
||||
cuda_patches=0
|
||||
num_processors=$(nproc)
|
||||
publisher_name="Third Party Publisher"
|
||||
publisher_website=""
|
||||
@@ -28,6 +29,7 @@ Options:
|
||||
-h, --help Display this help message.
|
||||
-s, --sudo-off Disable sudo command.
|
||||
--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'.
|
||||
--publisher-name The name of the publisher (not developer) of the application.
|
||||
--publisher-website The URL of the publisher's website.
|
||||
@@ -55,6 +57,9 @@ while getopts ":hs-:" opt; do
|
||||
appimage_build=1
|
||||
skip_libva=1
|
||||
;;
|
||||
cuda-patches)
|
||||
cuda_patches=1
|
||||
;;
|
||||
num-processors=*)
|
||||
num_processors="${OPTARG#*=}"
|
||||
;;
|
||||
@@ -185,7 +190,15 @@ function add_debian_based_deps() {
|
||||
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() {
|
||||
add_test_ppa
|
||||
add_debian_based_deps
|
||||
dependencies+=(
|
||||
"libayatana-appindicator3-dev"
|
||||
@@ -193,11 +206,7 @@ function add_debian_deps() {
|
||||
}
|
||||
|
||||
function add_ubuntu_deps() {
|
||||
if [ "$ubuntu_test_repo" == 1 ]; then
|
||||
# allow newer gcc
|
||||
${sudo_cmd} add-apt-repository ppa:ubuntu-toolchain-r/test -y
|
||||
fi
|
||||
|
||||
add_test_ppa
|
||||
add_debian_based_deps
|
||||
dependencies+=(
|
||||
"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
|
||||
rm "${build_dir}/cuda.run"
|
||||
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() {
|
||||
@@ -536,27 +563,26 @@ elif grep -q "Debian GNU/Linux 12 (bookworm)" /etc/os-release; then
|
||||
version="12"
|
||||
package_update_command="${sudo_cmd} apt-get update"
|
||||
package_install_command="${sudo_cmd} apt-get install -y"
|
||||
cuda_version="12.0.0"
|
||||
cuda_build="525.60.13"
|
||||
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
|
||||
cuda_version="12.9.1"
|
||||
cuda_build="575.57.08"
|
||||
gcc_version="13"
|
||||
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
|
||||
distro="fedora"
|
||||
version="41"
|
||||
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
|
||||
cuda_version="12.9.1"
|
||||
cuda_build="575.57.08"
|
||||
gcc_version="13"
|
||||
nvm_node=0
|
||||
dev_tools_group="development-tools"
|
||||
@@ -565,8 +591,8 @@ elif grep -q "PLATFORM_ID=\"platform:f42\"" /etc/os-release; then
|
||||
version="42"
|
||||
package_update_command="${sudo_cmd} dnf update -y"
|
||||
package_install_command="${sudo_cmd} dnf install -y"
|
||||
cuda_version=12.8.1
|
||||
cuda_build=570.124.06
|
||||
cuda_version="12.9.1"
|
||||
cuda_build="575.57.08"
|
||||
gcc_version="14"
|
||||
nvm_node=0
|
||||
dev_tools_group="development-tools"
|
||||
@@ -575,27 +601,27 @@ elif grep -q "Ubuntu 22.04" /etc/os-release; then
|
||||
version="22.04"
|
||||
package_update_command="${sudo_cmd} apt-get update"
|
||||
package_install_command="${sudo_cmd} apt-get install -y"
|
||||
cuda_version="11.8.0"
|
||||
cuda_build="520.61.05"
|
||||
gcc_version="11"
|
||||
cuda_version="12.9.1"
|
||||
cuda_build="575.57.08"
|
||||
gcc_version="13"
|
||||
nvm_node=1
|
||||
elif grep -q "Ubuntu 24.04" /etc/os-release; then
|
||||
distro="ubuntu"
|
||||
version="24.04"
|
||||
package_update_command="${sudo_cmd} apt-get update"
|
||||
package_install_command="${sudo_cmd} apt-get install -y"
|
||||
cuda_version="11.8.0"
|
||||
cuda_build="520.61.05"
|
||||
gcc_version="11"
|
||||
cuda_version="12.9.1"
|
||||
cuda_build="575.57.08"
|
||||
gcc_version="14"
|
||||
nvm_node=0
|
||||
elif grep -q "Ubuntu 25.04" /etc/os-release; then
|
||||
distro="ubuntu"
|
||||
version="25.04"
|
||||
package_update_command="${sudo_cmd} apt-get update"
|
||||
package_install_command="${sudo_cmd} apt-get install -y"
|
||||
cuda_version="11.8.0"
|
||||
cuda_build="520.61.05"
|
||||
gcc_version="11"
|
||||
cuda_version="12.9.1"
|
||||
cuda_build="575.57.08"
|
||||
gcc_version="14"
|
||||
nvm_node=0
|
||||
else
|
||||
echo "Unsupported Distro or Version"
|
||||
|
||||
Reference in New Issue
Block a user