---
title: "How to Compile ReGameDLL_CS from Source"
excerpt: "Build cs.so / mp.dll yourself from the ReGameDLL_CS repository in a clean 32-bit Docker toolchain, and verify the binary before you deploy it."
category: "installation"
tags: "regamedll, compile"
image: ""
read_time: "8 min read"
---
<p>Compiling ReGameDLL_CS yourself is worth doing for the same reasons as ReHLDS: you know exactly what is running on your server, and you can pick up a fix that is merged upstream but not yet released. The build is a 32-bit C++ compile with a Python driver script, and the cleanest way to get a reproducible 32-bit toolchain on a modern 64-bit host is a container.</p>
<h2>1. The build container</h2>
<p><code>Dockerfile.regamedll</code>:</p>
<pre>FROM debian:12
RUN dpkg --add-architecture i386 \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential gcc-multilib g++-multilib libc6-dev-i386 \
python3 git ca-certificates \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /src</pre>
<pre>docker build -t regamedll-build -f Dockerfile.regamedll .</pre>
<p>If you already built the ReHLDS container from <a href="/tutorials/build-rehlds-from-source">the ReHLDS source guide</a>, reuse it — the requirements are the same.</p>
<h2>2. Clone with submodules</h2>
<pre>mkdir -p ~/build && cd ~/build
git clone --recursive https://github.com/s1lentq/ReGameDLL_CS.git
cd ReGameDLL_CS</pre>
<p>The <code>--recursive</code> flag is not optional. ReGameDLL depends on shared headers pulled in as submodules; without them the compile dies on missing includes and looks like a broken toolchain. If you forgot:</p>
<pre>git submodule update --init --recursive</pre>
<h2>3. Pin the revision</h2>
<p>Check out the tag that matches the ReGameDLL release you would otherwise have downloaded, or a specific commit. Never deploy an unpinned <code>master</code> to a production server — you cannot reproduce it later and you cannot tell what changed.</p>
<pre>git tag --sort=-creatordate | head -5
git checkout <tag>
git rev-parse HEAD | tee ../regamedll-commit.txt</pre>
<h2>4. Compile</h2>
<pre>docker run --rm -it \
-v ~/build/ReGameDLL_CS:/src \
-w /src \
regamedll-build bash</pre>
<p>Inside the container, run the repository's build script. ReGameDLL ships a Python build driver at the repo root; the usual invocation is a clean release build:</p>
<pre>python3 build.py --clean</pre>
<p>If the script or its flags differ in the revision you checked out, follow the repository's own build instructions instead of guessing — this project has changed build systems over its lifetime, and made-up flags will only cost you time.</p>
<p>The build produces, among other artefacts:</p>
<pre>cs.so (Linux game library)
game.cfg
game_init.cfg
delta.lst</pre>
<p>The three config/data files are part of the release, not incidental. Ship them with the binary — a ReGameDLL <code>cs.so</code> with a stale <code>delta.lst</code> is one of the reliable ways to get a crash the moment a player connects.</p>
<h2>5. Check the binary before you trust it</h2>
<pre>file cs.so
ldd cs.so</pre>
<p><code>file</code> must report:</p>
<pre>ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked</pre>
<p>If it says <code>x86-64</code>, your multilib setup silently produced a 64-bit object; the server will refuse it with <code>wrong ELF class: ELFCLASS64</code>. <code>ldd</code> must resolve every dependency — a <code>not found</code> line tells you which 32-bit library the target box is missing.</p>
<p>Confirm the symbol the engine actually asks for is exported:</p>
<pre>nm -D --defined-only cs.so | grep -i GiveFnptrsToDll</pre>
<p>If that symbol is absent, the engine will fail with <code>Couldn't get DLL API from ./cstrike/dlls/cs.so!</code> and no amount of config will help — the build is wrong.</p>
<h2>6. Deploy</h2>
<pre>cd /home/steam/hlds/cstrike
cp dlls/cs.so dlls/cs.so.bak
cp /path/to/build/cs.so dlls/cs.so
cp /path/to/build/game.cfg game.cfg
cp /path/to/build/game_init.cfg game_init.cfg
cp /path/to/build/delta.lst delta.lst
chmod 644 dlls/cs.so</pre>
<p>Do <strong>not</strong> copy <code>liblist.gam</code> from the build tree. If Metamod is installed, your <code>liblist.gam</code> points <code>gamedll_linux</code> at <code>addons/metamod/metamod.so</code>; overwriting it points the engine straight at <code>cs.so</code> and silently disables Metamod and every AMXX plugin.</p>
<h2>7. Verify on the server</h2>
<pre>./hlds_run -game cstrike +map de_dust2 +maxplayers 20 +sv_lan 0</pre>
<p>Then in the console:</p>
<pre>regamedll_version
meta list</pre>
<p><code>regamedll_version</code> must print your build's version. <code>meta list</code> must still show every plugin as <code>RUN</code>. Play a full round and force a map change — that is where a mismatched <code>delta.lst</code> announces itself.</p>
<h2>Common build errors</h2>
<ul>
<li><strong><code>skipping incompatible ... when searching for -lstdc++</code></strong> — the 32-bit libstdc++ is missing or <code>-m32</code> is not being passed. Install <code>g++-multilib</code>.</li>
<li><strong><code>fatal error: bits/c++config.h: No such file or directory</code></strong> — same root cause: no 32-bit C++ headers.</li>
<li><strong>Missing headers under a vendor/submodule path</strong> — you cloned without <code>--recursive</code>.</li>
<li><strong>Build succeeds, server segfaults immediately</strong> — you are running a fresh ReGameDLL against a very old engine. Update ReHLDS to a release from the same period; see <a href="/tutorials/fix-regamedll-rehlds-incompatible">ReGameDLL/ReHLDS incompatibility</a>.</li>
</ul>
<h2>Keep a record</h2>
<p>Store <code>regamedll-commit.txt</code> next to the deployed <code>cs.so</code>, and note the matching ReHLDS commit. When someone reports a bug six months from now, the first question is "which build?" — and being able to answer it in five seconds instead of an evening is the entire payoff of building from source. Next: <a href="/tutorials/install-reapi">install ReAPI</a>, which is only usable once ReGameDLL is in place.</p>