This guide covers building OpenRCT2 from source on various Linux distributions.
Prerequisites
You’ll need CMake 3.24+, a C++20 compiler (GCC 12+ or Clang 11+), and Ninja or Make.
Required Dependencies
OpenRCT2 requires the following development libraries:
SDL2 development files
libzip (≥1.0)
zlib
libpng (≥1.6)
OpenSSL (≥1.0.0)
libcurl
FreeType2
fontconfig
ICU (libicu)
zstd (libzstd)
Optional Dependencies
FLAC (libflac)
Vorbis (libvorbis, libvorbisfile)
Ogg (libogg)
OpenGL development files
discord-rpc
ccache (for faster rebuilds)
Installing Dependencies
Ubuntu/Debian
Fedora
Arch Linux
openSUSE
sudo apt update
sudo apt install -y \
git cmake ninja-build \
g++ pkg-config \
libsdl2-dev \
libzip-dev libpng-dev \
libssl-dev libcurl4-openssl-dev \
libfreetype6-dev libfontconfig1-dev \
libicu-dev libzstd-dev \
zlib1g-dev
# Optional dependencies
sudo apt install -y \
libflac-dev libvorbis-dev libogg-dev \
mesa-common-dev libgl1-mesa-dev \
ccache
Building OpenRCT2
Clone the repository
git clone https://github.com/OpenRCT2/OpenRCT2.git
cd OpenRCT2
Create a build directory
Do not build in the source directory. CMake will reject in-source builds.
Configure the build
For a standard release build: cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release
For a debug build: cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Debug
To install to a custom prefix: cmake .. -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr/local
Compile
This will compile both openrct2 (the GUI) and openrct2-cli (the headless server). The build process will also generate required asset files (g2.dat, fonts.dat, palettes.dat, tracks.dat).
Install (optional)
To install system-wide: Or to a custom DESTDIR: DESTDIR = /tmp/openrct2-install ninja install
Build Options
Creating a Portable Build
For a portable build that can be moved to any directory:
cmake .. -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DPORTABLE=ON
This sets the RPATH to $ORIGIN, allowing the binary to find libraries relative to its location.
Building for AppImage
For AppImage packaging:
cmake .. -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DAPPIMAGE=ON
This sets RPATH to $ORIGIN/../lib for the AppImage directory structure.
Headless Build (Server Only)
To build only the headless server without GUI support:
cmake .. -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DDISABLE_GUI=ON
Static Linking
For a statically linked build:
cmake .. -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DSTATIC=ON
Building with Tests
cmake .. -G Ninja \
-DCMAKE_BUILD_TYPE=Debug \
-DWITH_TESTS=ON
ninja
# Run tests
ctest --output-on-failure
Running OpenRCT2
After building, you can run OpenRCT2 directly from the build directory:
For the headless server:
./openrct2-cli host /path/to/save.sv6
On first run, OpenRCT2 will ask you to locate your RollerCoaster Tycoon 2 installation directory.
Using CCache
CCache can significantly speed up rebuilds. It’s enabled by default if detected.
To install CCache:
Ubuntu/Debian
Fedora
Arch Linux
To disable CCache:
cmake .. -G Ninja -DOPENRCT2_USE_CCACHE=OFF
Troubleshooting
GCC Version Too Old
GCC 12 or later is required. Older versions will fail to compile.
If your distribution provides an older GCC:
Ubuntu (use GCC from toolchain PPA)
Fedora (use newer GCC)
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt update
sudo apt install gcc-12 g++-12
export CC = gcc-12
export CXX = g ++ -12
Or use Clang instead:
sudo apt install clang # Ubuntu/Debian
export CC = clang
export CXX = clang ++
Missing pkg-config Files
If CMake cannot find libraries:
# Check pkg-config can find libraries
pkg-config --modversion sdl2
pkg-config --modversion libzip
pkg-config --modversion libpng
# If not found, install the -dev packages
OpenSSL Link Errors
If you encounter OpenSSL linking issues:
# Make sure openssl-dev is installed
sudo apt install libssl-dev # Ubuntu/Debian
sudo dnf install openssl-devel # Fedora
X11/OpenGL Errors
For headless systems or when OpenGL is causing issues:
cmake .. -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DDISABLE_OPENGL=ON
Native Packages
Several distributions offer pre-built OpenRCT2 packages:
Arch Linux : sudo pacman -S openrct2
Gentoo : emerge games-simulation/openrct2
NixOS : nix-env -iA nixpkgs.openrct2
Ubuntu PPA : Available from the nightly PPA
Flatpak : flatpak install flathub io.openrct2.OpenRCT2
These may be easier than building from source if you don’t need the latest development version.
Next Steps