Install dependencies before configuring. The default preset uses Ninja and Clang/Clang++.
FFmpeg also uses GNU make and, on x86-64, NASM, and OpenSSL uses Perl and GNU make. These tools are not
downloaded by CMake.
The build patches its copy of FFmpeg with patch, which build-essential, base-devel and FreeBSD's base
system include; Fedora lists it below.
sudo apt update
sudo apt install build-essential git cmake ninja-build meson clang llvm nasm pkg-config python3 \
libx11-dev libxext-dev libxrandr-dev libxcursor-dev libxi-dev libxfixes-dev libxss-dev libxtst-dev \
libasound2-dev libpulse-dev libpipewire-0.3-dev
This includes the X11 and audio development libraries for the SDL3 source fallback. Without the audio
ones, SDL3 builds with no sound output and games run silent. If your release provides libsdl3-dev,
install it to use the distribution's SDL3 instead:
sudo apt install libsdl3-dev
If apt cannot find that package, skip it. ScarletNX builds the pinned SDL3 automatically.
Installing libsdl2-dev does not satisfy the SDL3 dependency.
For native Wayland support in the source fallback, also install:
sudo apt install libwayland-dev libxkbcommon-dev wayland-protocols libdecor-0-dev libegl-dev
Without libegl-dev SDL3 quietly leaves Wayland out and builds X11 only. The SDL_WAYLAND line of
its configure summary reads (Wanted: ON): ON when Wayland is in.
CMake needs version 3.28 or newer (CPMUtil, which fetches the third-party packages, needs it), and Clang must support
C23/C++23. Upgrade these tools if your
release ships older versions. Install your GPU's Vulkan driver separately. For Intel/AMD or lavapipe
on Debian/Ubuntu, the usual packages are libvulkan1 mesa-vulkan-drivers. NVIDIA users need a
Vulkan-capable NVIDIA driver.
sudo dnf install clang cmake ninja-build meson nasm make perl git pkgconf-pkg-config patch llvm python3 \
libX11-devel libXext-devel libXrandr-devel libXcursor-devel libXi-devel libXfixes-devel \
libXScrnSaver-devel libXtst-devel alsa-lib-devel pulseaudio-libs-devel pipewire-devel
These are the Debian/Ubuntu packages above under Fedora's names. Fedora 44 provides SDL3 3.4; install SDL3-devel to
use it instead of the source fallback:
sudo dnf install SDL3-devel
For native Wayland support in the source fallback, also install:
sudo dnf install wayland-devel libxkbcommon-devel wayland-protocols-devel libdecor-devel libglvnd-devel
libglvnd-devel holds the EGL headers. For Intel/AMD or lavapipe, the usual Vulkan packages are
vulkan-loader mesa-vulkan-drivers.
sudo pacman -Syu --needed base-devel git cmake ninja meson clang llvm nasm perl pkgconf python sdl3
FreeBSD provides Clang in the base system. Install the remaining tools, the SDL3 package, and libusb, which SDL's HIDAPI loads at run time to read controllers (an Xbox pad is only read that way):
sudo pkg install git cmake ninja meson gmake nasm perl5 pkgconf python3 sdl3 llvm libusb glslang
The build uses that sdl3 package by default (SNX_SYSTEM_SDL3, see SDL3 troubleshooting);
pass -DSNX_SYSTEM_SDL3=OFF for the pinned SDL3 source build instead.
git clone https://github.com/scarletnx/ScarletNX.git && cd ScarletNX &&
cmake --preset default -B build && cmake --build build
# -> build/{scarletnx,snx-shaderc}
On all platforms, CPMUtil first looks for a compatible SDL3 development package (3.4.18 or newer) through
SDL3Config.cmake. If none is found, it downloads and builds the pinned SDL3. The fallback is static, so no separate SDL3 runtime
installation is needed. It still needs your platform's window-system development libraries.
SNX_SYSTEM_SDL3=ON (the default on FreeBSD) takes the system's package from find_package from 3.4.12, Arch
POWER's, which has every SDL name the tree uses, and never downloads. FreeBSD's ports sdl3 (3.4.16) is older than
the pin, so without it CPMUtil's version check builds SDL3 from source. SNX_SYSTEM_SDL3=OFF keeps the pinned build
everywhere.
An old checkout showing Could not find a package configuration file provided by SDL3 needs either
the SDL3 development package or this updated fallback. Pull the latest checkout and configure again.
For SDL3 installed in a custom prefix, pass -DCMAKE_PREFIX_PATH=/path/to/prefix, or
-DSDL3_DIR=/path/to/prefix/lib/cmake/SDL3 (the directory containing SDL3Config.cmake).
To force the source build, pass -DSDL3_FORCE_BUNDLED=ON, CPMUtil's per-package option (-DCPM_DOWNLOAD_SDL3=ON,
CPM.cmake's from before it, is read as this). No bundled override is forced by ScarletNX. The source build is
recommended on Windows to match the MinGW toolchain and keep SDL3 statically linked.
If SDL3's configure reports missing X11/Wayland development libraries, install the packages above. Do not work around that by disabling both display backends for a windowed build.
No sound, and the log says audio: SDL could not start its audio: No available audio device: the
SDL3 fallback was configured without audio development libraries (its configure warns Unable to find
the alsa development library). Install the audio packages above and configure again.
SDL3 is mandatory for the NX runtime, including headless runs. Use -H at runtime to skip
SDL video initialization and run without a display server. The separate headless backend was removed.
For an old build directory, remove the cached backend selection with -USNX_BACKEND.
If a controller does not appear, check the game's input: joystick lines. A GUID with no gamepad mapping needs
an SDL mapping in gamecontrollerdb.txt, as described in Usage. If no joystick appears on Linux,
check whether /dev/input/event* is readable and whether udev marks its event node ID_INPUT_JOYSTICK=1.
The supplied dist/72-scarletnx-input.rules grants seat access to recognized joystick event nodes and to the
hidraw nodes of the console's controllers. Other HIDAPI controllers may need their vendor's own udev rule. On
FreeBSD the gamepad comes from HIDAPI over libusb or /dev/uhid*, never from /dev/input/event*: a pad xb360gp(4),
hgame(4) or webcamd claimed is invisible to SDL. See Usage for the access rules and the packages. If
the gamepad opens but sends no input, compare the log's controller name and GUID with its mapping and test its
event node with evtest.
After installing dependencies, rerun:
cmake --preset default -B build && cmake --build build
If that directory was configured with a different compiler or generator, use a new build directory
(for example -B build/clang) rather than mixing the old cache with the new toolchain.
Made from docs/dev/build.md at 69237645142c. GPL-3.0-or-later.