Version 67 (modified by arn34, 15 years ago) ( diff )

--

The current release of the game is aimed at developers and not at 'normal' users. As such, the following instructions assume a reasonable level of technical proficiency. If you encounter difficulties, please post on the forum.

General prerequisites

You'll need:

  • An adequately high-spec computer - several gigabytes of free disk space, preferably at least 1GB of RAM for compiling, a fast CPU unless you want to spend ages waiting for the compiler, etc. Modern graphics hardware is also recommended, though the game can run (slowly) on fairly old devices (GeForce 4, Intel 945GM, etc).
  • Up-to-date system software (Windows service packs, graphics driver updates, etc).
  • Some technical proficiency. We try to make the build process as smooth and painless as possible, but it's designed to be followed by programmers - if you just want to play the game, wait for a pre-packaged installer instead.

Windows

Windows XP and Vista are the main supported versions; 2000 and 7 may work too.

Acquiring the code

The game's code, data and build environment are stored on a Subversion server. The recommended way to get an up-to-date copy is with TortoiseSVN:

  • Download and install TortoiseSVN. (Make sure you reboot when it asks you to.)
  • Use TortoiseSVN to check out http://svn.wildfiregames.com/public/ps/trunk/. This may take a while, and will use around 700MB of disk space. Make sure it's in a path that does not contain any space characters.
    • Note: The SVN server is currently very busy, and is likely to return "503 Service Unavailable" errors. You might want to wait a few days before downloading all the code. (Linux users should see below for a quicker way to download the code.)

The TortoiseSVN manual has information on checking out, as well as updating and creating patches.

(This is the read-only public SVN URL. If you have commit access, you need to use http://svn.wildfiregames.com/svn/ps/trunk/ instead.)

Setting up the build environment

The game must be compiled with Microsoft Visual C++. If you already have Visual C++ 2005 or 2008 installed, make sure you have SP1 and then continue. Otherwise, you can get the free Express edition:

(If you have the old VC++ 2005 Express, you need to install the separate Platform SDK (steps 1-3).)

The Visual Studio project/solution files are automatically generated from the source files:

  • Run build/workspaces/update-workspaces.bat.
  • Open build/workspaces/vc2008/pyrogenesis.sln. (If you have VC++ 2005, use the vc2005 directory instead.)

Now you should be able to build the code from within Visual Studio, using "Build Solution" (F7).

Running

Run the game with F5 inside Visual Studio (assuming "pyrogenesis" is set as the startup project, which is default). If you want to run it outside the debugger, run binaries/system/pyrogenesis_dbg.exe.

To run the (currently quite minimal) 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.

Keeping up to date

After you've set everything up, the process for staying up to date is:

  • 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.

Linux

This is much less streamlined than the process for Windows. But you're cooler than a Windows developer, so you should be able to cope.

  • Install various standard tools and development libraries:
    • GCC (at least 4.1, preferably 4.3)
    • Subversion
    • NASM
      • There is a bug in NASM 2.06 on x86_64, so you might want to try a different version if you get errors.
    • SDL
    • Boost
    • zlib
    • libpng
    • libxml2
    • OpenGL
    • OpenAL
    • libogg
    • libvorbis
    • cryptopp
    • wxWidgets (probably called wxgtk on Linux) (optional, but required for the editor tools)
    • gamin (Linux only)
    • BFD (typically called something like binutils-dev) (Linux only)
    • enet
    • DevIL
    • and maybe some other things?
  • For Ubuntu the following might help: sudo apt-get install build-essential libsdl1.2-dev zlib1g-dev libpng12-dev libjpeg62-dev libgamin-dev nasm libwxgtk2.8-dev libboost-dev libboost-signals-dev libboost-filesystem-dev libopenal-dev libalut-dev libvorbis-dev libogg-dev libcrypto++-dev binutils-dev libnspr4-dev libdevil-dev libenet-dev libxml2-dev
  • svn co http://svn.wildfiregames.com/public/ps/trunk/ (or http://svn.wildfiregames.com/svn/ps/trunk/ if you have commit access)
  • cd trunk/build/workspaces
  • ./update-workspaces.sh (you'll have to repeat this step each time a source file is added or removed)
  • cd gcc
  • make -j3 (where 3 is the number of parallel builds to run, and could perhaps be one plus the number of CPU cores available)
    • Note: Parallel building can create errors due to race conditions. Run a "make clean" and try just "make" if you encounter problems.
  • If you encounter any build errors, look for an existing bug report or report a new bug.
  • ( cd ../../../binaries/system && ./pyrogenesis_dbg )

OS X

Follow this steps to install under OS X:

  • Install Apple's XCode for your system : see your Mac OsX install DVD or go to Apple's Developer Connection Site
    This provides the necessary tools to compile programs.
    Note that for Leopard, it is mandatory to install XCode >= 3.1, as the tiff dependency won't compile either. On my DVD, Apple shipped only XCode 3.0, so I had to download 3.1 from the ADC site.
  • Install Macports : MacPorts
    This is the easiest way to install all the dependencies needed by 0ad.
  • sudo port install the following packages :
    • boost
    • libsdl
    • xercesc
    • wxWidgets
    • ffmpeg
    • libxml2
    • libdevil
    • libenet
  • Now get the last revision of the game : svn co http://svn.wildfiregames.com/public/ps/trunk/ (or http://svn.wildfiregames.com/svn/ps/trunk/ if you have commit access)
  • then compile the game :
    • cd trunk/build/workspaces
    • ./update-workspaces.sh (you'll have to repeat this step each time a source file is added or removed)
    • cd gcc
    • make -j3 (where 3 is the number of parallel builds to run, and could perhaps be one plus the number of CPU cores available)
      • Note: Parallel building can create errors due to race conditions. Run a "make clean" and try just "make" if you encounter problems.
  • If you cannot manage to compile with the Apple's default compiler (gcc 4.0.1), you may try compiling with gcc 4.2 (recommended) or 4.3 (this worked for me a least) : see the detailed section here under. Note that gcc 4.1 failed to compile FCollada for me, so I don't recommend it
  • If you encounter any build errors, look for an existing bug report or report a new bug (I myself still get a last error, but it seems harmless).
  • Finally, launch the game : cd ../../../binaries/system && ./pyrogenesis_dbg

Compiling with gcc 4.2 or 4.3 under OS X

For those who get weird errors, you can try compiling with gcc 4.2 or 4.3, which are not shipped with any version of Apple's XCode. So you first have to get them from MacPorts and then patch some system libraries (certainly not the better way to do it, but for now the game is targetted for developpers, so you can manage to do it :) ).

  • sudo port install gcc42 gcc43 gcc_select
    Select gcc 4.2 or 4.3 : sudo gcc_select mp-gcc42 or sudo gcc_select mp-gcc43
  • Take care that libdevil 1.6.8-rc2 (the version in macports) is not compatible with GCC 4.3, you'll need to install 1.7.8. Get it from http://openil.sourceforge.net/download.php. Then extract the archive, and run ./configure --enable-ILU --enable-ILUT, make, and sudo make install.
  • Right, you're almost ready to compile 0ad :
    • you need to patch Apple's OpenAL (/System/Library/Frameworks/OpenAL.Framework/alc.h : replace all ALCvoid by void, except first one which is a typedef). Indeed, as Jan said, "C allows parameters typedefed to void, C++ does not; GCC >=4.2 are now strict about the error" (and will end to compilation error).
    • if you compile with gcc 4.2, you'll certainly need to patch Macports IL (/opt/local/include/IL/il.h and ilu.h : replace all ILvoid by void, except typedefs).
  • If you're under Tiger, you'll certainly have to edit build/premake/premake.lua to get rid of the "-fstack-protector-all" line : see the known problems section.
  • Then, launch again the compilation starting from ./update-workspace.sh

Known problems and solutions

  • If you get linker errors like multiple definition of '(anonymous namespace)::_1', particularly when using GCC 4.1, try running ./update-workspaces.sh --without-pch and then cd gcc; make clean and rebuild.
  • If you get Performance warning: your graphics card does not support compressed textures when starting the game, it is an issue with S3TC texture compression. You might be able to solve it by installing the libtxc_dxtn library, in a distro-specific way.
  • if you get /usr/bin/ld: Undefined symbols (see code snippet here under), this comes from your glibc that is older than 2.4 :
/usr/bin/ld: warning -L: directory name (../../../libraries/comsuppw/lib) does not exist
/usr/bin/ld: Undefined symbols:
___stack_chk_fail
___stack_chk_guard
collect2: ld returned 1 exit status
make[1]: *** [../../../binaries/system/pyrogenesis_dbg.app/Contents/MacOS/pyrogenesis_dbg] Error 1
make: *** [pyrogenesis] Error 2

Actually, older versions of glibc doesn't support the stack-protection feature. So, until this is detected by the build system, you can hack it by removing the "-fstack-protector-all" line (and the next line too if needed) from build/premake/premake.lua

Note: See TracWiki for help on using the wiki.