Building¶
Sunshine binaries are built using CMake and requires cmake > 3.25.
Building Locally¶
Compiler¶
It is recommended to use one of the following compilers:
Compiler |
Version |
|---|---|
GCC |
13+ |
Clang |
17+ |
Apple Clang |
15+ |
Dependencies¶
FreeBSD¶
[!CAUTION] Sunshine support for FreeBSD is experimental and may be incomplete or not work as expected
Install dependencies¶
pkg install -y \
audio/opus \
audio/pulseaudio \
devel/cmake \
devel/evdev-proto \
devel/git \
devel/libayatana-appindicator \
devel/libevdev \
devel/libnotify \
devel/ninja \
devel/pkgconf \
ftp/curl \
graphics/libdrm \
graphics/wayland \
multimedia/libva \
net/miniupnpc \
ports-mgmt/pkg \
security/openssl \
shells/bash \
www/npm \
x11/libX11 \
x11/libxcb \
x11/libXfixes \
x11/libXrandr \
x11/libXtst
Linux¶
Dependencies vary depending on the distribution. You can reference our linux_build.sh script for a list of dependencies we use in Debian-based, Fedora-based and Arch-based distributions. Please submit a PR if you would like to extend the script to support other distributions.
KMS Capture¶
If you are using KMS, patching the Sunshine binary with setcap is required. Some post-install scripts handle this. If building
from source and using the binary directly, this will also work:
sudo cp build/sunshine /tmp
sudo setcap cap_sys_admin+p /tmp/sunshine
sudo getcap /tmp/sunshine
sudo mv /tmp/sunshine build/sunshine
CUDA Toolkit¶
Sunshine requires CUDA Toolkit for NVFBC capture. There are two caveats to CUDA:
The version installed depends on the version of GCC.
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 ~12.9. See CUDA compatibility for more info.
[!NOTE] To install older versions, select the appropriate run file based on your desired CUDA version and architecture according to CUDA Toolkit Archive
macOS¶
You can either use Homebrew or MacPorts to install dependencies.
Homebrew¶
dependencies=(
"boost" # Optional
"cmake"
"doxygen" # Optional, for docs
"graphviz" # Optional, for docs
"icu4c" # Optional, if boost is not installed
"miniupnpc"
"ninja"
"node"
"openssl@3"
"opus"
"pkg-config"
)
brew install "${dependencies[@]}"
If there are issues with an SSL header that is not found:
@tabs{
@tab{ Intel | bash ln -s /usr/local/opt/openssl/include/openssl /usr/local/include/openssl }
@tab{ Apple Silicon | bash ln -s /opt/homebrew/opt/openssl/include/openssl /opt/homebrew/include/openssl
}
}
MacPorts¶
dependencies=(
"cmake"
"curl"
"doxygen" # Optional, for docs
"graphviz" # Optional, for docs
"libopus"
"miniupnpc"
"ninja"
"npm9"
"pkgconfig"
)
sudo port install "${dependencies[@]}"
Windows¶
[!WARNING] Cross-compilation is not supported on Windows. You must build on the target architecture.
First, you need to install MSYS2.
For AMD64 startup “MSYS2 UCRT64” (or for ARM64 startup “MSYS2 CLANGARM64”) then execute the following commands.
Update all packages¶
pacman -Syu
Set toolchain variable¶
For UCRT64:
export TOOLCHAIN="ucrt-x86_64"
For CLANGARM64:
export TOOLCHAIN="clang-aarch64"
Install dependencies¶
dependencies=(
"git"
"mingw-w64-${TOOLCHAIN}-boost" # Optional
"mingw-w64-${TOOLCHAIN}-cmake"
"mingw-w64-${TOOLCHAIN}-cppwinrt"
"mingw-w64-${TOOLCHAIN}-curl-winssl"
"mingw-w64-${TOOLCHAIN}-doxygen" # Optional, for docs... better to install official Doxygen
"mingw-w64-${TOOLCHAIN}-graphviz" # Optional, for docs
"mingw-w64-${TOOLCHAIN}-miniupnpc"
"mingw-w64-${TOOLCHAIN}-onevpl"
"mingw-w64-${TOOLCHAIN}-openssl"
"mingw-w64-${TOOLCHAIN}-opus"
"mingw-w64-${TOOLCHAIN}-toolchain"
)
if [[ "${MSYSTEM}" == "UCRT64" ]]; then
dependencies+=(
"mingw-w64-${TOOLCHAIN}-MinHook"
"mingw-w64-${TOOLCHAIN}-nodejs"
"mingw-w64-${TOOLCHAIN}-nsis"
)
fi
pacman -S "${dependencies[@]}"
WebRTC (optional, Windows only)¶
Sunshine can link against the libwebrtc C++ wrapper when SUNSHINE_ENABLE_WEBRTC=ON. The wrapper source is vendored as
the third-party/libwebrtc submodule, but you must build WebRTC separately and provide a staging directory that
contains include/ and lib/ (e.g., libwebrtc.dll and its import library). We use the third-party/depot_tools
submodule for gclient/gn.
Quickstart (recommended)¶
A helper script automates the full depot_tools / gclient / gn / ninja flow:
powershell -NoProfile -ExecutionPolicy Bypass -File scripts/build_mingw_webrtc.ps1
By default the script caches its working tree and output to %LOCALAPPDATA%\LuminalShine\deps\libwebrtc\{src,out},
which is shared across every sunshine build dir, worktree, and git checkout on the machine. This means:
Wiping
build/does not destroy libwebrtc — the next CMake configure picks it back up.Switching git branches does not require rebuilding libwebrtc unless the WebRTC branch (
m125_releaseetc.) actually changed.Multiple sunshine build dirs share one cached libwebrtc.
cmake/dependencies/webrtc.cmake looks at the same default location, so no -DWEBRTC_ROOT=... is needed after the
first build. To relocate the cache, set LUMINALSHINE_DEPS_DIR=<path> in your environment before invoking either the
script or CMake.
For finer control the script accepts overrides via -BuildDir/-OutDir parameters or the legacy
WEBRTC_BUILD_DIR / WEBRTC_OUT_DIR env vars (these still take precedence if set).
Manual build (advanced / first-time porting)¶
If you cannot use the helper script, the underlying steps are:
Create a checkout directory and add a
.gclientthat points tohttps://github.com/webrtc-sdk/webrtc.git@m137_releasewithtarget_os = ['win'].Run
gclient sync.In
src, add the libwebrtc sources (you can copy or linkthird-party/libwebrtcintosrc/libwebrtc).Apply the audio patch:
git apply libwebrtc/patchs/custom_audio_source_m137.patchUpdate
src/BUILD.gnto include//libwebrtcingroup("default").Generate and build (adjust
GYP_MSVS_OVERRIDE_PATHif Visual Studio is installed elsewhere; our local install is underD:\Software\Visual Studio):set PATH=D:\sources\sunshine\third-party\depot_tools;%PATH% set DEPOT_TOOLS_WIN_TOOLCHAIN=0 set GYP_MSVS_VERSION=2022 set GYP_GENERATORS=ninja,msvs-ninja set GYP_MSVS_OVERRIDE_PATH=D:\Software\Visual Studio set vs2022_install=D:\Software\Visual Studio set WINDOWSSDKDIR=D:\Software\WinSDK cd src gn gen out-debug/Windows-x64 --args="target_os=\"win\" target_cpu=\"x64\" is_component_build=false is_clang=true is_debug=true rtc_use_h264=true ffmpeg_branding=\"Chrome\" rtc_include_tests=false rtc_build_examples=false libwebrtc_desktop_capture=true" --ide=vs2022 ninja -C out-debug/Windows-x64 libwebrtc
Stage the artifacts into a directory with
include/andlib/subfolders. Either place them at the default shared cache location (%LOCALAPPDATA%\LuminalShine\deps\libwebrtc\out) so CMake finds them automatically, or point CMake at your staging directory with-DWEBRTC_ROOT=<path>. Copylibwebrtc.dllandlibwebrtc.dll.libintolib/.Configure Sunshine with
-DSUNSHINE_ENABLE_WEBRTC=ON. If CMake still fails to find libwebrtc, passWEBRTC_INCLUDE_DIRandWEBRTC_LIBRARYexplicitly.
To create a WiX installer, you also need to install .NET.
For ARM64: To build frontend, you also need to install Node.JS
Clone¶
Ensure git is installed on your system, then clone the repository using the following command:
git clone https://github.com/lizardbyte/sunshine.git --recurse-submodules
cd sunshine
mkdir build
Build¶
cmake -B build -G Ninja -S .
ninja -C build
[!TIP] Available build options can be found in options.cmake.
Package¶
@tabs{
@tab{FreeBSD | @tabs{
@tab{pkg | bash cpack -G FREEBSD --config ./build/CPackConfig.cmake }
}}
@tab{Linux | @tabs{
@tab{deb | bash cpack -G DEB --config ./build/CPackConfig.cmake }
@tab{rpm | bash cpack -G RPM --config ./build/CPackConfig.cmake }
}}
@tab{macOS | @tabs{
@tab{DragNDrop | bash cpack -G DragNDrop --config ./build/CPackConfig.cmake }
}}
@tab{Windows | @tabs{
@tab{Installer | bash ninja -C build luminalshine_msi # The MSI is hand-authored via the WiX 7 dotnet tool pinned in # .config/dotnet-tools.json. Run `dotnet tool restore` once after # cloning; the build invokes `dotnet wix build` directly. WiX 3's # candle/light and CMake's CPack-WIX generator are no longer used. }
@tab{Portable | bash cpack -G ZIP --config ./build/CPackConfig.cmake }
}}
}
Remote Build¶
It may be beneficial to build remotely in some cases. This will enable easier building on different operating systems.
Fork the project
Activate workflows
Trigger the CI workflow manually
Download the artifacts/binaries from the workflow run summary