Skip to content

Building OpenRCT2 on Linux

Margen67 edited this page Jul 16, 2021 · 114 revisions

OpenRCT2 can only be built on little-endian architectures for now.

This page tells you how to build the project. For instructions on how to get assets and run it check installation on Linux and macOS.

Required Packages (General)

To build natively on Linux, you will need a set of libraries set up. Since most distributions come with a package manager, we expect you to use that. Required libraries include:

Package Note(s)
sdl2 Only for UI client.
freetype Can be disabled.
fontconfig Can be disabled.
libzip >= 1.0
libpng >= 1.2
speexdsp Only for UI client.
curl only if building with http support.
openssl >= 1.0; Only if building with multiplayer support.
icu >= 59.0
gl Commonly provided by Mesa or GPU vendors; only for UI client, can be disabled.
duktape Unless scripting is disabled.
nlohmann-json >= 3.6.0
Google Benchmark Optional.

Additionally, you can add support for Discord's Rich Presence API by cloning into the root clone directory. Do note discord-rpc requires rapidjson, which don't bother fixing their bugs and you may need the hackish workaround: janisozaur/rapidjson/commit/20f8604ee6cd078c1cb2346148c69c0c2c160db2

APT (Debian, Ubuntu)

The exact package names will differ from distribution to distribution, but here's a short list of the common ones:

sudo apt-get install --no-install-recommends -y cmake libsdl2-dev libicu-dev \
    gcc pkg-config libspeex-dev libspeexdsp-dev libcurl4-openssl-dev \
    libcrypto++-dev libfontconfig1-dev libfreetype6-dev libpng-dev libssl-dev libzip-dev \
    build-essential make duktape-dev nlohmann-json3-dev libbenchmark-dev

This listing should work on Debian and Ubuntu.

pacman (Arch)

This solution is tested continuously with our own dockerfile.

Install dependencies:

sudo pacman -S sdl2 curl nlohmann-json speexdsp fontconfig libpng openssl libzip gcc gcc-libs icu duktape

DNF (Fedora):

Run the following for dependencies, then proceed with Linux build instructions.

sudo dnf install gcc gcc-c++ json-devel \
    openssl-devel SDL2-devel libicu-devel \
    speexdsp-devel libcurl-devel \
    cmake fontconfig-devel freetype-devel \
    libpng-devel libzip-devel mesa-libGL-devel \


This section is outdated and needs an update to reflect we can now build for x86_64 and other little-endian platforms.

This install requires either plain x86 system or amd64 with multilib enabled.

With regular x86 system, you just need to configure the sources with cmake (see below) and compile.

On amd64 you first need to enable multilib and then add abi_x86_32 to at least following libraries:

# cat /etc/portage/package.use/abi_x86_32
## Please note that this library list may be incomplete due to USE flag differences
dev-cpp/nlohmann_json   abi_x86_32
media-libs/libsdl2      abi_x86_32
media-libs/sdl2-mixer   abi_x86_32
media-libs/speex        abi_x86_32
net-misc/curl           abi_x86_32

Then you need to emerge required libraries and in case portage gives shows some dependency issues, fix up the libraries with missing abi_x86_32 flags by adding them to the list above.


Install dependencies:

sudo zypper in SDL2-devel fontconfig libzip5 libzip-devel libpng16-devel libicu-devel speexdsp-devel curl libcurl-devel nlohmann_json openssl openssl-devel glibc zlib cmake gcc gcc-c++ fontconfig-devel

Notes for Leap

Some old Leap versions use an old version of gcc by default, while OpenRCT2 needs gcc7 or later. You'll need to fix the symlinks for g++ and c++ to point to g++-7. Leap 15 uses gcc7 by default.

Alpine Linux

Install dependencies:

apk add git gcc g++ make cmake libzip-dev curl-dev nlohmann-json sdl2-dev fontconfig-dev fts-dev icu-dev duktape-dev speexdsp-dev

(Dependency fts may not be required in the future, see #5520) (You may wish to install Zenity or KDialog, see #5521)


Install these dependencies then build as normal:

sudo eopkg install sdl2-devel curl-devel libspeex-devel fontconfig-devel libpng-devel openssl-devel libzip-devel libicu-devel mesalib-devel nlohmann-json


mkdir build && cd build
cmake .. # Remember to set your build flags, e.g. -DCMAKE_BUILD_TYPE=RelWithDebInfo

This will generate a openrct2 binary in the build directory. To run you have two options: make install or running it locally.

make install

make install will download required resources (json objects, title sequences) and installs openrct2 under /usr/local by default, but DESTDIR will be properly honoured (see below).

Running it from the build directory

Alternatively you can install the required resources manually so can launch openrct2 from the project directory. You need a functional data directory next to the current working directory when you start openrct2.

An easy way to generate such a data directory is by leveraging make install. Type the following in the build directory:

DESTDIR=. make install

Alternatively you can install these assets yourself. The following needs to satisfied:

$XDG_CONFIG_HOME/OpenRCT2/ (or ~/.config/OpenRCT2/ in its absence) has to have config.ini with game_path set to an RCT install. openrct2 will ask you for this directory when it first starts.

Keep in mind you can symlink stuff and that filesystems are case sensitive!

Alternatively you can specify the data directory like this:

./openrct2 --openrct-data-path=../data


Just symlink the data directory in the current build directory, which is the easiest approach for development

ln -s ../data data


Building with clang works the same way as building with GCC, you just need to change the CXX environment variable. Keep in mind, that you need to have an empty build directory as cmake will not switch compilers after it has already generated a Makefile.

mkdir build && cd build
export CXX=$(which clang++) # OpenRCT2 is purely a C++ project, there's no need to set CC
cmake ..

See the optimization note above.


You can switch from Make to Ninja, if you prefer:

mkdir build && cd build
cmake .. -G Ninja # Any other arguments you want, for example -DCMAKE_BUILD_TYPE=RelWithDebInfo
ninja # No need to specify parallel, it does that automatically
DESTDIR=. ninja install


#6658 added support for discord-rpc, Discord's Rich Presence client library. It gets automatically picked up when cloned into the root of repository.


Docker is a nice way of doing things when you have problems installing all the dependencies or just want to test on clean system. Docker containers are ephemeral snapshots of a specified system (described via Dockerfile), where you can run your commands.

Let's see example from our current

PARENT=`readlink -f ../`
chmod a+rwx `pwd`
chmod g+s `pwd`
docker run -u travis -v $PARENT:/work/openrct2 -w /work/openrct2/build -i -t openrct2/openrct2:32bit-only bash -ec "cmake ../ $OPENRCT2_CMAKE_OPTS && make"

This runs the specified command (bash -ec "cmake ../ $OPENRCT2_CMAKE_OPTS && make") interactively as a travis user dockerfiles/32bit/Dockerfile#L7, having previously mounted your local (host's) $PARENT as container's /work/openrct2, and will use /work/openrct2/build as cwd.

You may want to update mountpoints so you can reflect your local paths easily, especially when debugging.

Apart from contents of mounted volumes, all results of commands you executed in this container will be gone after it exits.


To build using mingw toolchain, you will need the toolchain itself, cmake and some basic system utilities you likely already have (bash, unzip, wget, sha256sum).

The script should largely handle that case. Said script should also download latest version of zip including precompiled libraries we use in the project and copy extracted contents to places where you could expect to find them.

Keep in mind we have no capacity to test the script thoroughly and while some caution and code review has been applied, it's possible that the script doesn't work properly or even breaks things. We welcome any patch to solve these kinds of problems.

Study CMakeLists.txt file to see what options are there, but in most basic case you should be fine with just

export OPENRCT2_CMAKE_OPTS="-DCMAKE_TOOLCHAIN_FILE=../CMakeLists_mingw.txt" TARGET=windows is roughly just a fancy wrapper for


You can either use the script or invoke make directly.

To launch the game, you would simply start openrct2.exe using wine or Windows.

Clone this wiki locally