Compile ZDoom on Linux

From ZDoom Wiki

Jump to: navigation, search

This tutorial will guide you on the compilation of ZDoom on Linux. Some steps require root privileges.

Contents

Install FMOD

This step may not be necessary; check your distribution in the next section below.

$ wget http://www.fmod.org/index.php/release/version/fmodapi375linux.tar.gz
$ tar -xvzf fmodapi375linux.tar.gz

Now make yourself root

$ sudo su
Password: (enter your password)
# cp fmodapi375linux/api/libfmod-3.75.so /usr/lib/
# ln -s /usr/lib/libfmod-3.75.so /usr/lib/libfmod.so
# cp -vf fmodapi375linux/api/inc/* /usr/include/

Install required dependencies

These versions are known to work with ZDoom 2.2.0:

  • gcc-4.1.1 or gcc-3.4.6-r1
  • fmod-3.75 or fmod-3.74
  • flac-1.1.2-r7 or flac-1.1.2-r3
  • libsdl-1.2.11 or libsdl-1.2.8-r1
  • libjpeg62-dev
  • nasm-0.98.39-r3
  • GTK 2.0 development files is required since ZDoom 2.1.7
  • p7zip-4.42 or p7zip-4.39 available in P7ZIP page

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

  • In Debian, run (as root):
# apt-get install g++ zlib1g-dev libsdl1.2-dev libjpeg62-dev libflac++-dev nasm tar bzip2 p7zip libgtk2.0-dev
  • In Gentoo, ignore the previous section and run (as root):
# emerge -avn sys-devel/gcc media-libs/fmod media-libs/flac media-libs/libsdl dev-lang/nasm app-arch/p7zip

Make sure the versions of these packages are equal to or greater than one of the versions listed above.

Get the ZDoom Sources

Browse to the ZDoom Downloads Page and download the sources for the latest version of ZDoom via the "ZDoom #.#.# Source Code" link.

Or, check out the Subversion Repository.

Latest version known to compile and run under Linux: ZDoom 2.2.0.

Unpack the files

Unpack the ZDoom source code in a specific directory:

$ 7zr x zdoom-2.2.0-src.7z -o<dir>

Where <dir> is the directory you want to put ZDoom in, such as /opt/zdoom-2.2.0 or /usr/local/zdoom-2.2.0.

If the command 7zr was not found, try 7z or 7za.

Compile

To build ZDoom, from the directory you extracted the sources to, execute make. Note that if your user does not own the current directory (such as /opt/zdoom-2.2.0 or /usr/local/zdoom-2.2.0), this must be done as root.

$ cd <dir>

You can use different compiler options by instead doing, for example (note that currently this does not work as expected --Ysangkok 12:52, 23 June 2007 (PDT)):

$ make -f Makefile.linux CFLAGS="-pipe -Wall -Wno-unused -fno-strict-aliasing -O2 -fomit-frame-pointer -march=i686"

The normal compatible way is:

$ make -f Makefile.linux

When the compilation process finishes successfully you'll have two new files: zdoom, the executable; and zdoom.pk3, a symlink to wadsrc/zdoom.pk3.

Install ZDoom

For easier execution (or at least shorter -iwad/-file/-deh parameters), you can optionally install the executable and pk3 as follows (not as root) in your home:

$ mkdir $HOME/bin $HOME/.zdoom
$ ln -sf <dir>/zdoom $HOME/bin/zdoom
$ ln -sf <dir>/zdoom.pk3 $HOME/.zdoom/zdoom.pk3

Where <dir> is the directory you extracted the 7z archive to in the unpacking section above. Remember to use a full path name for <dir> such as /opt/zdoom-2.2.0 or /usr/local/zdoom-2.2.0, not just zdoom-2.2.0 or ../../zdoom-2.2.0

You will also need to change your PATH environment variable with the following commands:

Change the current environment's PATH:
$ export PATH="$HOME/bin:$PATH"
Ensure the change is automatically applied to all future environments:
$ echo "PATH=\"\$HOME/bin:\$PATH\" >> $HOME/.bashrc

After doing the above, you can easily run ZDoom like so:

$ cd $HOME/.zdoom
$ zdoom

Doing so will create $HOME/.zdoom/zdoom.ini with default settings. You should check to make sure it has.

$ ls -l $HOME/.zdoom/zdoom.ini
-rw-r--r-- 1 <username> users <filesize> Jul  6 01:54 /home/<username>/.zdoom/zdoom.ini

Install iWad Files

To play with ZDoom you need at least an iWad file. The following is a list of all wad files known to work as iWad files:

  • Doom (Shareware) — doom1.wad*
  • Doom (Registered) — doom.wad
  • Doom II — doom2.wad
  • Ultimate Doom — doom.wad or doomu.wad**
  • Final Doom — tnt.wad and plutonia.wad
  • Heretic (Shareware) — heretic1.wad*
  • Heretic (Registered or Commercial) — heretic.wad
  • Hexen — hexen.wad
  • Hexen: Deakhkings of the Dark Citadel — hexdd.wad (Requires Hexen)
  • Strife (Teaser) — strife0.wad*
  • Strife (Full) — strife1.wad
  • French Doom II — doom2f.wad***

*This iWad can legally be acquired for free. Try Google.
**This iWad is named doom.wad, however you can rename it to doomu.wad if you wish to also use Doom (Registered).
***This iWad is the French translation of Doom II: Hell on Earth.

Zdoom will try to read any of those files from the directory $HOME/.zdoom . You can copy, move or symlink your .wad files to $HOME/.zdoom/:

$ cp /absolute/path/to/doom.wad $HOME/.zdoom/doom.wad
or
$ mv /absolute/path/to/doom.wad $HOME/.zdoom/
or
$ ln -sf /absolute/path/to/doom.wad $HOME/.zdoom/doom.wad

Alternatively, you can configure the directory in zdoom.ini:

[IWADSearch.Directories]
Path=/absolute/path/to/

Start Playing ZDoom

Now you can finally play ZDoom.

$ cd $HOME/.zdoom
$ zdoom

Try the following instead to possibly get a huge boost in FPS:

$ cd $HOME/.zdoom
$ export SDL_VIDEODRIVER=dga
$ zdoom

Troubleshooting

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

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

Then you can either start ZDoom without music:

zdoom -nomusic

Or install Timidity (a program to play MIDI and MOD music files in software). To install Timidity...

  • ... on any Debian-based distribution, run (as root):
# apt-get install timidity
  • ... on Gentoo, run (as root):
# emerge -avn timidity++

Optimizations

  • For AMD Athlon XP, build with:
make CFLAGS="-pipe -Wall -Wno-unused -fno-strict-aliasing -O2 -fomit-frame-pointer -march=athlon-xp -mmmx -msse -m3dnow -ffast-math"

Note that the switches -mmmx, -msse, and -m3dnow may not be needed. GCC 3.4, and probably any version after, and including, 3.0 will automatically enable them if the specified CPU type can handle them. Also, although the -ffast-math option gives some speed up, versions compiled with this flag may not be compatible for network play with other compilations of the same version of ZDoom.

Links

Personal tools