How to build the SDK on Linux
From modwiki
Contents |
Introduction
This is a guide on how to compile the SDK on linux and package your mod. It assumes basic knowledge of linux, the command line, and using a package manager for your particular distribution.
Requirements
- A fairly modern linux distribution
- The SDK v1.3.1 package (FTP)
- GCC 4.x
- Scons 0.96 - distribution specific
- X11 development libraries, usually called libx11-dev
- OpenGL development libraries, usually called xlibmesa-gl-dev - distribution specific
- A fairly modern linux distribution, recommendation (GCC 4.1.2): Ubuntu 8.04 , Fedora Core 6, Mandriva 2007, SUSE 10.1
- The SDK v1.4.2 package (FTP)
- GCC 4.1.2
- Scons 0.96 - distribution specific
- X11 development libraries, usually called libx11-dev
- OpenGL development libraries, usually called xlibmesa-gl-dev - distribution specific
Please note that you MUST use GCC 3.3 if compiling any D3 SDK prior to v1.3.1 or Q4 SDK prior to v1.1. The guide will go over how to deal with a system having more than one version of GCC.
Step 1. Unpacking the SDK
After you have downloaded the SDK, you need to run the file to extract and install the files. On most systems, the .run file will need to be granted execute permission before it can be run.
Then, run the file, and follow the on screen instructions. This guide is going to assume that the package was extracted to /usr/local/games/doom3-sdk or /usr/local/games/quake4-sdk, but you can extract it to where ever you would like. Note that if you want to install it to the default location, you will need to be root. The example below shows the usage of sudo to achieve root, but you can also use su or simply install it to another user-writable directory.
Afterwards, you might want to give everyone write access to the sdk folder, so a plain user can make changes:
Step 2. Running scons
If you have all of the libraries set up and GCC is the default compiler, then compiling the SDK should be as simple as:
linux $ cd /usr/local/games/doom3-sdk/src linux $ scons BUILD="release" ...
linux $ cd /usr/local/games/quake4-sdk/source linux $ scons BUILD="release" CC=gcc-4.1 CXX=g++-4.1 ...
Note that when running scons without the BUILD parameter, it will default to compiling a debug version of the source. This is good for testing things, but due to the massive inflation in filesize (3.6MB for release compared to around 20MB for debug) modifications intended for release should always be compiled with this.
Successful build
If all goes well, the final output from scons will be:
scons: done building targets.
During compilation, there will be plenty of warnings, which is normal.
Missing OpenGL libraries
If your OpenGL libraries are missing, you will receive thousands of errors in the file "renderer/glext.h", and it will finally die with the message:
scons: *** [build/debug/d3xp/d3xp/AF.os] Error 1 scons: building terminated because of errors.
If this is the error you have, then you must install the xlibmesa-gl-dev package, or any other package that provides the files for /usr/include/GL. These libraries require the libx11-dev libraries, so it is almost impossible to get specific x11 errors instead of this.
Wrong compiler version
If you are using any GCC version other than 3.3 while trying to build the D3 SDK prior to v1.3.1 and Q4 SDK prior to v1.1, you will receive errors like this:
game/AF.cpp:741: warning: enumeration value `DECLAF_CONSTRAINT_INVALID' not handled in switch game/AF.cpp: In member function `bool idAF::Load(idEntity*, const char*)': game/AF.cpp:868: warning: comparison between `enum declAFConstraintType_t' and `enum constraintType_t' scons: *** [build/debug/game/game/AF.os] Error 1 scons: building terminated because of errors.
Make sure you have the gcc-3.3 package installed, and then explicity pass that you want to use g++ 3.3 to scons like this:
linux $ scons CC="gcc-3.3" CXX="g++-3.3"
Building on x86_64 (AMD64)
You may need to install libc6 before compiling. Debian users can do this by executing "sudo apt-get install libc6-dev-i386".
Ubuntu users should install the "g++-multilib" package.
Packaging the file into a pk4
Now, package everything into a pk4 for inclusion with your mod. First, you'll need a file called binary.conf, and it needs to contain a single "2".
linux $ echo "2" > binary.conf
Next you will need to rename your gamex86-xxxx.so file by removing either the -base or -d3xp suffix, depending on if your building for vanilla Doom 3 or the expansion respectively.
Then throw the renamed gamex86.so and binary.conf into a zip file named (for example) game01.pk4:
linux $ zip game01.pk4 gamex86.so binary.conf
This will generate a zip file called game01.pk4 containing gamex86.so and binary.conf. If you are building for the expansion, be sure to use the proper gamex86.so.
Note that you can get scons to build the appropriate pk4s for you by calling it as such:
linux $ scons BUILD_GAMEPAK=1
As with any other scons option, it is saved in your site.conf, so you only have to use that argument the first time.
Wrap Up
Please make any comments pertaining to problems or suggestions on the Discussion Page

