Compiling under Linux: Difference between revisions
| TomEdwards (talk | contribs) m (→Requirements) | m (added a comma that helps with sentence flow) | ||
| Line 9: | Line 9: | ||
| == Getting Linux == | == Getting Linux == | ||
| If you are unsure which version of Linux to use go for [http://www.ubuntu.com/ Ubuntu], which tries to be user-friendly. It has a "software centre" that makes installing packages simple, and can be run from a CD if you want to experiment (but you'll want to install it permanently before you start digging in). | If you are unsure which version of Linux to use, go for [http://www.ubuntu.com/ Ubuntu], which tries to be user-friendly. It has a "software centre" that makes installing packages simple, and can be run from a CD if you want to experiment (but you'll want to install it permanently before you start digging in). | ||
| == Requirements == | == Requirements == | ||
Revision as of 16:12, 4 February 2015
Creating a Linux build of your multiplayer dedicated server or server plugin is not required, but does make it much more likely to be accepted by commercial server operators.
 Note:This page assumes you are building for Source 2007 (Orange Box).
Note:This page assumes you are building for Source 2007 (Orange Box).Building on Linux requires an existing Visual Studio project, which is converted to a makefile by Valve's vcpm tool ("Visual C++ Project to Make").
Getting Linux
If you are unsure which version of Linux to use, go for Ubuntu, which tries to be user-friendly. It has a "software centre" that makes installing packages simple, and can be run from a CD if you want to experiment (but you'll want to install it permanently before you start digging in).
Requirements
- GCC and G++ 4.2.x or lower
- Vprojtomake 2010 or Xerces XML parser 2.8.x
- libstdc++6
- libc2.4 or higher
If you are running 64-bit Linux:
- ia32-libs(or you will be told that 32-bit binaries don't exist)
- GCC multilib for your GCC release
- Make sure you have the 32-bit build of Xerces, if you haven't upgraded to Vprojtomake 2010.
Setting up
 Bug:Don't use
Bug:Don't use ~ for your home directory. Parts of the make process do not understand it.  [todo tested in ?]Open sdk_root/linux_sdk/Makefile. Most of the config options here are straightforward, except for:
- MOD_CONFIG
- These values should come straight out of your VS project. Remove all whitespace. To build the 'My Server' project in release mode, this should read MyServer_ReleaseWin32.
- GAME_DIR
- To get this, you need to download a dedicated server from Valve. You need the orangeboxgame.
- CC,- CPLUS,- CLINK
- Change these to read "gcc -m32" or "g++ -m32", with quotes. If your system's default build of GCC is too recent, specify an older version with "gcc-4.2 -m32" or similar; check /usr/binto see what you've got installed.
- CPP_LIB
- These files may not be where Valve think they are. To find them, browse to /usr/liband search. 64-bit users will encounter two version of each file; choose the ones in the '32' folder.
- Server plugins need extra configuration. See Server_plugins#Compiling.
- Experienced GCC programmers may be interested in Getting the SDK to work under -Wall -Werror.
Making
Once everything is configured correctly, you can build your mod by navigating to the linux_sdk folder and performing a make.
 Note:If you've done a lot of development on Windows you are likely to encounter "No such file or directory" or "no rule to make target" errors (if you get a mess of errors, scroll up to the very first one). These should all be down to two easily-rectified issues:
Note:If you've done a lot of development on Windows you are likely to encounter "No such file or directory" or "no rule to make target" errors (if you get a mess of errors, scroll up to the very first one). These should all be down to two easily-rectified issues:
- Paths are case-sensitive in Linux. /Multiplayeris not the same as/multiplayer
- Paths must delimited with /characters in Linux, not Windows'\.
Running
To run the mod perform make install to copy the server binary to your mod's folder, then cd into your dedicated server folder and do ./srcds_run with the appropriate -game parameter.