Skip to main content

Prerequisites

Before compiling CoD4 Unleashed Server, ensure you have the required tools and libraries installed for your platform.

Required Tools

Compiler

GCC (Linux) or MinGW32 (Windows)

Assembler

NASM

HTTP Library

libcurl with OpenSSL

Linux Installation

1

Install Dependencies

Install the required build tools and libraries:
sudo apt-get install nasm build-essential libcurl4-openssl-dev
The build-essential package includes GCC, G++, make, and other essential compilation tools.
2

Compile the Server

Navigate to the source directory and run the build script:
./build_elf.sh
The script will:
  1. Compile all C source files with -m32 flag
  2. Assemble NASM files to ELF format
  3. Link everything into bin/cod4u_lnx
  4. Clean up intermediate object files
3

Verify Installation

Check that the server binary was created successfully:
ls -lh bin/cod4u_lnx
You should see the compiled server executable in the bin directory.

Windows Installation

1

Install MinGW32

Download and install MinGW32 (Minimalist GNU for Windows):
  • Visit mingw.org
  • Install the 32-bit version with GCC compiler
  • Add MinGW’s bin directory to your PATH
2

Install NASM

Download NASM for Windows:
  • Visit nasm.us
  • Install to %LOCALAPPDATA%\nasm or add to PATH
The build script automatically adds %LOCALAPPDATA%\nasm to the PATH if NASM is installed there.
3

Install OpenSSL

Download and install Win32 OpenSSL:
Make sure to install the 32-bit version, not the 64-bit version. The server requires 32-bit libraries.
4

Compile the Server

Open Command Prompt in the source directory and run:
build_win32.cmd
The build process will:
  1. Set up the NASM path
  2. Compile C sources with -m32 -march=nocona -D WINVER=0x501
  3. Assemble NASM files to COFF format with --prefix _
  4. Link with Windows-specific libraries (ws2_32, wsock32, gdi32, winmm)
  5. Create plugin export library
  6. Clean up object files
5

Verify Installation

Check that bin/cod4u_win32.exe was created successfully:
dir bin\cod4u_win32.exe

Build Script Details

# Compile C code with 32-bit, debug symbols, and CoD4U flags
gcc -m32 -Wall -O0 -g -fno-omit-frame-pointer -mtune=nocona \
    -D COD4U -I../lib_tomcrypt/headers \
    -I../lib_tomcrypt/math/tommath -D _GNU_SOURCE \
    -c ../src/*.c

# Assemble platform hooks
nasm -f elf src/qcommon_hooks.asm -o bin/qcommon_hooks.o
nasm -f elf src/cmd_hooks.asm -o bin/cmd_hooks.o
nasm -f elf src/filesystem_hooks.asm -o bin/filesystem_hooks.o
# ... more hooks

# Link with custom linker script
gcc -m32 -rdynamic -Tlinkerscript.ld -o bin/cod4u_lnx bin/*.o \
    -Llib/ -lcurl -ltomcrypt_linux -ltommath_linux \
    -ldl -lpthread -lm -lstdc++
  • -m32 - Compile for 32-bit architecture
  • -Wall - Enable all compiler warnings
  • -O0 - No optimization (for debugging)
  • -g - Include debug symbols
  • -fno-omit-frame-pointer - Keep frame pointer for better stack traces
  • -mtune=nocona / -march=nocona - Optimize for Intel Nocona architecture
  • -D COD4U - Define COD4U preprocessor macro
  • -D _GNU_SOURCE - Enable GNU extensions (Linux)
  • -D WINVER=0x501 - Target Windows XP SP3+ (Windows)

Troubleshooting

Problem: libcurl development files are not installed or not found.Solution:
  • Linux: Install libcurl4-openssl-dev:i386
  • Windows: Ensure libcurl is in the lib/ directory
Problem: NASM is not installed or not in PATH.Solution:
  • Linux: sudo apt-get install nasm:i386 or sudo pacman -S nasm
  • Windows: Install NASM and add to PATH or place in %LOCALAPPDATA%\nasm
Problem: 32-bit compilation support is not enabled (64-bit Linux).Solution:
sudo apt-get install gcc-multilib g++-multilib
Problem: OpenSSL DLLs are not found at runtime.Solution:
  • Ensure Win32 OpenSSL is properly installed
  • Copy required DLLs to the bin/ directory
  • Add OpenSSL installation directory to PATH

Next Steps

Quick Start Guide

Now that you’ve compiled the server, learn how to configure and launch it.

Build docs developers (and LLMs) love