Compile ZDoom on Linux

From ZDoom Wiki
Jump to: navigation, search

This tutorial will guide you on the compilation of ZDoom on Linux. Commands are shown in the tutorial that should be entered into a terminal. Commands beginning with `su` or `sudo` will require temporary root/superuser privileges, as will most likely any package installation.

Install dependencies

ZDoom requires some tools and development files in order to compile. These versions are known to work with recent ZDoom versions:

  • Required
  • Recommended
    • GTK3 or GTK2
    • git (needed in order to download the source and compile in commit meta data)
    • nasm 0.98.39 or later (x86-32 only)
  • Optional
    • zlib (ZDoom has a copy of it and will be statically compiled in if not found)
    • libbzip2 (possibly static)
    • libjpeg (possibly static)
    • libgme or game-music-emu (possibly static)
    • wildmidi (possibly static)
  • Runtime
    • gxmessage (optional - needed to show the crash log in a window)
    • kdialog (optional - for KDE users)
    • fluidsynth or timidity (optional - for MIDI playback)

In addition to or instead of FMOD, OpenAL can be used for sound in which case the following are required:

You can presumably use any higher versions of these programs, however that might not be the case.


sudo apt-get install g++ make zlib1g-dev libsdl2-dev libjpeg-dev \
nasm tar libbz2-dev libgtk-3-dev cmake git libfluidsynth-dev libgme-dev \
libopenal-dev libmpg123-dev libsndfile1-dev timidity libwildmidi-dev


dnf install gcc-c++ make zlib-devel SDL2-devel libjpeg-turbo-devel \
nasm tar bzip2-devel gtk3-devel cmake git fluidsynth-devel game-music-emu-devel \
openal-soft-devel libmpg123-devel libsndfile-devel timidity++ wildmidi-devel


zypper install gcc-c++ make zlib-devel libSDL2-devel libjpeg-devel \
nasm tar libbz2-devel gtk3-devel cmake git fluidsynth-devel libgme-devel \
openal-soft-devel mpg123-devel libsndfile-devel timidity


a='' && [ "$(uname -m)" = x86_64 ] && a=64
urpmi gcc-c++ make lib${a}zlib-devel lib${a}sdl2.0-devel \
lib${a}jpeg-devel nasm tar lib${a}bzip2-devel lib${a}gtk+3.0-devel \
cmake git lib${a}fluidsynth-devel lib${a}gme-devel lib${a}openal-devel \
lib${a}mpg123-devel lib${a}sndfile-devel TiMidity++ lib${a}wildmidi-devel \

Arch Linux

ZDoom is available in Arch User Repository at

Install as per usual for AUR packages.

pacman -S --needed gcc make zlib sdl2 libjpeg-turbo nasm tar bzip2 gtk3 cmake git \
fluidsynth libgme fmodex openal mpg123 libsndfile timidity++ wildmidi


emerge -avn sys-devel/gcc sys-devel/make sys-libs/zlib media-libs/libsdl2 media-libs/libjpeg-turbo \
dev-lang/nasm app-arch/tar app-arch/bzip2 x11-libs/gtk+ dev-util/cmake dev-vcs/git media-sound/fluidsynth \
media-libs/game-music-emu media-libs/openal media-sound/mpg123 media-libs/libsndfile media-sound/timidity++ \


a='' && [ "$(uname -m)" = x86_64 ] && a=64
apt-get install gcc-c++ make zlib1-devel lib${a}sdl2.0-devel \
lib${a}jpeg62-devel nasm tar lib${a}bzip2-devel lib${a}gtk+3.0-devel \
cmake git lib${a}fluidsynth1-devel lib${a}openal-devel lib${a}mpg123-devel \
lib${a}sndfile-devel TiMidity++


sudo eopkg install g++ make zlib-devel sdl2-devel libjpeg-turbo-devel nasm tar bzip2-devel \
libgtk-3-devel cmake git fluidsynth-devel openal-soft-devel mpg123-devel libsndfile-devel \
wildmidi-devel binutils glibc-devel pkg-config

Do the following steps as normal user.

Download and prepare the source

Download the ZDoom source and make an out of tree build directory:

git clone git:// &&
mkdir -pv zdoom/build
cd zdoom/build

The rest of the guide will assume execution from the build directory created here.

Download FMOD

Skip this step if you want to compile ZDoom with OpenAL support only. If afterwards you want FMOD support, do this step and compile ZDoom.

Download FMOD and extract files to zdoom directory:

wget -nc &&
tar -xvzf fmodapi44464linux.tar.gz

Since FMOD is not ABI or API stable it not generally a good idea to install it system wide (although one can).


To compile the development version:

a='' && [ "$(uname -m)" = x86_64 ] && a=64
c="$(lscpu -p | grep -v '#' | sort -u -t , -k 2,4 | wc -l)" ; [ "$c" = 0 ] && c=1
cmake .. -DCMAKE_BUILD_TYPE=Release \
-DFMOD_LIBRARY="fmodapi44464linux/api/lib/libfmodex${a}" \
-DFMOD_INCLUDE_DIR="fmodapi44464linux/api/inc" &&
make -j$c

Assuming all goes well, a zdoom binary should be produced. To start ZDoom, the following command should work:


If ZDoom complains you do not have any IWADs set up, make sure that you have your IWAD files placed in the same directory as ZDoom, in ~/.config/zdoom, $DOOMWADDIR, or /usr/local/share. Alternatively, you can edit ~/.config/zdoom/zdoom.ini to set the path for your IWADs.

Current release version

If you want to compile the current release version, run:

 git checkout 2.8.1

and compile.

After compiling, backing up and optionally installing the current release version, run:

git checkout master


Follow this step if you want or manually copy (backup) zdoom, zdoom.pk3 and

Make and name a directory with the corresponding ZDoom version/revision, build type and copy zdoom, zdoom.pk3 and to it:

BACKUPZDOOM="$(sed -n 's/.*#define GIT_DESCRIPTION "\(.*\)".*/\1/p' ../src/gitinfo.h)\
$(sed -n 's/.*CMAKE_BUILD_TYPE:STRING=\(.*\)/\-BuildType\1/p' CMakeCache.txt)" &&
mkdir -pv "$BACKUPZDOOM" &&
cp -v zdoom zdoom.pk3 \
output_sdl/ "$BACKUPZDOOM"


When you wish to update ZDoom, copy and paste the following:

git pull

When the update finish, go to #Compiling.


The following steps have commands that require to be run as superuser with the sudo command.

If you want to install ZDoom, do the following:

Make /usr/games/zdoom directory:

sudo mkdir -pv /usr/games/zdoom

Copy zdoom, zdoom.pk3, and FMOD to /usr/games/zdoom:

a='' && [ "$(uname -m)" = x86_64 ] && a=64
chrpath -r '$ORIGIN' zdoom
sudo cp -v zdoom zdoom.pk3 output_sdl/ \
fmodapi44464linux/api/lib/libfmodex${a} \

Make launch script

cat <<'EOF' >
exec /usr/games/zdoom/zdoom "$@"
chmod +x
sudo mv /usr/bin/zdoom

Now from a terminal you should be able to execute zdoom from any user account.


To remove the previous installation steps:

Remove /usr/games/zdoom directory and all its files:

sudo rm -rfv /usr/games/zdoom

Remove zdoom script:

sudo rm -fv /usr/bin/zdoom


This page has helped you compile ZDoom, but perhaps you are interested in debugging the code or submitting code changes or fixes for inclusion. This section is intended for more advanced users who may be unfamiliar to CMake or debugging on Linux systems.



Maybe you have found a way to make ZDoom crash, and are interested in debugging it. First, you need to compile a debug build of ZDoom. Inside the build directory, invoke CMake to set up for compiling, but this time, the build type is set to Debug. Optionally, you may want to add some of the #Build options to the cmake command or run make clean before recompilation. After CMake is done, run make or to speed up compilation run make -jN, a recommended value for N is the number of physical cores:

cmake .. -DCMAKE_BUILD_TYPE=Debug

To run ZDoom under a debugger such as gdb, use the following command:

gdb zdoom

Now gdb should have you in its own command prompt. You probably want to log the output, so lets output to a file zdoomdebug.log:

(gdb) set logging on zdoomdebug.log

Now start ZDoom by typing in run, and pressing enter:

(gdb) run

Or put any Command line parameters to zdoom after run:

(gdb) run <command line parameters>

If ZDoom crashes, gdb may be able to tell you the source file and line number it crashed in.
Typing in the command bt or backtrace will produce information telling the last function calls, showing how execution got to the point where it crashed:

(gdb) bt

All output will be copied into the zdoomdebug.log, which can then be scrutinized later, or perhaps posted to the Bugs forum for other developers to look at.

To exit gdb's command prompt, use quit, q or Ctrl-D:

(gdb) quit

Build options

CMake build options
Options Description Example
NO_GTK=ON Disable GTK+ dialogs. cmake .. -DNO_GTK=ON
NO_FMOD=ON Disable FMOD support. cmake .. -DNO_FMOD=ON
NO_OPENAL=ON Disable OpenAL support. cmake .. -DNO_OPENAL=ON
FMOD_LIBRARY Set path for FMOD library. cmake .. -DFMOD_LIBRARY=/path/to/libfmodex(64)
FMOD_INCLUDE_DIR Set path for FMOD include directory. cmake .. -DFMOD_INCLUDE_DIR=/path/to/include/dir
CMAKE_C_COMPILER Set path for C compiler. cmake .. -DCMAKE_C_COMPILER=/path/to/compiler/gcc
CMAKE_CXX_COMPILER Set path for C++ compiler. cmake .. -DCMAKE_CXX_COMPILER=/path/to/compiler/g++
CMake build types
Types Description Example
Debug Debug information, -O1 optimization. cmake .. -DCMAKE_BUILD_TYPE=Debug
Release No debug information, -O3 optimization. cmake .. -DCMAKE_BUILD_TYPE=Release
RelWithDebInfo Debug information, -O2 optimization. Useful for finding optimization bugs that only show up in Release. cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo
MinSizeRel Similar to Release but with less optimizations in order to save space. cmake .. -DCMAKE_BUILD_TYPE=MinSizeRel



If ZDoom starts but immediately closes with the following messages in the terminal:

Init Playloop state.
Setting up sound.
Checking network game status.
player 1 of 1 (1 nodes)

This usually indicates that FMOD Ex is not loading correctly (and ZDoom is configured to use FMOD by default). There are then two solutions.

You could start ZDoom without music:

zdoom -nomusic

or you could select (in the ZDoom settings) a MIDI device other than FMOD. To change MIDI device, go to the sound options menu.

  • ... on any Debian/Ubuntu-based distribution, run:
sudo apt-get install timidity timidity-interfaces-extra
  • ... on openSUSE:
yast2 -i timidity or zypper in timidity
  • ... on Gentoo, run:
sudo emerge -avn timidity++

See the software synthesizer article for further information about ZDoom's MIDI devices.

External links