Compile GZDoom on Linux

From ZDoom Wiki
Jump to: navigation, search

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


Starting with this commit:

cd "$HOME"/gzdoom_build/gzdoom && \
git show c219811a542e0d6aae38b920ae9e257c5c2286c1

consider GZDoom as licensed under the GPL, therefore; this step and the following files and CMake build options mentioned in this tutorial:,,, NO_FMOD, FMOD_LIBRARY and FMOD_INCLUDE_DIR are unnecessary but they will still be left in place for the users who still need to compile a GZDoom version prior to the previously mentioned commit.

The minimum requirement for GZDoom 2.2 and later is OpenGL 2.0, so if you get the following error:

Unsupported OpenGL version.

At least OpenGL 2.0 is required to run GZDoom.

you will have to use #GZDoom 1.8.6 instead. Keep in mind that this version is several years old and no longer maintained. It will also have problems with more recent actively maintained mods. You will also need to install gcc 5.* or lower:

sudo apt-get install gcc-5 g++-5

and inside the build directory, run cmake with these options -DCMAKE_C_COMPILER=/path/to/compiler/gcc -DCMAKE_CXX_COMPILER=/path/to/compiler/g++ before compiling GZDoom 1.8.6, for example:

cd "$HOME"/gzdoom_build/gzdoom/build && \
cmake .. -DCMAKE_C_COMPILER="/usr/bin/gcc-5" \

Install dependencies

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

  • 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.
  • 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 (GZDoom 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)
    • SDL 1.2.8 or later 1.2.x versions (for GZDoom 1.x)
    • libglew (for GZDoom 1.x)
    • FMOD Ex 4.36.* or later or FMOD Studio (for GZDoom 1.x and 2.x)
  • 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.

Install the following as root/superuser:


sudo apt-get install g++ make zlib1g-dev libsdl1.2-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 \
libgl1-mesa-dev libglew-dev


dnf install gcc-c++ make zlib-devel SDL-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 \
mesa-libGL-devel glew-devel


zypper install gcc-c++ make zlib-devel libSDL-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 \
Mesa-libGL-devel glew-devel


a='' && [ "$(uname -m)" = x86_64 ] && a=64
urpmi gcc-c++ make lib"$a"zlib-devel lib"$a"SDL-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 \
lib"$a"mesagl1-devel lib"$a"glew-devel lib"$a"cairo-devel

Arch Linux

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


emerge -avn sys-devel/gcc sys-devel/make sys-libs/zlib media-libs/libsdl 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++ media-sound/wildmidi \
media-libs/mesa media-libs/glu media-libs/glew

Update (29.12.2016): Jacendi overlay has an ebuild for gzdoom

emerge -n layman
layman -a jacendi-overlay
emerge -av gzdoom


a='' && [ "$(uname -m)" = x86_64 ] && a=64
apt-get install gcc-c++ make zlib1-devel lib"$a"SDL-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++ \
lib"$a"mesagl1-devel lib"$a"glew-devel


sudo eopkg install g++ make zlib-devel sdl1-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 mesalib-devel libglu-devel glew-devel

Do the following steps as normal user.

Make gzdoom_build directory

mkdir -pv "$HOME"/gzdoom_build

Download and prepare the source

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

cd "$HOME"/gzdoom_build && \
git clone git:// && \
mkdir -pv gzdoom/build

and run the following commands:

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

Download FMOD

This step is unnecessary unless you need to compile a GZDoom version prior to this commit and want FMOD support.

Download FMOD and extract files to gzdoom directory:

cd "$HOME"/gzdoom_build && \
wget -nc && \
tar -xvzf fmodapi44464linux.tar.gz -C gzdoom


FMOD 4.44.64 32-bit and 64-bit:


To compile the development version:

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

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


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

Current release version

Show the current release version:

cd "$HOME"/gzdoom_build/gzdoom && \
git tag -l | grep -v 9999 | grep -E '^g[0-9]+([.][0-9]+)*$' | \
sed 's/^g//' | sort -n -t . -k 1,1 -k 2,2 -k 3,3 -k 4,4 | \
tail -n 1 | sed 's/^/g/'

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

cd "$HOME"/gzdoom_build/gzdoom && \
Tag="$(git tag -l | grep -v 9999 | grep -E '^g[0-9]+([.][0-9]+)*$' | \
sed 's/^g//' | sort -n -t . -k 1,1 -k 2,2 -k 3,3 -k 4,4 | \
tail -n 1 | sed 's/^/g/')" && \
git checkout --detach refs/tags/"$Tag"

and compile.

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

cd "$HOME"/gzdoom_build/gzdoom && \
git checkout master

GZDoom 1.8.6

If your graphics card doesn't support OpenGL 2.0 or higher, you may want to compile GZDoom 1.8.6.

Let's checkout GZDoom 1.8.6:

cd "$HOME"/gzdoom_build/gzdoom && \
git checkout --detach refs/tags/g1.8.6

and compile. Please note that GZDoom 1.8.6 is old and unsupported. If you run into problems you are on your own.


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

Make and name a directory with the corresponding GZDoom version/revision, build type and copy gzdoom, gzdoom.pk3, lights.pk3, brightmaps.pk3 and to it:

cd "$HOME"/gzdoom_build && \
BACKUPGZDOOM="$(sed -n 's/.*#define GIT_DESCRIPTION "\(.*\)".*/\1/p' gzdoom/src/gitinfo.h)\
$(sed -n 's/.*CMAKE_BUILD_TYPE:STRING=\(.*\)/\-BuildType\1/p' gzdoom/build/CMakeCache.txt)" && \
mkdir -pv "$BACKUPGZDOOM" && \
cp -v gzdoom/build/{gzdoom,gzdoom.pk3,lights.pk3,\
brightmaps.pk3,output_sdl/} "$BACKUPGZDOOM"

The previous files should be located at:

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


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

cd "$HOME"/gzdoom_build/gzdoom && \
git pull

When the update finish, go to #Compiling.


  • gzdoom = Release version
  • gzdoom-alpha = Non-release version

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

If you want to install GZDoom, do the following:

Make /usr/games/gzdoom and /usr/games/gzdoom-alpha directories:

sudo mkdir -pv /usr/games/{gzdoom,gzdoom-alpha}

Copy gzdoom, gzdoom.pk3, lights.pk3, brightmaps.pk3, and or to /usr/games/gzdoom or /usr/games/gzdoom-alpha:

cd "$HOME"/gzdoom_build/gzdoom && \
t="$(git describe --exact-match --tags 2>/dev/null)" ; \
d='' && [ -z "$t" ] && d=-alpha ; \
a='' && [ "$(uname -m)" = x86_64 ] && a=64 ; \
sudo cp -v {build/{gzdoom,gzdoom.pk3,lights.pk3,\
fmodapi44464linux/api/lib/libfmodex"$a"} \

Make gzdoom or gzdoom-alpha script, add executable permission and move it to /usr/bin:

cd "$HOME"/gzdoom_build/gzdoom && \
t="$(git describe --exact-match --tags 2>/dev/null)" ; \
d='' && [ -z "$t" ] && d=-alpha ; \
cd /tmp && \
echo '#!/bin/sh' > gzdoom"$d" && \
echo >> gzdoom"$d" && \
echo "export LD_LIBRARY_PATH=/usr/games/gzdoom"$d"" >> gzdoom"$d" && \
echo "exec /usr/games/gzdoom"$d"/gzdoom \"\$@\"" >> gzdoom"$d" && \
chmod 755 gzdoom"$d" && \
sudo mv -v gzdoom"$d" /usr/bin

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


To remove the previous installation steps:

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

sudo rm -rfv /usr/games/gzdoom

Remove gzdoom script:

sudo rm -fv /usr/bin/gzdoom

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

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

Remove gzdoom-alpha script:

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


This page has helped you compile GZDoom, 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 GZDoom crash, and are interested in debugging it. First, you need to compile a debug build of GZDoom. 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:

cd "$HOME"/gzdoom_build/gzdoom/build
cmake .. -DCMAKE_BUILD_TYPE=Debug

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

gdb gzdoom

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

(gdb) set logging on gzdoomdebug.log

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

(gdb) run

Or put any Command line parameters to gzdoom after run:

(gdb) run <command line parameters>

If GZDoom 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 gzdoomdebug.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

How to increase Zandronum/GZDoom OpenGL FPS on Intel graphics



  • xserver-xorg-video-intel >= 2.19


  • xorg-x11-drv-intel >= 2.19


  • xf86-video-intel >= 2.19


  • x11-driver-video-intel >= 2.19

Arch Linux

  • xf86-video-intel >= 2.19


  • x11-drivers/xf86-video-intel >= 2.19


  • x11-driver-video-intel >= 2.19

Run Zandronum/GZDoom, start a new game, open console and type vid_fps 1, see how many FPS are displayed and exit Zandronum/GZDoom.

Enable SandyBridge's New Acceleration

If your Intel driver version is 2.21.14-1 / 2.21.15-2 or greater, go to the next part.

Intel SNA is useful on all Intel graphics, not just SandyBridge.

Make 99-intel.conf:

touch 99-intel.conf

Copy and paste the following to 99-intel.conf:

Section "Device"
     Identifier "Intel Graphics"
     Driver "intel"
     Option "AccelMethod" "sna"

and save.

Verify if the xorg.conf.d directory already exist:

ls /etc/X11

If it doesn't exist, as root/superuser, make it:

mkdir -pv /etc/X11/xorg.conf.d

As root/superuser, copy 99-intel.conf to /etc/X11/xorg.conf.d:

cp -v 99-intel.conf /etc/X11/xorg.conf.d

and logout and login.

Disable Vertical Synchronization for Zandronum/GZDoom

Open a terminal, go to your user home directory and verify if the .drirc file already exist:

cd "$HOME"
ls -la

If it doesn't exist; make it:

touch drirc

otherwise add the configurations of the next step to the already existing .drirc file.

Copy and paste the following to drirc:

    <device screen="0" driver="dri2">
        <application name="zandronum" executable="zandronum">
	    <option name="vblank_mode" value="0"/>
	<application name="gzdoom" executable="gzdoom">
	    <option name="vblank_mode" value="0"/>

and save.

Rename drirc to .drirc:

mv drirc .drirc

Run Zandronum/GZDoom, start a new game, open console and type vid_fps 1, see how many FPS are displayed, you should get more FPS than before.

Revert all changes

Remove .drirc:

cd "$HOME"
rm -fv .drirc

As root/superuser, remove 99-intel.conf:

cd /etc/X11/xorg.conf.d
rm -fv 99-intel.conf

and logout and login.

External links