Compiling under Linux

From Valve Developer Community
Jump to navigation Jump to search

To have a successful multiplayer mod a Linux version of your server is a must. Much of the grunt work of getting a Linux server binary created has been automated. This document describes the environment and configuration needed to get you going with a Linux port.

Requirements

The following tools are required to compile the SDK under Linux.

Slackware 10.0 ( http://www.slackware.org/ ) is a good starting base to create your compiling environment.

Setting up the Makefile

As part of the compile process the Microsoft Visual C Project file used to compile your mod under Windows is converted into a snippet of a Makefile. This conversion process needs to be seeded with a few configuration parameters, all of which are contained in linux_sdk/Makefile. At a minimum you should configure these parameters (note, don't use "~" for your home directory since parts of the make process will not understand it):

  • MOD_PROJ, this is the filename of the Windows project file used to compile your mod.
  • MOD_CONFIG, the configuration set to use when compiling the Linux version of your mod. Typically this is the Release Win32 option. The easiest method to determine this parameter is to leave it at default, run the make process once and then look at the Makefile snippets that are produced and select the appropriate one.
  • GAME_DIR, the path to an installation of the game. The Makefile says "the directory the base binaries (tier0_i486.so, etc) are located" but actually it wants one level up from the directory with tier0_i486.so.
  • CC, CPLUS, CLINK, CPP_LIB, these parameters should be pointed to your particular install of GCC 3.4.1.
  • XERCES_INC_DIR, XERCES_LIB_DIR, the installation directory of the Xerces library.


Once these configuration parameters are set compiling your mod should be a simple as running:

make

I had to do "export LD_LIBRARY_PATH=~/source/bin" before vcpm would run. --Bloodykenny 19:36, 5 Sep 2005 (PDT)

This will compile the vcpm program, run this against your VCProject file and then use the resulting Makefile snippet and the configuration parameters you set above to compile your mod.

Running your Mod

To run the mod copy the file produced by the make process to <mod dir>/bin/server_i486.so and then run srcds_run with the appropriate -game parameter.