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
- Debian/Ubuntu 32-bit
- Debian/Ubuntu 64-bit
- Arch Linux
Install Dependencies
Install the required build tools and libraries:
The
build-essential package includes GCC, G++, make, and other essential compilation tools.Compile the Server
Navigate to the source directory and run the build script:The script will:
- Compile all C source files with
-m32flag - Assemble NASM files to ELF format
- Link everything into
bin/cod4u_lnx - Clean up intermediate object files
Windows Installation
Install MinGW32
Download and install MinGW32 (Minimalist GNU for Windows):
- Visit mingw.org
- Install the 32-bit version with GCC compiler
- Add MinGW’s
bindirectory to your PATH
Install NASM
Download NASM for Windows:
- Visit nasm.us
- Install to
%LOCALAPPDATA%\nasmor add to PATH
The build script automatically adds
%LOCALAPPDATA%\nasm to the PATH if NASM is installed there.Install OpenSSL
Download and install Win32 OpenSSL:
- Visit slproweb.com/products/Win32OpenSSL.html
- Download Win32 OpenSSL v1.1.1g or later (not the Light version)
- Install with default options
Compile the Server
Open Command Prompt in the source directory and run:The build process will:
- Set up the NASM path
- Compile C sources with
-m32 -march=nocona -D WINVER=0x501 - Assemble NASM files to COFF format with
--prefix _ - Link with Windows-specific libraries (ws2_32, wsock32, gdi32, winmm)
- Create plugin export library
- Clean up object files
Build Script Details
Compiler Flags Explained
Compiler Flags Explained
-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
Error: cannot find -lcurl
Error: cannot find -lcurl
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
Error: nasm: command not found
Error: nasm: command not found
Problem: NASM is not installed or not in PATH.Solution:
- Linux:
sudo apt-get install nasm:i386orsudo pacman -S nasm - Windows: Install NASM and add to PATH or place in
%LOCALAPPDATA%\nasm
Error: gcc: error: unrecognized option '-m32'
Error: gcc: error: unrecognized option '-m32'
Problem: 32-bit compilation support is not enabled (64-bit Linux).Solution:
Windows: Missing DLL errors when running
Windows: Missing DLL errors when running
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.