You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Alibek Omarov 5af7a19b40 Rename contib to contrib 4 years ago
Makefile.linux Rename contib to contrib 4 years ago Rename contib to contrib 4 years ago Rename contib to contrib 4 years ago
wscript Rename contib to contrib 4 years ago

Table of Contents generated with DocToc


Manual build (without CMake)

Building engine

Clone Xash3D repository using git:

git clone

Move to the Xash3D folder:

cd xash3d/engine

make -f Makefile.linux XASH_VGUI=1

or same for dedicated

make -f Makefile.linux XASH_DEDICATED=1

To enable dll support on linux, build loader library:

cd ../loader
make -f Makefile.linux libloader.a
cp libloader.a ../engine/

And built engine with XASH_DLL_LOADER=1:

cd ../engine
make -f Makefile.linux XASH_VGUI=1 XASH_SDL=1 XASH_DLL_LOADER=1

or same for dedicated server

cd ../engine
make -f Makefile.linux XASH_DEDICATED=1 XASH_DLL_LOADER=1

Building engine in separate library

Some old distros does not support hidden symbol visibility This results in crash when loading server library

Building launch binary

cd (xash3d)/game_launch
gcc xash.c -o xash -ldl -lrt -lm

Building engine library:

make -f Makefile.linux XASH_SINGLE_BINARY=0

Building on Windows

Download latest prebuilt SDL2 from

Unzip and rename SDL2-2.0.4 folder to SDL2 and put it next to xash3d project folder.


Open xash.sln with Visual Studio 2013 and make a build. After building, copy contents of Debug or Release folder to directory you choose. Copy valve folder and vgui.dll from your Half Life game installation folder and SDL2.dll form \SDL2\lib\x86\ to it. Move vgui_support.dll into valve folder.


Now you good to go, just run xash.exe.

Visual Studio 6

This is legacy configuration, but msvc6 seems to generate more stable and more effective code

Setup your msvc6 enviroment, unpack SDL2-2.0.4 to xash3d folder and do:

cd (xash3d)\engine
cd (xash3d)\game_launch


The most effective configuration, but maybe unstable. Setup your MinGW environment and run:

cd (xash3d)\engine\
CC=gcc mingw32-make -f Makefile.mingw

engine will be built to single exe binary

Building game mods



All mods that ported to android may be build to linux using with microndk:


Clone microndk repo somewhere, change xash3d_config to preffered configuration (change arch to x86 for example)

Go to dlls folder if you are building server or cl_dlls if you are building client and do:

make -f /path/to/microndk/ -j4


make -f /path/to/microndk/ -j4 clean

every time when you build client after building server



On windows common way is using Visual Studio as many mods does not correctly work with mingw.

Just open project and build it.

Other is using mingw and microndk, but it was not tested yet.

hlsdk-xash3d based mods may work fine with mingw.

You may use microndk to build it. Build process is very similar to linux one.

After setting up MinGW enviroment, do:
mingw32-make -f \path\to\microndk\

to build 64-bit library, use:
mingw32-make -f \path\to\microndk\ 64BIT=1

Edit to set optimal CFLAGS if you are running server


Copy valve folder from Half-Life:

cp -r $HOME/.steam/steam/steamapps/common/Half-Life/valve $HOME/Games/Xash3D

NOTE: If you build with CMake, you can now use make install. It will install binaries where they must be located. So just run xash3d from command line in directory where is gamedata is located. For additional info look to the CMakeLists.txt in repo root and script.

After a successful build, copy the next files to some other directory where you want to run Xash3D:

cp engine/ game_launch/xash3d mainui/ $HOME/Games/Xash3D

If you built it with XASH_VGUI, also copy

cp ../hlsdk/linux/ vgui_support/ $HOME/Games/Xash3D

Copy script:

cp ../ $HOME/Games/Xash3D


cd $HOME/Games/Xash3D

Manual running

Put xash3d binaries and vgui(optionally) to you game data directory and run:

LD_LIBRARY_PATH=. ./xash -dev 5

Running under GDB

LD_LIBRARY_PATH=. gdb --args ./xash -dev 5

Using DLL Loader

Put vgui_support.dll from windows build to your game data folder and run:

LD_LIBRARY_PATH=. ./xash -dev 5 -vguilib vgui.dll -clientlib valve/cl_dlls/client.dll -dll dlls/hl.dll

Running MinGW builds

Put exe file to your game data directory

cd (game)\
xash_bin -dev 5

Running MinGW builds under GDB

gdb --args ./xash_bin.exe -dev 5

Useful GDB commands

Start or restart process:

(gdb) r

Show backtrace:

(gdb) bt

Full backtrace:

(gdb) bt full

Continue execution:

(gdb) c

Recover from segmentation fault:

Skipping function:

(gdb) handle SIGSEGV nopass
(gdb) ret
(gdb) c

Restart frame for beginning:

(gdb) handle SIGSEGV nopass
(gdb) jump *Host_AbortCurrentFrame

Anti-Crash script (useful for scripting servers):

cd /path/to/rootdir
file xash
set args xash -dev 5 -nowcon
handle SIGSEGV nopass
catch signal SIGSEGV
set $crashes=0
print $crashes++
if $crashes > 500
set $crashes=0
jump *Host_AbortCurrentFrame