Compile ZDoom 2.0.98 on Linux
From ZDoom Wiki
This tutorial will guide you on the compilation of ZDoom version 2.0.98 on Linux. Some steps require root privileges.
Contents |
Install FMOD
# May not be necessary; check your distribution. wget http://www.fmod.org/files/fmodapi375linux.tar.gz tar -xvzf fmodapi375linux.tar.gz cp fmodapi375linux/api/libfmod-3.75.so /usr/lib/libfmod.so
Install required dependencies
- On Debian sid you can simply do:
apt-get install g++ zlib1g-dev libsdl1.2-dev libflac++-dev nasm tar bzip2 vim unrar
- Gentoo - these versions work with ZDoom 2.0.98 (Ignore the above Step #1)
- sys-devel/gcc-3.3.6
- media-libs/fmod-3.74
- media-libs/flac-1.1.2-r3
- media-libs/libsdl-1.2.8-r1
- dev-lang/nasm-0.98.39-r1
- app-arch/unrar-3.4.3
Get the ZDoom source file and patch
wget http://www.zdoom.org/files/lars/98src.rar wget -O 98-changes.tar.bz2 http://forum.zdoom.org/download/file.php?id=3101
Unpack the files
unrar x 98src.rar zdoom-2.0.98/ cd zdoom-2.0.98 tar -xjvf ../98-changes.tar.bz2
Apply the patch, and prepare for the compilation
patch -p0 < 98-changes.diff # If you installed FMOD into a non-system location, you may need to edit default.cbd # and add another -I option to the first CPPFLAGS = ... line
Compile
sh ./cbuild.c
- If you get this error during compilation (Forum thread):
src/p_acs.cpp:3382: error: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second: src/p_acs.cpp:3382: note: candidate 1: operator+(int, int) <built-in> src/zstring.h:41: note: candidate 2: string operator+(char, const string&)
Edit the file src/p_acs.cpp go to line 3382 that is this one:
workreal[1] = color >= CR_BRICK && color <= CR_YELLOW ? 'A' + color : '-';
Replace that line with this one
workreal[1] = char((color >= CR_BRICK && color <= CR_YELLOW) ? (int('A') + color) : '-')
Now try again to compile.
- If you get this error during compilation (Forum thread):
src/v_text.cpp: In member function 'void DCanvas::DrawText(int, int, int, const char*, ...)': src/v_text.cpp:204: error: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second: src/v_text.cpp:204: note: candidate 1: operator+(int, int) <built-in> src/zstring.h:41: note: candidate 2: string operator+(char, const string&)
Edit the file src/v_text.cpp go to line 204 that is this one:
else if (newcolor >= 'A' && newcolor < 'A' + NUM_TEXT_COLORS)
Replace that line with this one:
else if ( (newcolor >= 'A') && (newcolor < (int('A') + NUM_TEXT_COLORS))
Now try again to compile.
- If you get this error during compilation (0.98):
cc1plus: error: invalid option `tune=athlon-xp'
Edit default.cbd and change the "-mtune=${TUNE_TYPE}" part into "-mcpu=${TUNE_TYPE}" Now try again to compile.
- If you get this error during compilation (0.97):
src/gccinlines.h:272: error: 'asm' operand requires impossible reload
Execute this command:
vim +"%s/OPTLEVEL ?= 2/OPTLEVEL ?= 0/g" default.cbd +wq
Now try again to compile.
- If you get a large error during compilation of src/sound/fmodsound.cpp:
In file included from src/sound/fmodsound.cpp:46: src/sound/fmodsound.h:5:18: warning: fmod.h: No existe el fichero o el directorio src/sound/fmodsound.h:68: error: 'FSOUND_SAMPLE' has not been declared ...
Execute this command:
cp ../fmodapi3741linux/api/inc/* .
Now try again to compile.
When the compilation process finishes succesfully you'll have two new files: zdoomgcc and zdoom.wad
Install the binary
With 0.98, there is no installation on Linux. It is simpler to run zdoom from the directory where you compiled it. There is no need to install the zdoom.wad either.
Start ZDoom for the first time
It will generate the file $HOME/.zdoom/zdoom.ini
./zdoomgcc
Copy zdoom.wad
Now copy zdoom.wad to that directory
cp zdoom.wad $HOME/.zdoom
Copy IWADs
Copy a wad for any supported game (for example doom.wad or doom2.wad) to that directory.
Start ZDoom to play
Now you can finally play ZDoom:
./zdoomgcc
Try the following instead to get a huge boost in fps:
export SDL_VIDEODRIVER=dga ./zdoomgcc
- If it starts but immediately closes with that messages on the shell:
... 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:
./zdoomgcc -nomusic
Or install Timidity (a program to play MIDI and MOD music files). To install that program:
- on Debian (or Ubuntu or other compatible):
apt-get install timidity
Optimizations
- For AMD Athlon XP, set:
ARCH_TYPE="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.
Links
- http://forum.zdoom.org/potato.php?p=177182#177182 (2.0.97 binary by Chris)
- binaries are very picky about specific versions of shared libraries, that's why it may be just as much trouble to compile your own binaries, unless you are lucky.
- http://forum.zdoom.org/potato.php?p=174565#174565 (2.0.97 patch by Chris)
- http://forum.zdoom.org/potato.php?t=5431 (Installation on Ubuntu 4.10)
- http://forum.zdoom.org/potato.php?t=612 (Linux Zdoom?)

