Desktop
On a desktop the framework's job is the smallest: raylib already runs there, and the game owns its frame loop the ordinary way. What differs between Windows, macOS, Linux and the BSDs is the build — the compiler, the C library, the windowing system, what goes in the archive — and that is what this page is about.
Running a release build#
A debug build reads its files from your project's resources/ by its absolute path,
so it finds them from wherever it is started. A release reads ./resources/, the folder
the archives CI makes put next to the executable — and . is the working directory,
which is wherever a file manager, a shortcut or a terminal happened to be. So before it opens
anything, a desktop release moves into the executable's folder, when that folder has a
resources/ in it, and says so: ASSETS: reading … next to the executable, in
…. It starts from anywhere.
CI holds it to that. Every
desktop job that starts a release starts it from a folder with no resources/ in it —
macOS and the BSDs through tools/shipped_check.sh, which runs on a laptop too — and the
run has to boot with every asset loaded. The two exceptions to that folder are OpenBSD and NetBSD,
started from their own folder for the reason below. The release is laid out as the archive ships
it, except in the musl job's first run, a software-rendered build of the game, which gets the
project's own resources/ folder next to it; its second run starts the archive's
binary.
Where
the executable's folder has no resources/, the release stays where it was
started and reads the working directory's, saying
ASSETS: no … next to the executable; reading the working directory's, … — which is
what lets a release you build yourself, inside the project's build/release/, run from the
project's folder: rmp build release leaves the executable in build/release/ and
resources/ where it is. tools/shipped_check.sh checks that case too,
before the other: it starts the release where it was built, from the project folder, and the run
has to boot with every asset loaded. OpenBSD and NetBSD are the exception: raylib cannot say where the executable is
on those two, so a release there reads resources/ from the working directory and logs
ASSETS: this system does not say where the executable is, so … is read from the working
directory, …. Started from its own folder, it finds them; CI starts it from there on those
two, and checks that the line is in the log.
Every release archive also carries LICENSES.txt, the notices of everything the
game is built from, unless [deploy] licenses = false says where the game shows its
credits instead.
Windows#
Windows is windows-x64 and windows-arm64. The archive is the
.exe, resources/ and the licence notices, and the player installs nothing:
a player double-clicking the game has no compiler installed, so raylib and the compiler's own C and
C++ runtimes are linked into the .exe. A release build is a windowed program — no
console opens behind the game — and a debug build keeps its console for the log.
How depends on the compiler, and the
build does it for both. MinGW links with -static, so libstdc++, libgcc and winpthread
are inside the .exe instead of in libstdc++-6.dll and
libgcc_s_seh-1.dll next to a compiler the player does not have. MSVC, and Clang
when it builds for Microsoft's ABI ([dev] compiler = "clang" on Windows, or
rmp build windows clang-cl), build with the static C runtime, /MT
(/MTd in a debug build), so no Visual C++ Redistributable is needed. The Universal C Runtime is part of Windows 10 and stays a DLL. No
/arch: option is set either: the x64 build stays on the SSE2 every x64 processor has,
where AVX2 would stop the game with an illegal instruction on a processor without it.
What
the .exe still asks the loader for is Windows itself, and CI holds it to that:
tools/binary_check.py windows reads the import table and the delay-load table of the
.exe each Windows job ships, and fails on any DLL that is not part of every Windows 10
— KERNEL32, USER32, GDI32, SHELL32,
WINMM and the Universal C Runtime are what a game imports, and OPENGL32
too with the win32 and rgfw backends. It needs only Python's standard
library, so it runs on your own build too:
python tools/binary_check.py windows build/release/my_game.exeThe icon is inside the .exe, because that is where Windows looks for it:
configure.py turns [icon] source into a multi-resolution
.ico and the build embeds it. Making the .ico needs Pillow; without it a
build of your own goes on without an icon rather than failing. CI's Windows jobs install a pinned
Pillow, and fail when [icon] source exists and the .exe they built does not
carry it.
The windowing backend#
[windows] backend chooses what raylib talks to. "glfw", the default,
is what raylib uses everywhere else and what the whole matrix is tested against.
"win32" is raylib's native Windows backend and "rgfw" a single-header
library; both drop GLFW and make a smaller .exe, and both are younger — gamepads,
several monitors, the clipboard and some keyboard cases are thinner there. Right for a simple game,
measured before it is kept:
[windows]
backend = "win32"Building on Windows#
rmp comes as rmp.ps1 for PowerShell and rmp.cmd for cmd.
The rmp the installer puts on your PATH is
a .cmd, which PowerShell runs as it is; running a rmp.ps1 yourself, such
as .\rmp.ps1 in a game's folder, needs PowerShell to be allowed to run a local
script, once (Set-ExecutionPolicy -Scope CurrentUser RemoteSigned). The launchers look for a Python
3.11 or newer by running each candidate once to ask its version, so the Microsoft Store's
python3 placeholder, which fails that question, is passed over instead of being handed
the command.
[dev] compiler picks the compiler for debug builds — yours, and the
software-rendered check CI runs — and never for a release CI ships. On Windows that can be "msvc" or "mingw" as well as
"clang" and "gcc"; "mingw" looks for
x86_64-w64-mingw32-gcc before a plain gcc, which is what makes it work
from MSYS2. [dev] linker = "mold" is refused on Windows, because mold writes Linux and
BSD executables only.
Saves, and compression#
Saves go to %APPDATA%\<name>\, which follows a player between machines on a
domain. With [save] portable = true they go to a saves\ folder next to the
.exe instead — what a zip on itch.io wants — and fall back to the user's folder, saying
so once, when that folder cannot be written.
[upx] can compress the .exe and leaves Windows out by default: an
unsigned executable packed by UPX is a shape Windows Defender associates with malware, and some
machines quarantine it. If your builds are signed, add the Windows targets to
[upx] enabled.
CI builds windows-x64 with the compiler CMake finds first on the Windows runner, its
MinGW GCC, and prints which one in the log, because the runner image decides it.
windows-arm64 is cross-compiled with MSVC on an x86-64 machine. That machine cannot
run the ARM64 resource packer, so the archive ships resources/ as loose files with a
PACK_SKIPPED.txt that says why; the game reads loose files when there is no pack.
macOS#
One target, macos, and one binary with both architectures in it: Apple silicon and
Intel. The archive is that binary, resources/ with the asset pack, and the licence
notices. It draws with OpenGL 3.3, which raylib's build fixes on macOS.
It opens on
macOS 10.15 on an Intel Mac and macOS 11 on Apple silicon, the
first macOS that ran there. The build sets that floor, CMAKE_OSX_DEPLOYMENT_TARGET in
CMakeLists.txt, because left unset the toolchain writes its SDK's own version into the
binary, and every Mac older than the one that built it refuses to open the game without saying why.
10.15 is where Apple's C++ library starts to have std::filesystem, which
rmp::save uses. CI reads the minimum macOS out of each slice
of the binary it ships and fails on one above the floor.
Saves go to ~/Library/Application Support/<name>/. [save]
portable means nothing on macOS and is ignored. [upx] refuses
macos by name, at its line, in either list — the binary is code-signed, and compressing
it would break the signature:
[upx]
enabled = ["linux", "macos"] raylib_multiplatform.toml:2: enabled = ["linux", "macos"]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
configure: error: [upx] enabled: 'macos' cannot be compressed — the binary is code-signed; compressing it breaks the signature.
Remove it; there is no setting that makes it work.Building on a Mac needs a Python 3.11 or newer: the python3 macOS ships is older,
and the launcher passes it by. The scripts under tools/ are written for the bash 3.2
macOS keeps, and rmp runs under zsh. [dev] linker = "mold" is refused, for
the same reason as on Windows. "auto" skips mold there and tries lld, which it keeps
only when the toolchain can link with it; otherwise the game links with Apple's own linker.
Linux#
Linux has the most targets, because "Linux" is several things to a binary: a C library, a windowing system, a processor.
| Target | For |
|---|---|
linux-x64-glibc, linux-arm64-glibc | Almost every desktop distribution, on x86-64 and on ARM64. |
linux-riscv64-glibc | RISC-V machines running a distribution with glibc 2.38 or newer. |
linux-x64-musl | Alpine, and the other distributions built on musl. |
linux-x64-glibc-drm, linux-arm64-glibc-drm | A machine with no desktop at all: a Raspberry Pi, a kiosk, an arcade cabinet, a bare console. |
The glibc floor#
A Linux executable records, for every function it takes from glibc, the glibc version that
function came from, and the loader refuses to start one that asks for more than the machine has. A
binary built on a new distribution and copied to an older one does not start, with an error that
names a version like GLIBC_2.39 — and nothing about the build warned.
[linux] glibc is the oldest glibc linux-x64-glibc and
linux-arm64-glibc may need, and the default is "2.28":
[linux] glibc | Starts on |
|---|---|
"2.17" | RHEL and CentOS 7, and everything newer. The oldest it can reach. |
"2.28" | RHEL 8, Debian 10, Ubuntu 18.10, and everything newer. |
"2.31" | Ubuntu 20.04, Debian 11, and Steam's "sniper" runtime. |
"" | The machine that built it, and whatever has its glibc or newer. |
The floor costs the game nothing: everything it asks of a newer glibc is maths or threading
functions that older ones also have. CI builds both through
tools/linux_build.sh, which compiles with zig cc against that version of
glibc, and then tools/glibc_check.sh reads the finished binary and fails the build if
any symbol asks for more. It reaches no other target, because the others are not built that way:
RISC-V, below, has a floor of its own that CI holds it to, and DRM is built against the glibc of
the machine that builds it, whose floor CI prints instead of gating it. rmp build release on your own machine uses your compiler and your glibc; run
bash tools/linux_build.sh build/release to build the way CI does.
Nothing has to be installed on the player's side either. GLFW opens the X11 and OpenGL libraries at run time, so the binary's only fixed dependencies are the C library, the maths library and the threading and dynamic-loading libraries every Linux has.
X11 and Wayland#
To build on a Linux desktop you need the X11 development libraries, which each family of distributions names its own way:
| Distribution | The X11 development libraries |
|---|---|
| Debian, Ubuntu | sudo apt install libx11-dev libxrandr-dev libxi-dev libxcursor-dev libxinerama-dev libgl1-mesa-dev |
| Fedora | sudo dnf install libX11-devel libXrandr-devel libXi-devel libXcursor-devel libXinerama-devel mesa-libGL-devel |
| Arch | sudo pacman -S --needed libx11 libxrandr libxi libxcursor libxinerama mesa |
| Alpine | doas apk add libx11-dev libxrandr-dev libxi-dev libxcursor-dev libxinerama-dev mesa-dev linux-headers |
With the compiler, CMake and Ninja, in one command each: Getting started.
On a console with no desktop, rmp builds for DRM/KMS instead, and needs none of
them: Linux from a console.
By default the binary talks to X11, and on a Wayland desktop it runs through XWayland — which
works, with one more hop, and is where fractional scaling and per-monitor DPI misbehave.
[linux] wayland = true builds GLFW with both of its backends and lets it choose when the
game starts: a Wayland session gets Wayland, an X11 session gets X11, and neither is a fallback for
the other. It needs libwayland-dev, wayland-protocols and
libxkbcommon-dev on the machine that builds.
[linux]
wayland = trueOne difference you will see on Wayland is Wayland's own design: a window has no position there.
GetWindowPosition() and SetWindowPosition() do not work, and GLFW says so
the first time something asks.
[linux] backend = "rgfw" swaps GLFW for RGFW, which is smaller and talks to X11
only — so asking for it together with Wayland is refused, rather than quietly building an X11
binary:
[linux]
backend = "rgfw"
wayland = true raylib_multiplatform.toml:2: backend = "rgfw"
^^^^^^^^^^^^^^^^
configure: error: [linux] backend = "rgfw" and wayland = true cannot both hold.
RGFW's Linux backend is X11-only — it reports itself as "DESKTOP (RGFW - X11)" — and the wayland switch only reaches GLFW.
Leaving it would build an X11 binary while the config said Wayland.
Pick one: backend = "glfw" to get native Wayland, or wayland = false.musl#
musl and glibc are two C libraries, not two versions of one: a glibc binary does not start on
Alpine, and a musl binary does not start on Debian. linux-x64-musl is therefore a
second binary, cross-compiled with zig, for Alpine, Void's musl edition and the other
musl distributions.
What
it needs is read out of the binary, because that is where it is written: CI checks that it names no
glibc symbol, and tools/binary_check.py elf --musl wants musl's loader as its
interpreter and musl's libc.so as the one library it names — or a static binary that
names neither and asks the system for nothing. Then it is started on Alpine, in an image of the
framework's own pinned by its digest, with the network off: a software-rendered build of the game
boots and draws there, and so does the binary the archive ships, under a virtual X server with
Mesa's software OpenGL, the libraries an Alpine desktop has.
The packer it would need to make resources.rres comes out musl-linked too, and
cannot run on the machine that builds it, so the archive ships resources/ as loose
files, with a PACK_SKIPPED.txt saying so.
RISC-V#
linux-riscv64-glibc
is cross-compiled for RISC-V on an x86-64 machine, with the build image's RISC-V GNU toolchain,
against Ubuntu 24.04's RISC-V glibc, rather than with zig. [linux] glibc
does not reach it. It needs glibc 2.38 or newer — Ubuntu 24.04, Debian 13 and
Fedora 39 have it; Debian 12 and Ubuntu 22.04 do not — and the .toml's note on
[linux] glibc says so. CI holds it to that number: its job, in the full lane, runs
tools/glibc_check.sh with 2.38 and fails if the binary asks for more. It
ships loose resources for the same reason musl does.
Where
a RISC-V board is there — RISE's or Cloud-V's, as [ci] riscv64 says
(RISC-V on RISC-V) — the game is built and started on it.
Where none is, or it fails, CI starts it under emulation: QEMU runs the RISC-V binary on the x86-64
build image, with the image's RISC-V libraries — glibc, the X libraries GLFW opens, Mesa — under a
virtual X server, drawing with Mesa's software OpenGL. Either way the archive is unzipped and the
game started from another folder, and held to the same markers and exit status as every other
Linux start. The emulator proves the code, the C library and the libraries it opens work on RISC-V;
the board proves it on a RISC-V machine's own caches, timing and kernel.
DRM/KMS: no desktop at all#
The DRM targets draw straight to the screen through the kernel's display interface, with no X11, no Wayland and no window: the game is the whole screen, started from a bare console. raylib's DRM backend draws with OpenGL ES 2.0 through EGL and GBM.
The binary links libdrm, GBM and EGL directly, rather than opening them at run time the way GLFW
opens X11. Two things follow. It is built with the native compiler, against the distribution's own
copies of those libraries, so [linux] glibc does not apply to it: its floor is the
build machine's glibc, and CI prints that floor on every run. And a musl edition of it would be a
separate binary, which is why the name spells out glibc.
Building one needs the libdrm, GBM, EGL and OpenGL ES development files on the machine that
builds, and running it needs a /dev/dri device to draw on and the
/dev/input devices to read. On a Linux console with no desktop, rmp
builds this way by itself, into build/debug-drm and build/release-drm,
and checks the devices before it starts the game:
Linux from a console has all of it. Anywhere
else, the release-drm preset builds the release by hand:
cmake --preset release-drm
cmake --build --preset release-drmCI builds
the shipped one from the release preset with -DRMP_TARGET_DRM=ON, which
is the same build in build/release.
On DRM, [window] fps also chooses the display mode — 144 asks for a 144 Hz mode —
which is why the framework applies it before the window opens. Both DRM targets are in the
all group; to leave them out, disabled = ["drm"].
Linux saves and compression#
Saves go to $XDG_DATA_HOME/<name>/ when that variable is set to an absolute
path, and to ~/.local/share/<name>/ otherwise. [save] portable =
true puts them in saves/ next to the executable.
[upx] compresses linux-x64-glibc, linux-arm64-glibc,
linux-x64-musl and linux-x64-glibc-drm
by default — the ones whose packed archive CI starts, so a packed binary that would not launch is
caught: on every push for linux-x64-glibc, and in the full lane for the other three,
on a runner of its own architecture, on Alpine and on a virtual DRM display.
linux-riscv64-glibc is compressed only when you name it: UPX 5.2.0's RISC-V stub dies on
every kernel before 6.3, which most RISC-V boards run (Compressing with UPX says
why).
linux-arm64-glibc-drm can be added to [upx] enabled; it is left out by
default because nothing in CI runs it at all.
The BSDs#
FreeBSD on x86-64 and ARM64, OpenBSD on x86-64 and ARM64, and NetBSD on x86-64. raylib treats
them as desktops like any other — the same GLFW backend, X11, OpenGL 3.3 and
PLATFORM_DESKTOP — so a game that needs to tell one apart tests the compiler's
__FreeBSD__, __OpenBSD__ or __NetBSD__.
CI builds each one inside a virtual machine running that system, as a release, checks the result is an executable, packs the resources and boots a software-rendered build of the game inside the machine. The build tools are installed from each system's own package mirrors, which publish no dated snapshots, so their versions are not pinned and move with the mirror. A BSD job that fails for no reason you can find in your own change is the first thing to suspect there.
Saves go to ~/.local/share/<name>/, as on Linux. On OpenBSD and NetBSD
raylib cannot say where the executable is, so [save] portable = true has no folder to
use there and says SAVE: [save] portable: this system does not say where the executable is;
saving in the user's folder instead, and a release reads resources/ from the
folder it was started in (above). NetBSD builds without link-time optimisation, which its
linker cannot read from a static library, and with a compiler that reports C++20 by an older
number — Clay carries a one-line patch for it. [upx] leaves the BSDs out by default:
UPX publishes no build for them.
The VM images ship no Python, so CI generates the configuration on Linux first and the VM builds from the generated files; CMake warns when it has no Python to regenerate them. Building on a BSD machine yourself, install Python 3.11 or newer and the build behaves as on any other desktop.