Promotiraj s'rv'r

Add build-regamedll-from-source/en.md

Browse Source
Daemon666 committed parent b37b5c0aa2 commit 3b56d6ee3c37faa27630d371f7cc5110d67fb841
1 changed file with 90 additions and 0 deletions
+90 -0 build-regamedll-from-source/en.md A
@@ -0,0 +1,90 @@
1 +---
2 +title: "How to Compile ReGameDLL_CS from Source"
3 +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."
4 +category: "installation"
5 +tags: "regamedll, compile"
6 +image: ""
7 +read_time: "8 min read"
8 +---
9 +<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>
10 +
11 +<h2>1. The build container</h2>
12 +<p><code>Dockerfile.regamedll</code>:</p>
13 +<pre>FROM debian:12
14 +
15 +RUN dpkg --add-architecture i386 \
16 + &amp;&amp; apt-get update \
17 + &amp;&amp; apt-get install -y --no-install-recommends \
18 + build-essential gcc-multilib g++-multilib libc6-dev-i386 \
19 + python3 git ca-certificates \
20 + &amp;&amp; rm -rf /var/lib/apt/lists/*
21 +
22 +WORKDIR /src</pre>
23 +<pre>docker build -t regamedll-build -f Dockerfile.regamedll .</pre>
24 +<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>
25 +
26 +<h2>2. Clone with submodules</h2>
27 +<pre>mkdir -p ~/build &amp;&amp; cd ~/build
28 +git clone --recursive https://github.com/s1lentq/ReGameDLL_CS.git
29 +cd ReGameDLL_CS</pre>
30 +<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>
31 +<pre>git submodule update --init --recursive</pre>
32 +
33 +<h2>3. Pin the revision</h2>
34 +<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>
35 +<pre>git tag --sort=-creatordate | head -5
36 +git checkout &lt;tag&gt;
37 +git rev-parse HEAD | tee ../regamedll-commit.txt</pre>
38 +
39 +<h2>4. Compile</h2>
40 +<pre>docker run --rm -it \
41 + -v ~/build/ReGameDLL_CS:/src \
42 + -w /src \
43 + regamedll-build bash</pre>
44 +<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>
45 +<pre>python3 build.py --clean</pre>
46 +<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>
47 +<p>The build produces, among other artefacts:</p>
48 +<pre>cs.so (Linux game library)
49 +game.cfg
50 +game_init.cfg
51 +delta.lst</pre>
52 +<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>
53 +
54 +<h2>5. Check the binary before you trust it</h2>
55 +<pre>file cs.so
56 +ldd cs.so</pre>
57 +<p><code>file</code> must report:</p>
58 +<pre>ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked</pre>
59 +<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>
60 +<p>Confirm the symbol the engine actually asks for is exported:</p>
61 +<pre>nm -D --defined-only cs.so | grep -i GiveFnptrsToDll</pre>
62 +<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>
63 +
64 +<h2>6. Deploy</h2>
65 +<pre>cd /home/steam/hlds/cstrike
66 +cp dlls/cs.so dlls/cs.so.bak
67 +cp /path/to/build/cs.so dlls/cs.so
68 +cp /path/to/build/game.cfg game.cfg
69 +cp /path/to/build/game_init.cfg game_init.cfg
70 +cp /path/to/build/delta.lst delta.lst
71 +chmod 644 dlls/cs.so</pre>
72 +<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>
73 +
74 +<h2>7. Verify on the server</h2>
75 +<pre>./hlds_run -game cstrike +map de_dust2 +maxplayers 20 +sv_lan 0</pre>
76 +<p>Then in the console:</p>
77 +<pre>regamedll_version
78 +meta list</pre>
79 +<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>
80 +
81 +<h2>Common build errors</h2>
82 +<ul>
83 +<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>
84 +<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>
85 +<li><strong>Missing headers under a vendor/submodule path</strong> — you cloned without <code>--recursive</code>.</li>
86 +<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>
87 +</ul>
88 +
89 +<h2>Keep a record</h2>
90 +<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>
0 91