Professional Documents
Culture Documents
Build Instructions
Build Instructions
This page describes how to install the latest development version of the code. This
may be **unstable** and is intended for those that want to actively follow or
contribute to the software development. **To install the latest alpha release,
[https://play0ad.com/download Download the Latest Alpha] instead.**
The development version of the game is aimed at software developers (not regular
players). As such, these instructions assume a higher level of technical
proficiency. If you encounter difficulties, please consult the
[https://www.wildfiregames.com/forum/index.php?showforum=312 forum].
== System requirements ==
You'll need:
== Introduction ==
The development environment for 0 A.D. is comprised of three layers. Each goes on
top of the previous:
1. Libraries.
2. Workspaces.
3. Source code.
Libraries are external dependencies (such as SpiderMonkey). For Windows and Linux,
the script to create or update the Workspaces also handles installation and
updating of libraries. For macOS, the `libraries/osx/build-osx-libs.sh` script
should be used instead.
Workspaces contain the integrations for code editors (such as Visual Studio, Xcode,
etc.) as well as the Makefile for the main source code. The workspaces are auto-
generated by the `update-workspaces` script from the `buids/workspaces/` directory.
Once ready, the integrations are ready for use, such as
`build/workspaces/gcc/Makefile` (for Linux and macOS) and `build\workspaces\vc2015`
(for Windows).
Finally, the source code is build by the workspace. For example, by running `make`
in `build/workspaces/gcc`.
== Windows ==
The main supported versions are:
* Windows 10
* Windows 8.1
* Windows 8
* Windows 7
'''Important notes:'''
* We have dropped support for older versions of Visual Studio when moving to C+
+11, see #2669.
* XP and Vista are supported as targets, but not for installing Visual Studio
2015.
* Only 32-bit builds are supported, though they can be compiled and run on 64-bit
Windows.
The Visual Studio project/solution files are automatically generated from the
source files:
Now you should be able to build the code from within Visual Studio, using "Build
Solution" (F7).
To run the automated tests, run the "test" project. (Right click on "test" and "set
as !StartUp Project" and F5; or right click, "Debug", "Start new instance"). In
VS's debug output window, ignore any "first-chance exception" messages; it should
say ".......OK!" if it succeeded.
* [https://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-dug-update.html
Update] the root directory of the checkout.
* Close the solution in Visual Studio if you've got it open. Run `update-
workspaces.bat` again. (This is only needed if any source files have been added or
removed. If you forget to run this, you'll probably get build errors about missing
symbols.)
* Build again.
By default windows come with prebuilt libraries but you might want to rebuild them
yourself, to do so follow the instructions at BuildingWindowsDependencies.
== Linux ==
0 A.D. should work on any reasonably modern Linux distro, on x86 and x86_64
(amd64). The details depend on exactly which distro you use.
* [https://developer.mozilla.org/en-
US/docs/Mozilla/Projects/SpiderMonkey/Releases/45 SpiderMonkey 45] (`--with-system-
mozjs45`)
* [https://github.com/castano/nvidia-texture-tools NVTT] (`--with-system-nvtt`)
* Finally you need to install the WX libraries. In order to do so you need to find
the current "best" set of versions for the WX libraries that are available on the
repos. Run the command
`sudo apt policy wx3.0-headers`
and the command
`sudo apt policy libwxgtk3.0-dev`
take note of the version that is available for _both_ of them (at time of
writing on my system it's `3.0.4+dfsg-8` and then install the following packages
using the format `package=version`, so for
example run
{{{
#!sh
sudo apt install wx3.0-headers=3.0.4+dfsg-8 libwxbase3.0-dev=3.0.4+dfsg-8
libwxgtk3.0-dev=3.0.4+dfsg-8 libwxbase3.0-0v5=3.0.4+dfsg-8 libwxgtk3.0-
0v5=3.0.4+dfsg-8
}}}
to make sure the required packages are all installed at the same version, or you
_will_ get build errors.
With Ubuntu 20.04 the package names changed getting an additional "-gtk3" so
install e.g. `libwxgtk3.0-gtk3-dev` instead of `libwxgtk3.0-dev`.
{{{
#!sh
urpmi gcc-c++ python subversion zip cmake boost-devel libcurl-devel \
libenet-devel libgloox-devel libpng-devel libsodium-devel libvorbis-devel \
libxml2-devel libwxgtku2.8-devel openal-soft-devel libicu-devel
}}}
==== Fedora ====
Install the dependencies with:
{{{
#!sh
sudo dnf install gcc-c++ python subversion zip cmake patch \
boost-devel libcurl-devel enet-devel libpng-devel libsodium-devel libvorbis-
devel \
libxml2-devel openal-soft-devel pkgconfig SDL2-devel wxGTK3-devel \
gloox-devel libicu-devel miniupnpc-devel
}}}
{{{
#!sh
sudo zypper install gcc-c++ python subversion zip cmake boost-devel \
libcurl-devel libenet-devel libpng-devel libsodium-devel libvorbis-devel \
libxml2-devel openal-soft-devel pkg-config wxWidgets-devel libSDL2-devel \
gloox-devel libicu-devel miniupnpc-devel
}}}
After installing the dependencies for your particular version, you can build **0
A.D.** from the [#Gettingthecode svn code] using the instructions from the
[#Building Building] section.
'''''Slackware 14.2'''''
* enet
* gloox
* libsodium
* miniupnpc
* OpenAL
* SDL2
**0 A.D.** will produce a `segmentation fault` if you try to connect to lobby with
TLS enabled. Though it was reported to work if compiled against the dependencies
below.
Upgraded packages:
{{{
OpenAL-1.18.1-x86_64-1alien.txz
curl-7.64.0-x86_64-2_slack14.2.txz
enet-1.3.12-x86_64-1_slonly.txz
gcc-5.5.0-x86_64-1_slack14.2.txz
gcc-g++-5.5.0-x86_64-1_slack14.2.txz
libXcursor-1.1.15-x86_64-1_slack14.2.txz
libpng-1.6.27-x86_64-1_slack14.2.txz
libsodium-1.0.16-x86_64-1_slonly.txz
libvorbis-1.3.6-x86_64-1_slack14.2.txz
libxml2-2.9.5-x86_64-1_slack14.2.txz
libzip-1.0.1-x86_64-3_slack14.2.txz
miniupnpc-2.0-x86_64-1_slonly.txz
pip-9.0.3-x86_64-1_slonly.txz
pkg-config-0.29.2-x86_64-1_slack14.2.txz
premake-4.4_beta5-x86_64-1_slonly.txz
sdl2-2.0.3-x86_64-1jsc.txz
wxGTK3-3.0.4-x86_64-2ponce.txz
zlib-1.2.11-x86_64-1_slack14.2.txz
}}}
Special packages:
{{{
gloox-1.0.22-x86_64-1_SBo.tgz
kernel-headers-4.4.157-x86-1.txz
}}}
Notes:
'''''Slackware-current'''''
Presently, **0 A.D.** does not build on Slackware-current. If you'd like to help
with the [https://trac.wildfiregames.com/ticket/5157#comment:21 ticket], please
[https://play0ad.com/about/contact-us/ contact us].
**Note:** The advice below is derived from installing in a Virtual Machine with
//CentOS 7// 64-bit minimally installed. If you have //CentOS 6// (or earlier), the
following steps may not be possible. Installation on a physical machine, a machine
with more stuff already installed upon it, or a machine that is 32-bit, may differ
slightly.
1. Firstly, you will need to enable the "Extra Packages for Enterprise Linux" (or
"EPEL") repository (if you haven't already). You can do this by running (as
root/via sudo)
{{{ #!sh
yum install epel-release
}}}
2. Install some auxiliary packages. These are not dependencies of 0 A.D. itself,
but are necessary to run update_workspaces.sh successfully. They might already be
installed on your system:
{{{ #!sh
yum install bzip2 patch
}}}
3. Install the 0 A.D. dependencies that are available directly from repos:
{{{ #!sh
yum install cmake gcc-c++ enet-devel libglvnd-devel gloox-devel libicu-devel \
libogg-devel libpng-devel libsodium-devel libvorbis-devel libXcursor-devel
libxml2-devel \
miniupnpc-devel openal-soft-devel subversion wxGTK3-devel zlib-devel SDL2-
devel
}}}
6. You should now have all dependencies for 0 A.D. Continue by [#Gettingthecode
getting the code], as described below. When you get to the part below in [#Building
Building] where you run `./update-workspaces.sh`, you **must** use the argument `--
prefer-local-libs`.
{{{
#!sh
cd 0ad/build/workspaces
./update-workspaces.sh -j3
cd gcc
make -j3
}}}
* '''-j3''' gives the number of parallel builds to run, and should typically be
one plus the number of CPU cores available.
* The '''Release''' mode builds (which are the default) are more optimised, but
are harder to debug. Use `make config=debug` (and run `pyrogenesis_dbg`) if you
need better debugging support. See [wiki:Debugging] for more details.
{{{
#!sh
cd ../../..
binaries/system/test
}}}
=== Running ===
If everything went well, compiling the code worked and all tests passed, it's
finally time to run the game:
{{{
#!sh
binaries/system/pyrogenesis
}}}
=== Keeping up to date ===
If you want to rebuild quickly after updating from SVN, you can usually get away
with:
{{{
#!sh
svn up
cd build/workspaces
./update-workspaces.sh -j3
cd gcc
make -j3
}}}
If the `make` line gives errors, you may need to run `make clean` before it. If the
`update-workspaces.sh` gives errors, you may need to run `clean-workspaces.sh`
before it.
== OS X ==
== macOS ==
== BSD ==
'''Note: The *BSD support is a work in progress and should be considered
experimental. That means don't try it unless you "know what you're doing" :)'''
* Install the following ports or packages (names probably differ depending on the
BSD variant):[[BR]] Install commands for the variants are provided below.
* boost-libs
* cmake
* curl (at least 7.32)
* enet
* execinfo
* gloox
* gmake
* iconv
* icu
* libGL
* libogg
* libvorbis
* libxml2
* miniupnpc
* openal
* png
* sdl2
* subversion
* wxWidgets-gtk2 (3.0 and above) - required to build the Atlas editor
* zip
* '''Note:''' zlib should already be installed by default
* GCC 4.8.1+ or Clang
* Obtain the game's source code as [#Gettingthecode described above] for Linux.
* Check for any variant specific issues below.
* '''Note:''' Our build scripts should detect that you are running *BSD and use
`gmake` as the make command. If for some reason this isn't correct, you can set the
`MAKE` environment variable to the correct GNU make path.
* Follow the [#Building build] instructions above for Linux.
* If running FreeBSD 10.0+ you need to set `CC` to `clang` and `CXX` to `clang++`.
{{{
#!sh
export CC=clang CXX=clang++
}}}
* TODO: Fix missing ecvt() (see #1325)
* If building Atlas, you need to set the `WX_CONFIG` variable, because `wx-config`
has a different name on FreeBSD. For example, you'd run this command if you built
the wxGTK 2.8 package with unicode support:
{{{
#!sh
export WX_CONFIG=wxgtk2u-2.8-config
}}}
if not correct, you will get errors about missing "wx/*.h" includes. You can
skip building Atlas altogether (and the wxWidgets dependency) by later passing the
`--disable-atlas` option to `update-workspaces.sh`.
* You'll have to set this variable every time you run `update-workspaces.sh`, so
it may be most convenient to put these commands into another shell script.