Compile QZDoom on Linux

From ZDoom Wiki
Jump to navigation Jump to search

Open a terminal and copy and paste the whole code box for each step.

Install dependencies

QZDoom needs certain tools and development files in order to compile:

  • Required
    • gcc 4.8 or later
    • make
    • cmake 2.8.7 or later
    • SDL 2.0.2 or later
    • libGL and libGLU (SDL or libSDL pull in libGLU) or any other GL implementation provider.
    • libopenal
    • libmpg123
    • libsndfile
  • 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 (QZDoom 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)
  • Runtime
    • gxmessage (optional - needed to show the crash log in a window)
    • kdialog (optional - for KDE users)
    • fluidsynth (optional - for MIDI playback)

Install the following as root/superuser:


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


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


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


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

Arch Linux

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


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


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


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

Do the following sections as normal user.

Create qzdoom_build directory

mkdir -pv ~/qzdoom_build

Download and prepare the source

Download the QZDoom source and create an out of tree build directory:

cd ~/qzdoom_build &&
git clone git:// &&
mkdir -pv qzdoom/build

and run the following commands:

cd qzdoom
git config --local --add remote.origin.fetch +refs/tags/*:refs/tags/*
git pull


To compile QZDoom:

c="$(lscpu -p | grep -v '#' | sort -u -t , -k 2,4 | wc -l)" ; [ "$c" -eq 0 ] && c=1
cd ~/qzdoom_build/qzdoom/build &&
cmake .. -DCMAKE_BUILD_TYPE=Release &&
make -j$c

A development version of QZDoom will be compiled if you do not do #Latest stable version.

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


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

Latest stable version

Show the latest stable version:

cd ~/qzdoom_build/qzdoom &&
git tag -l | grep -E '^q[0-9]+([.][0-9]+)*$' |
sed 's/^q//' | sort -n -t . -k 1,1 -k 2,2 -k 3,3 -k 4,4 |
tail -n 1 | sed 's/^/q/'

If you want to compile the latest stable version, run:

cd ~/qzdoom_build/qzdoom &&
Tag="$(git tag -l | grep -E '^q[0-9]+([.][0-9]+)*$' |
sed 's/^q//' | sort -n -t . -k 1,1 -k 2,2 -k 3,3 -k 4,4 |
tail -n 1 | sed 's/^/q/')" &&
git checkout --detach refs/tags/$Tag

and compile.

After compiling, backing up and optionally installing the latest stable version, run:

cd ~/qzdoom_build/qzdoom &&
git checkout master


If you want to backup QZDoom, do the following:

Create and name a directory with the corresponding QZDoom version/revision, build type and copy qzdoom, qzdoom.pk3, lights.pk3, brightmaps.pk3 and game_support.pk3 to it:

cd ~/qzdoom_build/qzdoom/build &&
if [ -f CMakeCache.txt ]; then
k="$(sed -n 's/.*CMAKE_BUILD_TYPE:STRING=\(.*\)/\1/p' CMakeCache.txt)"; else k=''; fi &&
if [ -n "$k" ]; then b="-BuildType$k"; else b=''; fi &&
BACKUPQZDOOM="../../$(sed -n 's/.*#define GIT_DESCRIPTION "\(.*\)".*/\1/p' ../src/gitinfo.h)$b" &&
mkdir -pv "$BACKUPQZDOOM" &&
if [ game_support.pk3 -nt zd_extra.pk3 ]; then p=game_support.pk3; else p=zd_extra.pk3; fi &&
cp -v qzdoom qzdoom.pk3 lights.pk3 brightmaps.pk3 $p \

Files are located at:

/home/<your username>/qzdoom_build/<your newly created directory>


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

cd ~/qzdoom_build/qzdoom &&
git pull

When the update finish, go to #Compiling.


  • qzdoom = Stable version
  • qzdoom-alpha = Development version

Commands beginning with "sudo" will require temporary superuser privileges.

If you want to install QZDoom, do the following:

Create /usr/games/qzdoom and /usr/games/qzdoom-alpha directories:

sudo mkdir -pv /usr/games/qzdoom /usr/games/qzdoom-alpha

Copy qzdoom, qzdoom.pk3, lights.pk3, brightmaps.pk3, game_support.pk3 and the soundfonts directory to /usr/games/qzdoom/ or /usr/games/qzdoom-alpha/:

cd ~/qzdoom_build/qzdoom/build &&
h="$(sed -n 's/.*#define GIT_HASH "\(.*\)".*/\1/p' ../src/gitinfo.h)" &&
if [ -z "$(git describe --exact-match --tags $h 2>/dev/null)" ]; then
d=-alpha; else d=''; fi &&
if [ game_support.pk3 -nt zd_extra.pk3 ]; then p=game_support.pk3; else p=zd_extra.pk3; fi &&
sudo cp -rv qzdoom qzdoom.pk3 lights.pk3 brightmaps.pk3 $p soundfonts \

Create launch script:

cd ~/qzdoom_build/qzdoom/build &&
h="$(sed -n 's/.*#define GIT_HASH "\(.*\)".*/\1/p' ../src/gitinfo.h)" &&
if [ -z "$(git describe --exact-match --tags $h 2>/dev/null)" ]; then
d=-alpha; else d=''; fi &&
printf %s "\
exec /usr/games/qzdoom$d/qzdoom \"\$@\"
" > qzdoom$ &&
chmod 755 qzdoom$ &&
sudo mv -v qzdoom$ /usr/bin/qzdoom$d

Now from a terminal you should be able to run qzdoom or qzdoom-alpha from any user account.


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

sudo rm -rfv /usr/games/qzdoom

Remove qzdoom script:

sudo rm -fv /usr/bin/qzdoom

Remove /usr/games/qzdoom-alpha directory and all its files:

sudo rm -rfv /usr/games/qzdoom-alpha

Remove qzdoom-alpha script:

sudo rm -fv /usr/bin/qzdoom-alpha


This page has helped you compile QZDoom, 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 QZDoom crash, and are interested in debugging it. First, you need to compile a debug build of QZDoom. Inside the build directory, invoke CMake to set up for compiling, but this time, the build type is set to Debug:

cd ~/qzdoom_build/qzdoom/build
cmake .. -DCMAKE_BUILD_TYPE=Debug

Optionally, you may want to use some of the #Build options.

After CMake is done, run make or to speed up compilation, run make -j<number>, a recommended value for the -j option is the number of physical cores:


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

gdb qzdoom

Now gdb should have you in its own command prompt:


You probably want to log the output, so lets output to a file qzdoomdebug.log:

(gdb) set logging on qzdoomdebug.log

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

(gdb) run

Or put any command line parameters to qzdoom after run:

(gdb) run <command line parameters>

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

(gdb) backtrace

All output will be copied into the qzdoomdebug.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, type quit, q or press Ctrl-D:

(gdb) quit

If you want to free up space, run make clean to remove the files generated by the compilation.

Build options

CMake options
Options Description Example
NO_GTK=ON Disable GTK+ dialogs. cmake .. -DNO_GTK=ON
NO_OPENAL=ON Disable OpenAL sound support. cmake .. -DNO_OPENAL=ON
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

External links