Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Building OpenRCT2 on Linux
You can only build OpenRCT2 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 https://github.com/OpenRCT2/OpenRCT2/wiki/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:
sdl2 (only for UI client)
fontconfig (can be disabled)
libzip (>= 1.0)
libpng (>= 1.2)
speexdsp (only for UI client)
curl (only if building with http support)
jansson (>= 2.5)
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)
Additionally, you can add support for Discord's Rich Presence API by cloning https://github.com/discordapp/discord-rpc 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: https://github.com/janisozaur/rapidjson/commit/20f8604ee6cd078c1cb2346148c69c0c2c160db2
APT (Debian, Ubuntu)
This solution is tested continuously by Travis.
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 libjansson-dev libspeex-dev libspeexdsp-dev libcurl4-openssl-dev \ libcrypto++-dev libfontconfig1-dev libfreetype6-dev libpng-dev libssl-dev libzip-dev
This listing should work on Debian and Ubuntu.
This solution is tested continuously with our own dockerfile and then travis.
sudo pacman -S sdl2 curl jansson speexdsp fontconfig libpng openssl libzip gcc gcc-libs icu
Run the following for depdencies, then proceed with Linux build instructions.
sudo dnf install gcc gcc-c++ jansson-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.
x86 system, you just need to configure the sources with cmake (see below) and compile.
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-libs/jansson 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.
# Outdated as of 2019-01-04, OpenRCT2 requires C++17 which ships with GCC7+ sudo zypper in SDL2-devel fontconfig libzip5 libzip-devel libpng speexdsp-devel curl libjansson-devel openssl glibc zlib cmake gcc gcc5 gcc5-c++
Notes for Leap
Leap uses gcc4 by default, OpenRCT2 needs gcc5. You'll need to fix the symlinks for g++ and c++ to point to g++-5. Tumbleweed is using gcc5 by default now. Outdated as of 2019-01-04, OpenRCT2 requires C++17 which ships with GCC7+
apk add git gcc g++ jansson-dev libzip-dev curl-dev libressl-dev sdl2-dev fontconfig-dev fts-dev
mkdir build && cd build cmake .. # remember to set your build flags, e.g. -DCMAKE_BUILD_TYPE=RelWithDebInfo make
This will generate a
openrct2 binary in the
build directory. To run you have two options:
make install or running it locally.
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
An easy way to generate such a data directory is by leveraging
make install. Type the following in the
DESTDIR=. make install
Alternatively you can install these assets yourself. The following needs to satisfied:
$build/data/has to have contents of
$build/data/g2.datneeds to exist. Build it using
make g2and then copy it into
$build/data/objecthas to have the extracted contents from https://github.com/OpenRCT2/objects/releases
$build/data/titlehas to have extracted contents from https://github.com/OpenRCT2/title-sequences/releases
~/.config/OpenRCT2/ in its absence) has to have
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
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 .. make
See the optimisation note above.
https://github.com/OpenRCT2/OpenRCT2/pull/6658 added support for discord-rpc, Discord's Rich Presence client library. It gets automatically picked up when cloned into the root of repository. Our Travis-CI jobs offer packages with discord-rpc compiled in.
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 -c "cmake ../ $OPENRCT2_CMAKE_OPTS && make"
This runs specified command (
bash -c "cmake ../ $OPENRCT2_CMAKE_OPTS && make") interactively as a
travis user (https://github.com/OpenRCT2/OpenRCT2/blob/develop/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).
install.sh 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.
The most competent part of the script has been written to support travis, if in doubt do as travis would do.
Consult build matrix in
.travis.yml or 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
build.sh is (roughly) just a fancy wrapper for
cmake -DCMAKE_BUILD_TYPE=Debug $OPENRCT2_CMAKE_OPTS .. make
You can use either the script or invoke make directly.
To launch the game, you would simply start
openrct2.exe using wine or windows.