Compiling Simutrans

Normally you install and run Simutrans from one of the available downloads, but if you wish to modify the source code yourself, and perhaps create patches and contribute to the development of the executable, you will need to be able to compile Simutrans yourself. This is a short guide on how to do just that.

If you are on Windows, download either Microsoft Visual Studiolink-external or MSYS2link-external. MSVC is easy for debugging, MSYS2 is easy to set up (but it has to
be done on the command line).

These instruction are based on the readme.txt distributed with the source code. Please consult that document for any updates that might have been added since this page was last updated. You can also check the Development Support sub-forum link-external

Getting the Source Codelink

You can download the latest version with a SVN client. The primary repository for the Simutrans source code is
$ svn checkout svn://servers.simutrans.org/simutrans/trunk

If you prefer to use git, there is a mirror of the svn repository available thanks to aburch at github which you can make a local clone of:
$ git clone http://github.com/aburch/simutrans.git

Note that the svn repository is the main repository, and the git repository is just a mirror. If you use git instead of svn, you will need to set the game version manually for network play.

Getting the librarieslink

Simutrans required librarieslink

This is a list of libraries used by Simutrans. Not all of them are necessary, some are optional, so pick them according to your needs.
Library Website Necessary? Notes
zlib https://zlib.net/link-external Necessary Basic compression support
bzip2  https://www.bzip.org/downloads.htmllink-external Necessary Alternative compression. You can pick this or zstd
libpng http://www.libpng.org/pub/png/link-external Necessary Image manipulation
libSDL2  http://www.libsdl.org/link-external Necessary* *On Linux & Mac. Optional but recommended for Windows. Graphics back-end
libzstd https://github.com/facebook/zstdlink-external Optional Alternative compression.
pkgconf http://pkgconf.org/link-external Optional Needed by FreeType/SDL/makeobj
libfreetype http://www.freetype.org/link-external Optional TrueType font support
libminiupnpc http://miniupnp.free.fr/link-external Optional Easy Server option
libfluidsynth https://www.fluidsynth.org/link-external Optional MIDI playback recommended on Linux & temporarily on Mac.
libSDL2_mixer http://www.libsdl.org/link-external Optional Alternative MIDI playback and sound system.

Libraries for MSYS2 / Linux / Maclink

Library Brew (Mac) Debian/Ubuntu Arch Linux Fedora OpenSUSE MSYS2
zlib zlib zlib1g-dev zlib zlib-devel zlib-devel mingw-w64-x86_64-zlib
libSDL2  sdl2 libsdl2-dev sdl2 SDL2-devel libSDL2-devel mingw-w64-x86_64-SDL2
bzip2  bzip2  libbz2-dev bzip2  bzip2-devel libbz2-devel mingw-w64-x86_64-bzip2
libzstd zstd libzstd-dev zstd libzstd-devel libzstd-devel mingw-w64-x86_64-zstd
pkgconf pkg-config pkgconf pkgconf pkgconf pkgconf mingw-w64-x86_64-pkg-config
libpng libpng libpng-dev libpng libpng-devel libpng16-devel mingw-w64-x86_64-libpng
libfreetype freetype libfreetype6-dev freetype2  freetype-devel freetype2-devel mingw-w64-x86_64-freetype*
libminiupnpc miniupnpc libminiupnpc-dev miniupnpc miniupnpc-devel miniupnpc-devel mingw-w64-x86_64-miniupnpc*
libfluidsynth fluidsynth libfluidsynth-dev fluidsynth fluidsynth-devel fluidsynth-devel mingw-w64-x86_64-fluidsynth*
libSDL2_mixer sdl2_mixer libsdl2-mixer-dev sdl2_mixer SDL2_mixer-devel libSDL2_mixer-devel mingw-w64-x86_64-SDL2_mixer

Libraries for Microsoft Visual Studiolink

  1. Download MSVC Studio Community edition.
  2. Download a git tool and clone https://github.com/Microsoft/vcpkglink-external to an arbitrary directory that we will call vcpkg-root.
  3. Run bootstrap-vcpkg.bat
  4. Copy install-building-libs.bat from simutrans/trunk to this folder and execute it, or install the libraries you want manually:
./vcpkg/vcpkg --triplet x64-windows-static install zlib bzip2 libpng zstd sdl2 freetype miniupnpc

Change the triplet according to your system (for example, “x86-windows-static” for 32-bit builds).


Go to the source code directory of simutrans (simutrans/trunk if you downloaded from svn).

Compiling with CMakelink

CMake makes easy to generate build files for various build systems, and the steps for doing so are pretty standard.

1. Create the build directorylink

mkdir build && cd build

2. Generate build fileslink

Options will be set automatically depending on the libraries found. You may want to set options manually when generating build files, for example the graphics backend (gdi, sdl2 or none) can be set with option -DSIMUTRANS_BACKEND=sdl2. For a list of options execute:
cmake -LH ..

Linux & MacOSlink

Change “Release” to “Debug” if you want a debug build.
cmake -DCMAKE_BUILD_TYPE=Release ..

MSYS MinGWlink

Change “Release” to “Debug” if you want a debug build.
cmake -DCMAKE_BUILD_TYPE=Release -G "MSYS Makefiles" ..


For generating build files using the command line run the following. If you want a 32 bit executable change “x64” to “Win32”
cmake.exe .. -G "Visual Studio 16 2019" -A x64 -DCMAKE_TOOLCHAIN_FILE=[vcpkg-root]/scripts/buildsystems/vcpkg.cmake

If you are using the GUI, Visual Studio will try to generate the cache automatically if you open the simutrans source directory, but it will probably fail if you have not set the path to vcpkg toolcchain. So first go to Project -> Configuration and set the “CMake toolchain file” to “vcpkg-root/scripts/buildsystems/vcpkg.cmake” and the re-generate the cache with Project -> Generate Cache.

3. Build Simutranslink

The executable will be built in build/simutrans. By default this will only compile the simutrans target. The --target install option will copy the contents of the simutrans directory into the build/simutrans directory, so the game is ready to play. It will also update the language files. If you only want the simutrans executable you can omit this option or use it specify another executable to be compiled (i.e. “makeobj”).

Linux /MinGW/MacOSlink

cmake --build . --target install

In MacOS --target install will also generate an app bundle.


With MSVC you need to set the build type at this step in the command line:
cmake --build . --target install --config Release

If you are using the GUI, you can select Compile -> Install simutrans to do the same.

4. (Windows only) Building the pakset installerlink

Since Simutrans 123, the pakset installer is needed to start Simutrans. The --target install option will try to call NSIS to do that automatically, but NSIS must be properly installed and configured with the following plugins:


1. Install the package mingw-w64-x86_64-nsis
2. Unpack the unicode version of the plugins in /msys64/mingw64/share/nsis/unicode


1. Download NSIS https://nsis.sourceforge.io/Downloadlink-external
2. Install NSIS in the default location (Program Files (x86))
3. Install the plugins either unpacking manually the unicode version in /Program Files (x86)/NSIS/Plugins/x86-unicode or by running in Powershell the prepare-nsis.ps1 script you can find in the .github directory of simutrans source code.

Compiling with makelink


  1. Open a terminal and run autoreconf -ivf
  2. Now run ./configure
  3. Type make AV_FOUNDATION=1 to compile Simutrans*
  4. Also type make OSX/getversion

  • AVFoundation must be specified on MacOS 10.12 or later, but the midi playback is currently broken. If you care about music try Fluidsynth (USE_FLUIDSYNTH_MIDI=1) instead.

GCC Systemslink

  1. Open a terminal and run autoconf
  2. Now run ./configure
  3. Finally type make to compile Simutrans

Manual configuration with makelink

  1. Go to the source code directory of simutrans
  2. Copy the file config.template to config.default and edit the file. You need to specify:
    • BACKEND = sdl2
    • OSTYPE = (you should know it)
  3. Additionally, you may want to set the following flags too:
Flag Description
OPTIMISE=1  Add umpteen optimisation flags
DEBUG= 1  Up to 3, enable the debug build
MULTI_THREAD = 1  Enable multi-core CPU support
USE_FREETYPE = 1  Enable Truetype font support. Set also FREETYPE_CONFIG
FREETYPE_CONFIG=freetype-config If it fails, try with FREETYPE_CONFIG=pkg-config freetype2
USE_UPNP = 1  Easy server hosting behind routers
USE_ZSTD = 1  Compression for savegames
USE_FLUIDSYNTH_MIDI = 1  Use Fluidsynth music backend for MIDI playback

Finally, type make. If you want a smaller program and do not care about error messages, you can comment out #DEBUG=1 and run strip sim (Unix) or strip sim.exe (Windows) after compiling and linking.

Compiling with Microsoft Visual Studiolink

Simutrans solution is a single solution file with 4 projects:
  • Simutrans-Main: The project that holds the shared, non back-end specific, files. All the followings use Main to build the specific back-end executables.
  • Simutrans SDL2: Preferred back-end for Simutrans.
  • Simutrans GDI: Windows-only back-end.
  • Simutrans Server: Server back-end with no graphical interface.

There are 3 compilation configurations for the main executable:
  • Debug is meant for developing
  • Stable is meant for compiling stable versions
  • Release builds optimized code but using revision data just like debug. This is meant for creating optimized nightly builds for servers.


If you want to cross-compile Simutrans from Linux for Windows, see en_Cross-Compiling_Simutrans page.


If you want to contribute, read the coding guidelines in simutrans/documentation/coding_styles.txt
You definitely should check out the international forumlink-external as well.


Rate this page:

Contributors to this page: Roboron3042 , Frank , IgorEliezer and system .
Page last modified on Saturday January 15, 2022 22:03:45 CET by Roboron3042.

Online Users

8 online users

Newest Forum Posts

No records to display