This document describes how to build and install the Crossfire server from source.
Instructions for building the client are on a separate page.
It's likely that many of these packages (listed alphabetically) are already installed on your system, but this list is a way to make sure. It's important to have all the right packages in place before attempting any builds or compiles.
As a quick reference:
sudo apt-get install automake flex gcc g++ git libgd-dev libgd-tools libtool make python3-dev
A special note about installing python. The package listed above, python3-dev, should install the necessary packages to enable many of the in-game features (ship transportation, guilds, post office, et al.) to work.
However, if python related features are not working, then installing python depends on your choice of Linux distro.
As an example, this is what you would use to install python on Ubuntu Focal:
sudo apt-get install python3-dev
To confirm python is fully installed on Ubuntu Focal:
$ python3
And you should see output like:
Python 3.8.10 (default, Jun 2 2021, 10:49:15) [GCC 9.4.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>>
If you see something like the above, python is installed, use ctrl-d to quit python.
The recommended packages provide additional add-ons or features (summaries included, below) to the server or as a way to test new functions and features.
As a quick reference:
sudo apt-get install check autoconf libsqlite3-0 libpython3.8 libcurl4 libcurl4-openssl-dev libsvn-dev
These useful packages are not normally required for end-user builds, but they come in handy in cases where developers may have forgotten to check in changes to build scripts, etc.
A quick reference for Debian 10
sudo apt install flex libcurl4 libcurl4-openssl-dev libgd-dev libgd-tools libsvn-dev libtool python3-dev subversion
- The actual compile process requires directory and file ownership changes when finished. Also, there appears to be some complications with having to run ./configure first or sh autogen.sh command. Those steps need to be documented here.
- placeholder for future update
A quick reference for Fedora 33
sudo dnf install flex libcurl libcurl-devel libtool make python3 python3-devel subversion subversion-devel
After compiling the server (sh autogen.sh && make && sudo make install) you will also need to run the following command - but make sure to change <username> to the correct login name for you setup:
sudo chown -R <username>.<username> /usr/games/crossfire/
A quick reference for Fedora 34
sudo dnf install flex g++ git libcurl libcurl-devel libtool make python3 python3-devel
After compiling the server (sh autogen.sh && make && sudo make install) you will also need to run the following command - but make sure to change <username> to the correct login name for you setup:
sudo chown -R <username>.<username> /usr/games/crossfire/
A quick reference for Fedora 36
sudo dnf install flex g++ git libcurl libcurl-devel libtool make python3 python3-devel
After compiling the server (sh autogen.sh && make && sudo make install) you will also need to run the following command - but make sure to change <username> to the correct login name for you setup:
sudo chown -R <username>.<username> /usr/games/crossfire/
A quick reference for Linux Mint Tina (19.2)
sudo apt-get install automake flex gcc libgd-dev libgd-tools libtool make python-dev subversion check autoconf libsqlite3-0 libcurl4 libcurl4-openssl-dev libsvn-dev
A quick reference for Linux Mint Tricia (19.3)
sudo apt-get install autotools-dev automake libcurl4-openssl-dev libtool python-dev subversion
- Instructions need to be updated now for Python-3 and git
- Instructions need to be updated now for Python-3 and git
- Instructions need to be updated now for Python-3 and git
The dependency and instructions for the listed versions of Ubuntu includes or applies to all the different flavours including:
A quick reference for Ubuntu 18.04 LTS (Bionic Beaver)
sudo apt-get install automake autoconf check flex gcc git libgd-dev libcurl4 libcurl4-openssl-dev libgd-tools libsqlite3-0 libtool make python3 python3-dev
Ubuntu 20.04 no longer support Python 2, so it is very important that Python 3 is installed.
Crossfire server relies heavily on Python for functions such as the message boards, post office, certain quests, gates & passwords, etc.
sudo apt-get install check autoconf git libsqlite3-0 libcurl4 libcurl4-openssl-dev libsvn-dev python3-dev
A quick reference for Ubuntu 22.04 LTS (Jammy Jellyfish)
sudo apt-get install autoconf automake check flex g++ gcc git libcurl4 libcurl4-openssl-dev libgd-dev libgd-tools libsqlite3-0 libtool make python3-dev
This is the starting point and confirms you are located in your home directory
$ pwd /home/<username>
IMPORTANT - One should be consistent with what they check out; meaning use all trunk server & archetypes & maps or tags/1.75.0 server & archetypes & maps otherwise you run the risk of incompatibilities (broken maps, missing graphics, etc.)
The follow steps will download the necessary files to your computer, which will be used to compile (or build) the server.
$ git clone https://git.code.sf.net/p/crossfire/crossfire-arch crossfire-crossfire-arch $ git clone https://git.code.sf.net/p/crossfire/crossfire-maps crossfire-crossfire-maps $ git clone https://git.code.sf.net/p/crossfire/crossfire-server crossfire-crossfire-server
Here's the download URLs for Tag releases and is using the 1.75.0 release as an example
NOTE: The server download already contains the Archetypes, so that is why the URL for that file set is not listed
FIXME - Setup steps were recently (2021-Aug-06) updated for git commands, use with caution until they are further tested and verified
In the command line window or terminal, this confirms that you are still in your home directory
$ pwd /home/<username>
Now change directory (hence the cd) to the directory that contains the server files
$ cd crossfire-crossfire-server
This confirms that you are in the server directory
$ pwd /home/<username>/crossfire-crossfire-server
Now change directory again to the lib folder
$ cd lib
Make sure you are in the correct directory with the pwd command
$ pwd /home/<username>/crossfire-crossfire-server/lib
This step “links” two directories to each other which makes the compile process more automated
$ ln -s /home/<username>/crossfire-crossfire-maps/ maps
This step “links” two directories to each other which makes the compile process more automated and is used by the server once Crossfire server is up and running. This links the server to the map files which you downloaded earlier.
Next, create the necessary directory tree for the game files with this command:
$ sudo mkdir -p /usr/games/crossfire/share/crossfire $ sudo chown -R <username>.<username> /usr/games/crossfire/
What that does, is it creates a directory located here: /usr/games/crossfire/share/crossfire and changes the ownership of this directory to your user
Now this step “links” two directories to each other which makes the compile process more automated
$ ln -s /home/<username>/crossfire-crossfire-maps /usr/games/crossfire/share/crossfire/maps
Double check again that you are in the correct directory
$ pwd /home/<username>/crossfire-crossfire-server/lib
This step “links” two directories to each other which makes the compile process more automated. This links the arch or archetype files to the server files which you downloaded earlier.
$ ln -s /home/<username>/crossfire-crossfire-arch ./arch
Make sure you have the maps and archetype directories properly linked by using this command:
$ ls -la
You will see multiple lines of output, but these are the two important ones you are looking for:
arch -> /home/<username>/crossfire-crossfire-arch/ maps -> /home/<username>/crossfire-crossfire-maps/
Go back another directory
$ cd ..
Double check that you are in the correct directory which is the server directory
$ pwd /home/<username>/crossfire-crossfire-server
Code update (~2007-Mar-30) changed the build process for the server; use the following command in the server root directory:
$ sh autogen.sh && make && sudo make install
autogen.sh script re-creates the configure (./configure) script while the rest of the command starts the compile (build) process. Pass the same options to autogen.sh as you would normally pass to ./configure since autogen.sh calls ./configure. This command requires both autoconf and automake to be installed.
(Otherwise do the following, and look below for optional arguments to autogen.sh) Now you are going to begin the compile process; choose one of the following:
$ ./configure && make && make install
Any missing dependencies, errors or similar problems during the compile process will be listed. Each should be addressed or resolved accordingly.
Optional: If you want to have more useful debugging information in case of crashes, set the CFLAGS environment variable to disable optimization (-O0) and enable debugging (-g): That is a uppercase letter O and a zero
$ CFLAGS="-O0 -g" ./configure && make && make install
Optional: For even more gdb debugging information, add -ggdb3 to the command
$ CFLAGS="-O0 -ggdb3" ./configure && make && make install
Optional: To disable the unit test or check when compiling the server, use ./configure –disable-check
$ ./configure --disable-check && make && make install
Optional: To enforce the unit test or check when compiling the server, use make -k check
$ ./configure && make -k check && make install
Optional: If you have modified any archetypes use:
$ cd lib && rm archetypes && make archetypes && cd .. && sh autogen.sh && make && sudo make install
More information at: Testing Archetypes
Once the server has been successfully built (aka compiled), you need to launch the Crossfire Server application
Double check that you are in the correct directory which is the server directory
$ pwd /home/<username>/server.svn
Change directory the server directory
$ cd server
Your file directory path should look like this:
$ pwd /home/<username>/server.svn/server
Just before launching it is worth while just to make sure all the permissions are correct for the server. If not, the server will not be able to write and characters will not be saved. To do so re-run:
$ sudo chown -R <username>.<username> /usr/games/crossfire/
Run this command to launch the server:
$ ./crossfire-server &
What that command will do is run the Crossfire server and return you back to bash or shell prompt
This is the same as running it from your install directory which is typically /usr/games/crossfire/:
$ /usr/games/crossfire/bin/crossfire-server &
If crossfire-server is unable to locate the maps file it may be because the chown command didn't work. You may see an error like:
[EE] Cannot open /usr/games/crossfire/var/crossfire/clockdata for writing [EE] Couldn't read regions file from "/usr/games/crossfire/share/crossfire/maps/regions.reg". [EE] Please check that your maps are correctly installed.
A simple fix is to:
$ sudo chown -R <username>.<username> /usr/games/crossfire/ $ ln -s /home/crossfire/maps.svn /usr/games/crossfire/share/crossfire/maps
Note, great care should be taken in using chown -R as this will change all permissions in the parent directory (e.g. if you “ $ sudo chown -R <username>.<username> /” you will break your linux install's permissions completely)
A permission error such as this:
[EE] /usr/games/crossfire/var/crossfire/clockdata.tmp: Permission denied
Can be fixed by running this command again, be sure to correctly replace the <username> reference with the user who will be launching the server:
$ sudo chown -R <username>.<username> /usr/games/crossfire
A message about a missing accounts directory can be ignored because no player files or accounts have been created yet.
[II] Warning: Unable to open /usr/games/crossfire/var/crossfire/accounts [No such file or directory]
This might be a good time to setup crossloop .
To update an existing install to the latest svn image;
This confirms that you are still in your home directory
$ pwd /home/<username>
Now change directory (hence the cd) to the directory that contains the server files
$ cd server.svn
This confirms that you are in the server directory
$ pwd /home/<username>/server.svn
This updates the directory using svn
$ svn update
repeat for
maps.svn arch.svn
and repeat section “COMPILE”
Sometimes additional steps are required to compile the server after major development or code changes. Under most cicrcumstances, these steps are not needed. Bu they are being documented here just in case.
Listed below are some of thoes steps:
Change directories to server.svn/lib
$ cd server/lib
Then run
$ make do-collect
Then change back to the server.svn directory
$ cd ..
Make sure you are in the server.svn directory
$ pwd /home/<username>/server.svn
Repeat the steps listed under “COMPILE”
Make sure you are in the server.svn directory
$ pwd /home/<username>/server.svn
Run the autoreconf command
$ autoreconf -i
Repeat the steps listed under “COMPILE”
Make sure you are in the server.svn directory
$ pwd /home/<username>/server.svn
Run the clean command
$ sudo make clean
Repeat the steps listed under “COMPILE”
Warning this information may be out of date
To access the latest version of crossfire from sourceforge, a Windows compatible tool to access the source files is called tortoisesvn which is available here.
The interface is built into the windows environment, to access the repository create a new folder such as “crossfire files” and right click on this folder. You will see the following option menu now available:
Select “Repo-browser”. When asked, use this URL: https://svn.code.sf.net/p/crossfire/code
After a short time you should now see a window with the current directory structure of crossfire.
You can now start checking out directories you are interested in. Note: that the branches (trunk, stable etc) are within these directories so do not check-out from the root directory unless you want to download _everything_. To checkout a directory simply right click and select checkout:
and then choose where to save the downloaded files:
The following tools are used to compile the server:
common/loader.c
and random_maps/reader.c
from their respective .l. Syntax is: flex -oloader.c -i loader.l
, flex -oreader.c -i -P rm reader.l
respectively. The -P rm
seems to be required to not have duplicate symbol issuespthreadVC2.dll
, zlib1.dll
, libcurl.dll
libcurl.lib
and pthreadVC2.lib
(project settings → link → general → object/library modules)make_win32
directory, run the installwin32.bat
file. It will create required directoriesThe following tools are used to compile the client:
libpng.lib
to png.lib
). Don't ask why here, ask Glade/GTK+ project instead :)undef HAVE_SDL
, comment out lines, add files, and such). That may be fixed or not eventually.It may be possible to cross-compile Windows binaries from Unix.
Visit the server hosting page for information on setting up a server.