Skip to main content
This guide covers building OpenRCT2 from source using Windows Subsystem for Linux (WSL). This is a great alternative to building natively on Windows, as it provides a Linux environment with easier dependency management.

Prerequisites

Installing WSL

1

Enable WSL

Open PowerShell as Administrator and run:
wsl --install
This installs WSL 2 with Ubuntu by default.
2

Restart your computer

After installation completes, restart Windows.
3

Set up Ubuntu

Launch “Ubuntu” from the Start Menu and complete the initial setup (username and password).
4

Update packages

sudo apt update
sudo apt upgrade -y

Alternative: Installing a specific distribution

To use a different Linux distribution:
# List available distributions
wsl --list --online

# Install a specific distribution
wsl --install -d Ubuntu-22.04

Installing Build Dependencies

Once inside your WSL Ubuntu environment:
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
These are the same dependencies as building on native Linux. See the Linux build guide for distribution-specific package names.

Building OpenRCT2

1

Clone the repository

git clone https://github.com/OpenRCT2/OpenRCT2.git
cd OpenRCT2
You can clone the repository on the Windows filesystem (/mnt/c/Users/...) and build from WSL, but performance will be better if you clone directly in WSL’s filesystem (~/).
2

Create a build directory

mkdir build
cd build
3

Configure the build

cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release
4

Compile

ninja
The build will generate the openrct2 GUI binary and openrct2-cli headless server.

Running OpenRCT2 from WSL

WSL 2 includes WSLg, which provides GPU acceleration and native GUI support:
./openrct2
OpenRCT2 will launch with a graphical window on your Windows desktop.
WSLg is available in Windows 11 and Windows 10 (build 19044+). It provides the best experience for running GUI applications from WSL.

Option 2: Using X Server (WSL 1 or older WSL 2)

If WSLg is not available, install an X server on Windows:
1

Install VcXsrv or X410

2

Launch X Server

For VcXsrv:
  • Run XLaunch
  • Select “Multiple windows”
  • Display number: 0
  • Start “No Client”
  • Check “Disable access control”
3

Configure display in WSL

# For WSL 2
export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2}'):0

# For WSL 1
export DISPLAY=:0
Add to ~/.bashrc to make permanent:
echo 'export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '\'{print $2}'\'):0' >> ~/.bashrc
4

Run OpenRCT2

./openrct2

Option 3: Headless Server Only

For running a multiplayer server without GUI:
./openrct2-cli host /path/to/save.sv6
This doesn’t require any graphical setup.

Accessing Windows Files

Windows drives are mounted in WSL at /mnt/:
# Access C: drive
cd /mnt/c/Users/YourUsername/Documents

# Copy RCT2 files from Windows
cp -r /mnt/c/Program\ Files\ \(x86\)/Atari/RollerCoaster\ Tycoon\ 2/ ~/rct2/
While you can access Windows files from WSL, building and running OpenRCT2 entirely within the WSL filesystem (~/) provides better performance.

Accessing WSL Files from Windows

You can access WSL files from Windows Explorer:
# Open current directory in Windows Explorer
explorer.exe .
Or navigate to \\wsl$\Ubuntu\home\yourusername\ in Windows Explorer.

Build Options

Portable Build

cmake .. -G Ninja \
  -DCMAKE_BUILD_TYPE=Release \
  -DPORTABLE=ON

Headless Server Build

cmake .. -G Ninja \
  -DCMAKE_BUILD_TYPE=Release \
  -DDISABLE_GUI=ON

Debug Build with Tests

cmake .. -G Ninja \
  -DCMAKE_BUILD_TYPE=Debug \
  -DWITH_TESTS=ON

ninja

# Run tests
ctest --output-on-failure

Performance Optimization

Using CCache

Install CCache for faster rebuilds:
sudo apt install ccache
CMake will automatically detect and use it.

Parallel Builds

Ninja automatically uses all CPU cores. To limit:
ninja -j4  # Use 4 cores

File System Performance

For best performance, keep your source code and build artifacts in the WSL filesystem (~/...), not on the Windows filesystem (/mnt/c/...).
File I/O is significantly faster on WSL’s native ext4 filesystem than on NTFS through the /mnt mount.

Troubleshooting

Cannot connect to display

If OpenRCT2 won’t launch graphically:
# Check DISPLAY is set
echo $DISPLAY

# Test X server connection
sudo apt install x11-apps
xclock
If xclock doesn’t work, your X server isn’t configured correctly.

WSLg not available

Check your Windows version:
winver
WSLg requires:
  • Windows 11, or
  • Windows 10 build 19044 or later
Update Windows if needed, or use an X server (Option 2 above).

Missing dependencies

If CMake reports missing packages:
# Verify package is installed
dpkg -l | grep libsdl2-dev

# Reinstall if needed
sudo apt install --reinstall libsdl2-dev

GCC version too old

GCC 12+ is required. Ubuntu 22.04 includes GCC 11 by default.
Install GCC 12:
sudo apt install gcc-12 g++-12
export CC=gcc-12
export CXX=g++-12
Or use Clang:
sudo apt install clang
export CC=clang
export CXX=clang++

OpenGL/Mesa errors

If you encounter OpenGL issues with WSLg:
# Disable OpenGL
cmake .. -G Ninja \
  -DCMAKE_BUILD_TYPE=Release \
  -DDISABLE_OPENGL=ON

Permission denied on /mnt/c

If you get permission errors accessing Windows files:
# Check mount options
mount | grep /mnt/c

# Copy to WSL filesystem instead
cp -r /mnt/c/path/to/source ~/
cd ~/source

Comparing WSL vs Native Windows

FeatureWSLNative Windows
Dependency managementEasy (apt)Complex (vcpkg)
Build speedFastSlower
Setup complexitySimpleModerate
Integration with WindowsGoodNative
Debugging toolsGDBVisual Studio
File performanceFast (WSL fs)Fast

WSL Tips

Limiting WSL memory usage

Create or edit %USERPROFILE%\.wslconfig on Windows:
[wsl2]
memory=8GB
processors=4

Shutting down WSL

From Windows PowerShell:
# Shutdown WSL
wsl --shutdown

# List running distributions
wsl --list --running

Updating WSL

wsl --update

Next Steps