# Desktop and BSD archives

> What is in the zip CI makes for each Windows, macOS, Linux and BSD target, what each asks of a player's machine — no DLL, macOS 10.15, the Linux glibc floor — what it is hardened with, and what compressing with UPX costs.

Source: https://omardev29.github.io/rmp-docs/publishing/desktop.html

Every desktop and BSD target ships as a zip: the executable, its assets and the licence notice, nothing to install. CI makes one per target on a tag and attaches it to the release; every run that builds a target uploads the same zip as an artifact of the run.

## What an archive holds

Unpacked, an archive is a folder like this, with your `[project] name` as the executable's name:

```text
my_game              my_game.exe on Windows
LICENSES.txt         the notices of everything the game is built on
resources/
    resources.rres   every asset, in one encrypted pack
```

| Archive | Executable | Assets |
|---|---|---|
| `linux-x64-glibc-build.zip` | x86-64 ELF | the pack |
| `linux-arm64-glibc-build.zip` | aarch64 ELF | the pack |
| `linux-riscv64-glibc-build.zip` | RISC-V ELF | loose files |
| `linux-x64-musl-build.zip` | x86-64 ELF, linked against musl | loose files |
| `linux-x64-glibc-drm-build.zip` | x86-64 ELF, DRM/KMS | the pack |
| `linux-arm64-glibc-drm-build.zip` | aarch64 ELF, DRM/KMS | the pack |
| `windows-x64-build.zip` | x86-64 `.exe` | the pack |
| `windows-arm64-build.zip` | ARM64 `.exe` | loose files |
| `macos-build.zip` | universal Mach-O: arm64 and x86_64 in one file | the pack |
| `bsd-<os>-<arch>-build.zip` | FreeBSD, OpenBSD or NetBSD ELF | the pack |

### The pack, and when there is none

`resources.rres` is your `resources/` folder packed into one file and encrypted with `[resources] rres_password`. The password ends up inside the executable, so this keeps casual hands off your art and nothing more; `rmp new` gives every game a password of its own. The game reads the pack when there is one and the loose files when there is not, so both shapes run the same game. `rmp pack` makes the same pack locally, and `rmp unpack` deletes it.

Three archives carry the loose files instead, with a `PACK_SKIPPED.txt` in `resources/` that says why. The packer is built the way the game is, and for these three it comes out as a program the machine making the archive cannot run. `linux-riscv64-glibc` and `windows-arm64` are built for another processor than the one that builds them, so the packer is a program for that processor. `linux-x64-musl` is built for the same processor, but its packer is linked against musl, and the glibc build image that makes the archive has no musl to run it with.

A game written in plain C, without the framework's `src/rmp/` — the way out `examples/plain_c` shows — gets the loose files and a `PACK_SKIPPED.txt` in every archive: raw raylib cannot read the pack, and nothing of the framework's is there to read it for the game. `tools/ship_resources.sh` makes that choice for the packaging steps of `linux-x64-glibc`, `linux-arm64-glibc`, both DRM targets, macOS and the BSDs, and the `windows-x64` step makes the same one in PowerShell. The three archives above never call it: they always carry the loose files, and their note gives the reason of the paragraph above.

### It starts from any folder

A release build reads `./resources/`, and `.` is the folder the game was started from — a file manager, a shortcut and a launcher each start it somewhere else. So before it opens the pack or loads anything, a desktop release moves into the folder that holds the executable, when that folder has a `resources/` beside it, and says so in the log. It is a change of directory rather than a different path, so a plain raylib call with a relative path under `resources/` finds its file too. The iOS app does the same with its bundle. A release with no `resources/` next to the executable — built in the project and started from the project's root — keeps reading the working directory's. A game in plain C has no entry point of the framework's to do this, so its own `main()` makes the same move under the same condition, as `examples/plain_c` shows.

NetBSD and OpenBSD are the exception: raylib cannot ask either system where an executable is, so there the game 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, …`. On those two, whatever launches the game has to start it in its own folder.

On every desktop target it runs but NetBSD and OpenBSD, CI starts a release from somewhere other than its folder. `tools/shipped_check.sh`, on macOS and on the BSDs, builds a software-rendered release and starts it twice. First where it was built, from the project folder: with no `resources/` next to it, it has to stay where it was started and read the root's. Then laid out the way the archive ships it, from another folder; on NetBSD and OpenBSD it starts that one from its own folder and requires the log line above instead. The Linux x64 and ARM64 jobs unzip the archive they ship and start it from another folder, the Windows job starts the `.exe` from one, and the musl and DRM runs start it from `/`.

## Built to be hard to exploit

A game reads files a player can change — its saves, its assets — and a memory mistake that a debug build's [sanitizers](https://omardev29.github.io/rmp-docs/manual/basics/configuration.html#sanitizers) did not meet is still in the release. So a release is compiled and linked with what makes such a mistake harder to turn into anything worse, and each flag is checked against the toolchain first: one it does not take is left out, never a broken build, and the configure log lists what was applied, after `=== RELEASE HARDENING:`.

- **Linux, macOS and the BSDs:** the stack protector, `-fstack-protector-strong`, and the cheap bounds checks of the C++ library, libstdc++'s and libc++'s.
- **Linux and the BSDs**, on top of that: stack-clash protection; relocations made read-only once the loader is done, and every symbol bound at start (RELRO and BIND_NOW); a stack that is not executable; and `_FORTIFY_SOURCE` where the C library is glibc. And the executable is position-independent, so that ASLR moves it too and not only the libraries around it.
- **Windows:** MSVC's defaults are the stack protector, ASLR, data execution prevention and high-entropy addresses; Clang building for Microsoft's ABI links with `lld-link`, whose defaults give the last three too. MinGW is asked for the last three, which its linker gives by default anyway, and not for the stack protector, which there can mean shipping a DLL beside the game.
- **macOS, iOS and Android** are position-independent by the platform's rule, and Android's toolchain adds the stack protector and `_FORTIFY_SOURCE` by itself. The web has no stack to execute and no loader to move.

Each one was measured on `linux-x64-glibc` before it went in, and they cost about 2% of the binary together. Position independence costs 5.5% more, mostly in the relocations the loader has to apply, and is on all the same: without it the executable sits at the same address on every run. `-DRMP_RELEASE_PIE=OFF` exists to measure that, not to ship. Every Linux job then reads what the linker made of it off the binary, with `tools/binary_check.py elf`, and fails on a release that lacks any of it:

```shell
python3 tools/binary_check.py elf --pie build/release/my_game
```

## Where the saves go

[`rmp::save`](https://omardev29.github.io/rmp-docs/reference/namespaces/rmp-save.html) writes into one of two places, chosen by `[save] portable`:

| `portable` | Saves go to | Wanted by |
|---|---|---|
| `false` (the default) | `%APPDATA%\my_game` on Windows, `~/Library/Application Support/my_game` on macOS, `~/.local/share/my_game` on Linux and the BSDs — or `$XDG_DATA_HOME/my_game` when that variable holds an absolute path | installers, and Steam's cloud saves |
| `true` | a `saves/` folder next to the executable | a zip the player unpacks and runs — itch.io's downloads: deleting the folder deletes the game, saves included |

raylib_multiplatform.toml

```toml
[save]
portable = true
```

Only Windows, Linux and FreeBSD have a folder next to the executable to use. macOS ignores `portable`. NetBSD and OpenBSD cannot say where the executable is, so there a portable build logs `SAVE: [save] portable: this system does not say where the executable is; saving
in the user's folder instead` and saves in the player's folder, as if `portable` were `false`. When the folder next to the executable cannot be written — a portable build copied somewhere read-only — the saves go to the player's folder instead and the log says so once, and a read looks in both and takes the newer save, so nothing is lost in silence.

## Linux

The Linux archives answer three questions a player's machine answers differently: which processor, which C library, and whether there is a desktop at all.

- `linux-x64-glibc` and `linux-arm64-glibc`: the ordinary desktop build, for every distribution built on glibc.
- `linux-riscv64-glibc`: the same for RISC-V.
- `linux-x64-musl`: for Alpine and the other musl distributions. musl and glibc are two C libraries, not two versions of one: a glibc binary does not start on Alpine, and this one does not start on Debian. It is linked dynamically, so that GLFW can open the system's X11 and GL libraries when it starts.
- `linux-x64-glibc-drm` and `linux-arm64-glibc-drm`: DRM/KMS. The game draws straight to the screen through the kernel, with no X11 and no Wayland — a Raspberry Pi, a cabinet, a kiosk, a bare console. It links `libdrm`, `libgbm`, `libEGL` and `libGLESv2` from the system. Leave both out with `disabled = ["drm"]`.

The desktop builds need nothing installed on the player's side but a desktop: GLFW opens libX11 and libGL with `dlopen` when the game starts, so neither is a link-time dependency. Release binaries are stripped of their debug symbols as they are linked, and the x64 job fails if one still carries them.

### The glibc floor

A Linux binary records, for every symbol it imports, the glibc version that symbol came from, and the loader refuses to start it on a system with an older glibc. CI builds on Ubuntu 24.04, whose glibc is newer than Debian 12's, Ubuntu 22.04's or the Steam runtime's, and a binary linked the ordinary way there would stop at `version GLIBC_2.39 not found` on all of them.

`[linux] glibc` is the oldest glibc the shipped binary may ask for:

raylib_multiplatform.toml

```toml
[linux]
glibc = "2.31"
```

The default is `"2.28"`: RHEL 8, Debian 10, and with room to spare Steam's *sniper* runtime. With a floor set, `tools/linux_build.sh` compiles with `zig cc` against that glibc's symbols, and `tools/glibc_check.sh` reads every versioned symbol out of the finished binary and fails the build if one is newer than the floor — naming the symbols. The game's own code is the same either way; this is a compatibility setting, not a behaviour change. `""` builds against whatever the build machine has, which is right for a local build and wrong for a release. A version outside 2.17–2.99 is refused:

raylib_multiplatform.toml

```toml
[linux]
glibc = "2.16"
```

```text
  raylib_multiplatform.toml:2: glibc = "2.16"
                               ^^^^^^^^^^^^^^

  configure: error: [linux] glibc = '2.16' is not a version this can target.
                    Use 2.17 to 2.99, or "" to build against the host's glibc and target nothing in particular.
                    2.17 is RHEL 7, 2.28 is RHEL 8 and Debian 10, 2.31 is Ubuntu 20.04, Debian 11 and Steam's sniper runtime.
```

The floor applies to `linux-x64-glibc` and `linux-arm64-glibc`, which are built that way and checked. The rest are built differently:

- **DRM** links the system's `libdrm`, `libgbm` and `libEGL` directly, and those were built against the build machine's glibc, so its floor is the build machine's. Its job prints the floor the binary really has, on every run.
- **`linux-riscv64-glibc`** is built with the cross compiler in CI's image against that image's own riscv64 glibc, Ubuntu 24.04's, so `[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. Its job holds it to that floor of its own and fails if the binary ever asks for more, naming the symbols that do.
- **`linux-x64-musl`** has no glibc to ask for.

## Windows

`windows-x64` and `windows-arm64`: the first built with the Windows runner's MinGW GCC, the second compiled with MSVC for ARM64 on an x64 machine. A release build opens no console window behind the game.

- **Nothing to install.** A player's machine has Windows and nothing else, so the compiler's C and C++ runtimes are linked into the `.exe` — MinGW with `-static`, MSVC with the static C runtime — and the zip carries no DLL. Each Windows job reads the import tables of the `.exe` it ships with `tools/binary_check.py` and fails on any DLL that is not part of Windows 10, naming it and saying how to link it in instead. A `libstdc++-6.dll` or a `VCRUNTIME140.dll` in that list is a game that starts on the machine that built it and nowhere else.
- **The icon.** Windows keeps a program's icon inside the `.exe`. `tools/configure.py` turns `[icon] source` into a multi-resolution `.ico` that the build embeds, and making it needs Pillow: on your own machine, a build without Pillow goes on without an icon and nothing fails over it. The Windows jobs install Pillow at a version and with checksums pinned in `thirdparty/FROZEN_VERSIONS.md`, fail when `[icon] source` exists and no icon resource came out of it, and check that the `.exe` they ship carries the icon.
- **The windowing backend.** `[windows] backend` is `"glfw"` by default; `"win32"` and `"rgfw"` drop GLFW for a smaller `.exe` and cover less — gamepads, several monitors, the clipboard.
- **Tested on a real Windows.** CI starts the x64 `.exe` with Mesa's software OpenGL placed beside it, since the runners have no GPU, and checks it draws. It starts it with the compiler's folder, and every folder holding a MinGW runtime DLL, taken off `PATH`: Windows looks for an imported DLL on `PATH`, so a runner with MinGW there would start an `.exe` that no player's machine can. The three Mesa DLLs — `opengl32.dll`, `libgallium_wgl.dll` and `dxil.dll` — are deleted before packaging, and the packaging step fails if `opengl32.dll` or `libgallium_wgl.dll` is in the zip: a copy shipped by mistake would force software rendering on every player.

## macOS

`macos-build.zip` holds one executable with both an arm64 and an x86_64 slice, for Apple silicon and Intel Macs, next to its `resources/` folder. It is a plain executable, not an `.app` bundle. CI checks both slices are in the file.

Like the Linux and BSD executables, it carries no icon: `[icon] source` makes the app icon of Windows, Android and iOS only, because the other targets ship a bare executable or a page, with no icon of their own to make from it.

It opens on macOS 10.15 on an Intel Mac and on macOS 11 on Apple silicon. Every slice of a Mach-O records the oldest macOS it runs on, and a Mac older than that refuses to open it, with no message that says why; left to itself the toolchain records the version of the SDK it built with, which is the runner's own macOS. So `CMakeLists.txt` sets `CMAKE_OSX_DEPLOYMENT_TARGET` to 10.15, the first macOS whose C++ library has the `std::filesystem` that [`rmp::save`](https://omardev29.github.io/rmp-docs/reference/namespaces/rmp-save.html) uses, and the arm64 slice starts at 11.0 even when the deployment target is lower, because that is the first macOS that ran on Apple silicon. The macOS job reads the minimum out of each slice with `tools/binary_check.py macos` and fails on one above those.

## Signing

Nothing in the pipeline signs the Windows `.exe` or signs or notarises the macOS executable, and the framework has no setting for either. What the framework does take into account is what signing changes — it is the reason UPX is off for Windows by default, and refused for macOS ([below](https://omardev29.github.io/rmp-docs/publishing/desktop.html#compressing-with-upx)).

## FreeBSD, OpenBSD and NetBSD

`freebsd-x64`, `freebsd-arm64`, `openbsd-x64`, `openbsd-arm64` and `netbsd-x64` are each built inside a virtual machine of that system, with its own compiler and its own packages. Their archives are named after the system and the machine — `bsd-freebsd-x86-64-build.zip`, `bsd-openbsd-arm64-build.zip` — and carry the pack like the others.

Some combinations are not built, each for a reason outside the framework: FreeBSD publishes no RISC-V packages, the virtual machines CI builds in exist for neither OpenBSD nor NetBSD on RISC-V, and NetBSD's ARM64 packages cannot be installed on its base system. RISC-V is covered by `linux-riscv64-glibc`.

The packages a BSD machine installs come from the systems' own mirrors, which change from day to day, and neither project offers a snapshot to pin to. These archives are on the GitHub release and not on itch.io, which has no BSD platform.

## Compressing with UPX

UPX compresses an executable into one that unpacks itself in memory when it starts, at the cost of a few milliseconds at every launch. On this framework's own game, built the way CI builds it, it takes `linux-x64-glibc` from 1 234 656 bytes to 365 836, 70% smaller, and `linux-x64-glibc-drm`, which links its graphics libraries instead of carrying them, 58%. `[upx]` says which targets get it:

raylib_multiplatform.toml

```toml
[upx]
enabled  = ["linux"]
disabled = ["linux-arm64-glibc-drm"]
```

Groups expand and `disabled` is taken away afterwards, like `[targets]`. The groups here are `all`, `linux`, `windows` and `bsd`, and `all` means every target that can be compressed — not every target. The default is `linux-x64-glibc`, `linux-arm64-glibc`, `linux-x64-musl` and `linux-x64-glibc-drm`. To turn compression off, empty `enabled`.

Each target that cannot be compressed has its own reason, and naming one, in either list, is an error that says it, not a setting that quietly does nothing:

| Target | Why not |
|---|---|
| `macos`, `ios` | the binary is code-signed; compressing it breaks the signature |
| `android` | what ships is a `.so` inside an APK, which is already a zip — compressing it makes the APK bigger |
| `web` | it is `.wasm`, and the browser fetches it gzipped anyway |

The refusal comes from `tools/configure.py` like every other mistake in the .toml, at its line — on your machine, in `rmp test config`, long before a release would package anything:

raylib_multiplatform.toml

```toml
[upx]
enabled = ["macos"]
```

```text
  raylib_multiplatform.toml:2: enabled = ["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.
```

So does a name that is no target or group at all, and that message lists every name `[upx]` knows:

raylib_multiplatform.toml

```toml
[upx]
enabled = ["linux-x64"]
```

```text
  raylib_multiplatform.toml:2: enabled = ["linux-x64"]
                               ^^^^^^^^^^^^^^^^^^^^^^^

  configure: error: [upx] enabled: unknown target or group 'linux-x64'.
                    Known: all, bsd, freebsd-arm64, freebsd-x64, linux, linux-arm64-glibc, linux-arm64-glibc-drm, linux-riscv64-glibc, linux-x64-glibc, linux-x64-glibc-drm, linux-x64-musl, netbsd-x64, openbsd-arm64, openbsd-x64, windows, windows-arm64, windows-x64
```

The trade-offs of the targets that can be compressed:

- **Windows** is available and off by default. An unsigned `.exe` that has been UPX-packed is a shape Windows Defender associates with malware, and it gets quarantined on some machines and not on others. If you sign your builds, turn it on.
- **The BSDs** are available and off by default, because nothing has tested a packed BSD binary.
- **A binary that is too big is left alone.** UPX itself refuses files past about 768 MB, and fails rather than declining. `[upx] max_size_mb`, 600 by default, is the size above which a binary is shipped uncompressed with a line in the log, so a large game still releases. Above 768 it is refused, and so is a value below 1, since that would skip everything — emptying `enabled` says that better:

raylib_multiplatform.toml

```toml
[upx]
max_size_mb = 0
```

```text
  raylib_multiplatform.toml:2: max_size_mb = 0
                               ^^^^^^^^^^^^^^^

  configure: error: [upx] max_size_mb = 0 would skip every binary. To turn compression off, empty `enabled` instead — that says what you mean.
```

UPX runs at its slowest and smallest setting, and every packed binary is verified with `upx -t` before it goes into the zip. The version is pinned with a checksum in `thirdparty/FROZEN_VERSIONS.md`.

The default is exactly the targets whose packed binary CI starts. Each of those four jobs unzips the archive it ships, compressed, starts what is in it and checks it draws: `linux-x64-glibc` on every push, under a virtual X server; and on a full run `linux-arm64-glibc` on a runner of its own architecture, `linux-x64-musl` on Alpine under a virtual X server, and `linux-x64-glibc-drm` on a virtual DRM display. So a compressed binary that does not launch is a red run. `linux-riscv64-glibc` is compressed only when you name it: no group and no default brings it in. UPX 5.2.0's RISC-V stub dies with `SIGTRAP` on every Linux kernel before 6.3, which is what most RISC-V boards ship. Its first act is `memfd_create(MFD_EXEC)`, a flag those kernels refuse with `EINVAL`; the x86-64 and ARM64 stubs try again without it, the RISC-V one does not. QEMU runs on the host's newer kernel and never saw it; a RISC-V board with Linux 5.10 did. If your players all run Linux 6.3 or later, name it in `enabled` for its 59%; `configure.py` says so with a warning, and with `[ci] riscv64 = "rise"` the board's job fails at its boot and the cross build ships the compressed archive. Every other target is started before packaging compresses it, or as a separate software-rendered build, or not at all, so a binary compressed there is checked by `upx -t` and never started. UPX supports those targets; turning it on for one ships a packed binary whose launch nothing has seen.
