UNIX/Linux Compiling HowTo

Here we speak about Code and Design.
Post Reply
Posts: 61
Joined: Fri Sep 02, 2005 11:39 pm

Post by malign » Tue Sep 12, 2006 5:25 pm


For those interested, we've formulated a walkthrough on getting the CoHEmu sources compiled under a UNIX-like operating system. An equivalent Windows guide should follow soon!

The walkthrough is located on the CoHEmu Trac at the following URL:


I will also list it below so it's available in multiple locations. I will try to keep both up-to-date as best as possible.


Before we start the compilation phase, you need to make sure you have the following items installed on your *IX operating system:

[b:0fd9a45c6d]1.)[/b:0fd9a45c6d] The Adaptive Communication Environment aka "ACE". You can obtain ACE from your operating system's package management system more than likely. I used the FreeBSD ports sytem to grab mine and compile it from source. If the package is not available for your package management system, you can obtain ACE from the following URL:


I am currently using the ACE-5.5.1.tar.gz ACE only (tar+gzip format) file from the Latest BFO Beta section.

As this is not a tutorial for compiling ACE from source, please see the following URL on how to build and install ACE:

http://www.cs.wustl.edu/~schmidt/ACE_wr ... STALL.html

[b:0fd9a45c6d]2.)[/b:0fd9a45c6d] CMake. This software is very slick indeed. It enables us to maintain multiple Makefiles for multiple platforms (ie, win32, linux, solaris, etc.) Again, you should be able to obtain this from your operating system's package management system. If this is not available, you can obtain CMake from the following URL:


We are currently using the latest release (2.4.3). You can probably save yourself the trouble of compiling this tool because CMake offers many pre-compiled binaries for various hardware architectures and software platforms. They even have a handy Windows installer. Even though this is not a Windows compilation howto, I thought that was worth mentioning.

[b:0fd9a45c6d]3.)[/b:0fd9a45c6d] Boost. Boost is a set of portable C++ libraries. You can obtain Boost here:

http://sourceforge.net/project/showfile ... e_id=72941

The Boost site with documentation is here:

http://www.boost.org/more/getting_start ... reparation

[b:0fd9a45c6d]4.)[/b:0fd9a45c6d] libpq. This PostGreSQL library contains the headers and libraries necessary to build software that needs to speak to PostGreSQL database servers. CoHEmu uses this library to store persistent information such as account (username and password) and character data (hair colour, height, level, power sets, etc.) Again, if your package management system does not have this available, you can obtain libpq from the following URL:


We are currently using the PostGreSQL 8.1.4 tarball. This tarball includes libpq along with some other PostGreSQL components. You can fine-tune your install by messing with the ./configure script options.

Here is the URL to compile and install PostGreSQL:

http://www.postgresql.org/docs/8.1/inte ... ation.html

[b:0fd9a45c6d]5.)[/b:0fd9a45c6d] SWIG (optional for now.) This package enables CoHEmu to mesh with common scripting languages such as Python and Ruby. Right now, we do not make use of SWIG fully. In the future, SWIG will be required to build CoHEmu. Once more, if your package management system (ports, apt, pkgsrc, yast, rpm, portage, etc.) can't get this for you, SWIG can be obtained from the following URL:


Additionally, compile and installation instructions can be found here:


If you feel you would like to help out the project, you can probably help extend CoHEmu support for more scripting languages and convert any existing script to the new experimental language.

[b:0fd9a45c6d]6.)[/b:0fd9a45c6d] make/gmake. Used as a blueprint to the compiler and linker to tell them how to build CoHEmu. These commands will need to be run to create CoHEmu binaries after CMake generates a Makefile for your platform. Your operating system base install should include this command. If it does not, you might as well place some C4 inside your machine and detonate it because it's essentially useless anyways.

But if you still see some hope in your box, you can redeem it by acquiring make from the following URL:


[b:0fd9a45c6d]7.)[/b:0fd9a45c6d] c++/g++. Of course you will need this. How else will you compile the sources?

Get it here if your package manager cannot:



Now that all the mandatory items are out of the way, you will need to acquire the source. At present, the only way to acquire the source is by way of a subversion client. If your box cannot get one with its native package system, go here:


Once you have a working svn client, you will need to execute the following command to acquire the sources:

[email protected]:(/home/malign)% svn co svn://svn.cohemu.net/cohemu/
A cohemu/AdminServer
A cohemu/AdminServer/sql
A cohemu/AdminServer/sql/cohemu.sql
A cohemu/AdminServer/include
A cohemu/AdminServer/include/AdminDatabase.h
A cohemu/AdminServer/include/AdminServer.h
A cohemu/AdminServer/src
A cohemu/AdminServer/src/AdminServer.cpp
A cohemu/AdminServer/src/CMakeLists.txt
A cohemu/AdminServer/src/AdminDatabase.cpp
A cohemu/AdminServer/CMakeLists.txt
A cohemu/GameServer
A cohemu/GameServer/include
A cohemu/GameServer/include/CharacterHandler.h
A cohemu/GameServer/include/Walking.h
A cohemu/GameServer/include/Chat.h
A cohemu/GameServer/include/GameServer.h
A cohemu/GameServer/include/GamePacket.h
A cohemu/GameServer/include/GameServerEndpoint.h
A cohemu/GameServer/src
A cohemu/GameServer/src/Chat.cpp
A cohemu/GameServer/src/GameServer.cpp
A cohemu/GameServer/src/GameServerEndpoint.cpp
A cohemu/GameServer/src/CharacterHandler.cpp
A cohemu/GameServer/src/CMakeLists.txt
A cohemu/GameServer/src/DBServer.cpp
A cohemu/GameServer/src/Walking.cpp
A cohemu/GameServer/CMakeLists.txt
A cohemu/output
A cohemu/tools
A cohemu/tools/logger
A cohemu/tools/logger/BitStream.h
A cohemu/tools/logger/BitStream.cpp
A cohemu/tools/packet_tools
A cohemu/tools/packet_tools/packet_tool.rb
A cohemu/tools/packet_tools/packets.xml
A cohemu/MapServer
A cohemu/MapServer/include
A cohemu/MapServer/include/MapHandler.h
A cohemu/MapServer/include/EntityStorage.h
A cohemu/MapServer/include/MapServer.h
A cohemu/MapServer/include/MapPacket.h
A cohemu/MapServer/include/MapServerEndpoint.h
A cohemu/MapServer/src
A cohemu/MapServer/src/EntityStorage.cpp
A cohemu/MapServer/src/MapServer.cpp
A cohemu/MapServer/src/MapServerEndpoint.cpp
A cohemu/MapServer/src/MapHandler.cpp
A cohemu/MapServer/src/CMakeLists.txt
A cohemu/MapServer/src/Entity.cpp
A cohemu/MapServer/CMakeLists.txt
A cohemu/conf
A cohemu/conf/cohemu.cfg
A cohemu/AuthServer
A cohemu/AuthServer/include
A cohemu/AuthServer/include/AuthPacket.h
A cohemu/AuthServer/include/AuthOpcodes.h
A cohemu/AuthServer/include/ClientConnection.h
A cohemu/AuthServer/include/Auth.h
A cohemu/AuthServer/include/AuthClientServicer.h
A cohemu/AuthServer/include/AuthProtocol.h
A cohemu/AuthServer/include/Packets
A cohemu/AuthServer/include/Packets/authloginresponse.h
A cohemu/AuthServer/include/Packets/authlogin.h
A cohemu/AuthServer/include/Packets/authrequestserverlist.h
A cohemu/AuthServer/include/Packets/Smsg_LoginResponse.h
A cohemu/AuthServer/include/Packets/Cmsg_DB_Hello.h
A cohemu/AuthServer/include/Packets/authserverlist.h
A cohemu/AuthServer/include/Packets/authselectserverresponse.h
A cohemu/AuthServer/include/Packets/authversion.h
A cohemu/AuthServer/include/Packets/authselectserver.h
A cohemu/AuthServer/include/AuthFSM.h
A cohemu/AuthServer/include/AuthPacketCodec.h
A cohemu/AuthServer/include/AuthNet.h
A cohemu/AuthServer/include/AuthServer.h
A cohemu/AuthServer/src
A cohemu/AuthServer/src/ClientConnection.cpp
A cohemu/AuthServer/src/Auth.cpp
A cohemu/AuthServer/src/AuthClientServicer.cpp
A cohemu/AuthServer/src/AuthProtocol.cpp
A cohemu/AuthServer/src/main.cpp
A cohemu/AuthServer/src/AuthFSM.cpp
A cohemu/AuthServer/src/AuthPacketCodec.cpp
A cohemu/AuthServer/src/AuthNet.cpp
A cohemu/AuthServer/src/AuthServer.cpp
A cohemu/AuthServer/src/AuthPacket.cpp
A cohemu/AuthServer/src/packets
A cohemu/AuthServer/src/packets/authserverlist.cpp
A cohemu/AuthServer/src/CMakeLists.txt
A cohemu/AuthServer/CMakeLists.txt
A cohemu/Common
A cohemu/Common/include
A cohemu/Common/include/GameProtocolHandler.h
A cohemu/Common/include/stdafx.h
A cohemu/Common/include/BitStream.h
A cohemu/Common/include/GameProtocol.h
A cohemu/Common/include/UDPSocket.h
A cohemu/Common/include/ServerManager.h
A cohemu/Common/include/console.h
A cohemu/Common/include/PacketBase.h
A cohemu/Common/include/CommonNetStructures.h
A cohemu/Common/include/CRUDP_Packet.h
A cohemu/Common/include/Database.h
A cohemu/Common/include/types.h
A cohemu/Common/include/PacketUtil.h
A cohemu/Common/include/PacketCodec.h
A cohemu/Common/include/Server.h
A cohemu/Common/include/ServerEndpoint.h
A cohemu/Common/include/Buffer.h
A cohemu/Common/include/cohemu.h
A cohemu/Common/include/NetManager.h
A cohemu/Common/include/Net.h
A cohemu/Common/include/pigg.h
A cohemu/Common/include/CRUDP_Protocol.h
A cohemu/Common/include/AdminServerInterface.h
A cohemu/Common/include/server_support.h
A cohemu/Common/include/opcodes
A cohemu/Common/include/opcodes/NameTables.h
A cohemu/Common/include/opcodes/Opcodes.h
A cohemu/Common/include/opcodes/ControlCodes.h
A cohemu/Common/include/WinSocket.h
A cohemu/Common/include/Packet.h
A cohemu/Common/include/AuthServerInterface.h
A cohemu/Common/include/ClientManager.h
A cohemu/Common/include/Base.h
A cohemu/Common/include/angelscript.h
A cohemu/Common/include/blowfish.h
A cohemu/Common/include/Client.h
A cohemu/Common/include/log.h
A cohemu/Common/include/GameServerInterface.h
A cohemu/Common/include/MapServerInterface.h
A cohemu/Common/include/version.h
A cohemu/Common/src
A cohemu/Common/src/CRUDP_Protocol.cpp
A cohemu/Common/src/AdminServerInterface.cpp
A cohemu/Common/src/ServerManager.cpp
A cohemu/Common/src/UDPSocket.cpp
A cohemu/Common/src/PacketBase.cpp
A cohemu/Common/src/server_support.cpp
A cohemu/Common/src/Database.cpp
A cohemu/Common/src/CRUDP_Packet.cpp
A cohemu/Common/src/PacketCodec.cpp
A cohemu/Common/src/PacketUtil.cpp
A cohemu/Common/src/WinSocket.cpp
A cohemu/Common/src/ServerEndpoint.cpp
A cohemu/Common/src/swig.so
A cohemu/Common/src/Buffer.cpp
A cohemu/Common/src/AuthServerInterface.cpp
A cohemu/Common/src/swig.cpp
A cohemu/Common/src/blowfish.c
A cohemu/Common/src/Client.cpp
A cohemu/Common/src/swig.i
A cohemu/Common/src/cohemu.cpp
A cohemu/Common/src/NetManager.cpp
A cohemu/Common/src/GameServerInterface.cpp
A cohemu/Common/src/log.cpp
A cohemu/Common/src/MapServerInterface.cpp
A cohemu/Common/src/Net.cpp
A cohemu/Common/src/pigg.cpp
A cohemu/Common/src/GameProtocolHandler.cpp
A cohemu/Common/src/BitStream.cpp
A cohemu/Common/src/GameProtocol.cpp
A cohemu/Common/src/Opcodes.cpp
A cohemu/Common/src/CMakeLists.txt
A cohemu/Common/CMakeLists.txt
A cohemu/docs
A cohemu/docs/License.txt
A cohemu/docs/Authors.txt
A cohemu/docs/ToDo.txt
A cohemu/docs/FAQ.txt
A cohemu/docs/ReadMe.txt
A cohemu/docs/Bugs.txt
A cohemu/CMakeLists.txt
Checked out revision 258.
[email protected]:(/home/malign)%

This will talk to the svn server and grab all of the CoHEmu sources.

Once you have the sources, traverse to the newly created "cohemu" directory:

[email protected]:(/home/malign)% cd cohemu
[email protected]:(/home/malign/cohemu)%

Once you are within this directory, execute ccmake to create a Makefile for your target platform:

[email protected]:(/home/malign/cohemu)% ccmake .

The '.' tells CMake that the sources are in the current working directory.

This command will bring up a menu interface (you can also simply use "cmake .", but the menu interface is certainly more intuitive.) Type 'c' to configure CMake to locate necessary tools, headers and libraries for CoHEmu. If the paths look OK for PGSQL_lib, PGSQL_path, ACE_lib, ACE_path and so on, press the 'g' key to generate the makefile. If they are not OK, use the up/down arrow keys to hover over each path and press the "enter" key to modify the variable. Once you have typed in the correct path to the include files or library, hit "enter" again to save the new location. Then try 'g' to generate your makefile.

After creating the makefile, CMake will exit the menu interface and you will be back at the command prompt and hopefully with your newly created makefile in current directory.

Simply issue "make" or "gmake" depending on which command your host uses to start the compile phase:

[email protected]:(/home/malign/cohemu)% make
[ 2%] Building CXX object Common/src/CMakeFiles/cohemu_common.dir/AdminServerInterface.o
[ 5%] Building CXX object Common/src/CMakeFiles/cohemu_common.dir/AuthServerInterface.o
[ 7%] Building CXX object Common/src/CMakeFiles/cohemu_common.dir/BitStream.o
[ 10%] Building C object Common/src/CMakeFiles/cohemu_common.dir/blowfish.o
[ 13%] Building CXX object Common/src/CMakeFiles/cohemu_common.dir/Buffer.o
[ 15%] Building CXX object Common/src/CMakeFiles/cohemu_common.dir/CRUDP_Packet.o
[ 18%] Building CXX object Common/src/CMakeFiles/cohemu_common.dir/CRUDP_Protocol.o

If all goes well, you will have new CoHEmu project binary(s). There should be one module for each server (authserver for now until the other modules are in the works.) In the future, there will be multiple server modules (authserver, mapserver, adminserver, gameserver, ...)

I hope this guide helps a bit. In the near future, we should have a guide pumped out for all those out there using Windows. Please feel free to recommend any changes to this guide to us in IRC or on the forum.


Posts: 61
Joined: Fri Sep 02, 2005 11:39 pm

Post by malign » Sat Sep 16, 2006 3:51 pm

09/16/2006: Added Boost library to prerequisites section.

This change has been made to both the forum and the trac compile guide.

Thank you Potajito and barbo for pointing this out.


Posts: 3
Joined: Fri Jan 27, 2006 12:38 pm

Post by wad » Mon Sep 18, 2006 11:17 am

you forget about zlib installation.

Posts: 61
Joined: Fri Sep 02, 2005 11:39 pm

Post by malign » Tue Sep 19, 2006 4:12 pm

Thanks, wad. I overlooked zlib as it's included in most default installs. I'll update the guide in a bit.


Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest