Compiling Q2Admin r872 for i386 and x64

Note: As I already have all of these dependencies installed, it can be hard for me to sometimes determine exactly what you might need to apt-install. Let me know if anything goes awry in the comments and I’ll update the guide!

The most-excellent PacketFlinger has kept a version of Quake 2’s former cheat detection mod q2admin still running after all these years. His version works very well for me on both older i386 mods, and modern mods on x64. And I’m going to show you how you can compile it for your own server, on Ubuntu Linux.

First, we need to install the required dependencies. If you plan to build the i386 version for older mods, then run this to install the i386 version of libc:

sudo dpkg --add-architecture i386
sudo apt update
sudo apt install libc6:i386

You will also need some standard packages if you don’t have them installed already for some reason:

sudo apt install git build-essential gcc-multilib g++-multilib pkg-config make perl wget curl ca-certificates tar xz-utils file binutils

Next, we need to clone the q2admin git repository. Make sure you’re in the folder where you want to download it to. The git clone command will automatically create a subfolder named q2admin:

git clone https://github.com/packetflinger/q2admin
cd q2admin

For i386 builds, we need to modify the Makefile slightly. If you’re not compiling for i386 mods, skip down to make — and yes, I should really learn how to commit changes to a git repository one of these days… maybe I’ll try that after this guide, so I can commit this Makefile change to the q2admin repository. Edit Makefile with your editor of choice, for me, that’s nano. I have, since forever, ran nano with -w to prevent line wrapping:

nano -w Makefile

Add the lines in bold below to your Makefile. The change should begin around line 77 or so. You can press CTRL-W, CTRL-T, 77, [Enter] to jump to that line. Others may prefer CTRL-/, 77, [Enter], nano is versatile!

else
    CFLAGS += -fPIC -ffast-math -w -DLINUX
endif

ifeq ($(CPU),i386)
    CFLAGS += -m32
    LDFLAGS += -m32
endif

CFLAGS += -DQ2A_COMMIT='"$(VER)"' -DQ2A_REVISION=$(REV) -DCPU='"$(CPU)"'

CTRL-X, Y, [Enter] to save your changes. Others may prefer CTRL-O, [Enter], CTRL-X which will do the same thing.

We can immediately compile the x86_64 version by simply typing make:

make

This should produce a gamex86_64-q2admin-r###.so file, which is your freshly compiled q2admin for 64-bit!

However, for i386, we are again going to have to do a few things, namely we need to recompile the dependencies to avoid a linker warning after compiling. You’ll also have the most up to date version of q2admin possible for i386, including its libraries. You must determine the full path to your q2admin/deps/ folder, so if you ran git clone in your home directory, this will be ~/q2admin/deps/. From a shell, first set a variable the next script will use. Modify the path in the below if necessary. Do not put a trailing / at the end. Do not put quotes () around it either!

Q2ADEPS=~/q2admin/deps

The above command will set a variable, $Q2ADEPS, that we use in the below snippet. In that same shell, run the following, which will download and compile zlib, curl, and openssl i386 dependencies.

cd /tmp; rm -rf zlib-1.3.2 openssl-3.0.16 curl-8.8.0
wget -nc https://zlib.net/zlib-1.3.2.tar.gz https://www.openssl.org/source/openssl-3.0.16.tar.gz https://curl.se/download/curl-8.8.0.tar.gz
tar xf zlib-1.3.2.tar.gz -C /tmp; cd /tmp/zlib-1.3.2; CFLAGS="-m32 -fPIC -O3" ./configure --static --prefix="$Q2ADEPS/i386/zlib"; make clean; make -j"$(nproc)"; make install
tar xf /tmp/openssl-3.0.16.tar.gz -C /tmp; cd /tmp/openssl-3.0.16; ./Configure linux-x86 no-shared no-tests no-module enable-pic --prefix="$Q2ADEPS/i386/openssl" CFLAGS="-m32 -fPIC"; make clean; make -j"$(nproc)"; make install_sw
tar xf /tmp/curl-8.8.0.tar.gz -C /tmp; cd /tmp/curl-8.8.0; PKG_CONFIG_PATH="$Q2ADEPS/i386/openssl/lib/pkgconfig:$Q2ADEPS/i386/zlib/lib/pkgconfig" CFLAGS="-m32 -fPIC -O3" LDFLAGS="-m32" ./configure --host=i686-pc-linux-gnu --prefix="$Q2ADEPS/i386/curl" --disable-shared --enable-static --with-openssl="$Q2ADEPS/i386/openssl" --with-zlib="$Q2ADEPS/i386/zlib" --disable-ldap --disable-ldaps --without-brotli --without-zstd --without-nghttp2 --without-libpsl; make clean; make -j"$(nproc)"; make install
cd "$Q2ADEPS/.."

Note: The above links are bound to become outdated, I will try to keep them updated. You may have to get updated links if you’re reading this in 2030…

Finally, with ALL THAT out of the way, you can now type:

make CPU=i386

And that should give you a gamei386-q2admin-r###.so file!

Using and configuring q2admin is out of the scope of this guide, and worthy of a whole post or four in itself, so you’ll have to do some research on getting things configured for your server(s).

The README.md will be your absolute best starting point. And all of the stock configs are in your ~/q2admin/runtime-config/ folder.

HUGE shout out to PacketFlinger for keeping this alive! Thank you!!

Leave a Comment