Compiling xoreos

From xoreos Wiki
Revision as of 13:58, 4 December 2015 by DrMcCoy (talk | contribs) (→‎CMake: Update the situation on CMake with static Boost)
Jump to navigation Jump to search

This page gives a few tips and pointers on how to compile xoreos on various platforms.

Compiler and build system

xoreos is written in C++, so a C++ compiler, like GCC or clang is required. It has two build systems: Autotools (Autoconf, Automake and Libtool) and CMake. Use whichever you feel more comfortable with.

GNU/Linux

On Debian-based distributions (including Ubuntu), you should be able to install the required compiler and build system packages with

sudo apt-get install libc6-dev g++ make autoconf automake libtool gettext cmake

On Arch Linux, you can install the necessary packages with

sudo pacman -S base-devel cmake

On other distributions, it should work similarily.

Mac OS X

Due to the dependency on SDL2 (see below), you need at least Mac OS X 10.5 if you use a precompiled SDL2 library, and at least Mac OS X 10.7 if you're compiling SDL2 yourself.

Windows

Since Visual Studio does not work with autotools, you have to use the CMake build system if you want to compile xoreos with Visual Studio. If you're using MinGW, however, you're free to choose either build system.

Libraries

xoreos uses the following libraries to function:

  • iconv
  • zlib (>= 1.2.3.4)
  • liblzma (>= 5.0.5)
  • libxml2 (>= 2.8.0)
  • Boost (>= 1.53.0)
    • Boost.StringAlgo
    • Boost.System
    • Boost.Filesystem
    • Boost.Regex
    • Boost.Unordered
    • Boost.Hash
    • Boost.Date_Time
    • Boost.Function
    • Boost.Bind
    • Boost.Uuid
    • Boost.Smart_Ptr
    • Boost.Atomic
    • Boost.Locale
  • OpenGL (>= 2.1)
  • SDL2 (>= 2.0.0)
  • FreeType 2 (>= 2.4.0 (libtool number >= 11.0.5))
  • OpenAL (>= 1.12) (*)
  • MAD (>= 0.15.1b)
  • libogg (>= 1.2.0)
  • libvorbis (>= 1.3.1)
  • libfaad (>= 2.7)
  • libxvidcore (>= 1.2.2)

On Debian-based GNU/Linux distribution (including Ubuntu), you should be able to install these libraries and their development packages with

sudo apt-get install zlib1g-dev liblzma-dev libxml2-dev libboost-all-dev libsdl2-dev \
    libfreetype6-dev libopenal-dev libmad0-dev libogg-dev libvorbis-dev libfaad-dev \
    libxvidcore-dev

On Arch Linux, you can install these dependencies with

sudo pacman -S zlib xz libxml2 boost boost-libs sdl2 freetype2 openal libmad libogg \
    libvorbis faad2 xvidcore

Other GNU/Linux distributions should work similarily. Windows users have to visit each website manually and download a precompiled version, or, if not available, download the source and compile the library themselves.

(*) On Mac OS X, we're using Apple's OpenAL implementation, so OpenAL does not need to be installed separately there. On both GNU/Linux and Microsoft Windows, we require OpenAL Soft. There is a propriety OpenAL implementation by Creative Labs, Inc. for Microsoft Windows, which can be found at http://openal.org/, but it's unfortunately old, outdated and abandoned. We do not recommend its use.

Compiling xoreos

Make you have your compiler, build system and libraries installed correctly. Then open a terminal and change into the directory of your sources.

autotools

Type

./autogen.sh && ./configure && make

The binary can be found in the src subdirectory, called "xoreos" or, on Windows, "xoreos.exe".

Optional, non-conventional ./configure flags:

  • --with-werror  
Compile with -Werror
  • --without-warnings  
Compile without the extra warnings enabled
  • --with-lto  
Compile with link-time optimization
  • --disable-external-glew  
Always compile against the internal GLEW libraries

CMake

Type

cmake . && make

The binary can be found in the bin subdirectory, called "xoreos" or, on Windows, "xoreos.exe".

Please read Running CMake on the CMake website for in-depth information on invoking CMake.

Optional, non-conventional cmake flags:

  • -DBoost_USE_STATIC_LIBS=on  
Link Boost statically instead of dynamically
  • -DGLEW_INTERNAL=on  
Always use internal GLEW library

Note: The CMake's stock FindBoost.cmake doesn't correctly detect dependencies when linking statically. In this case, xoreos might fail to link, missing symbols for ICU, when linking Boost statically.

Moreover, if you're running GNU/Linux and have wrapper scripts installed that force the building of "hardened" binaries (often called "hardening-wrapper", but differs between Linux distributions), compiling xoreos might fail during the linking stage, when using statically linking Boost libraries. This is due to those static Boost libraries being incompatible with the compiler option "-fPIE", which is often added by hardening wrapper scripts. A workaround is to disable -fPIE for this compilation (which is distribution-specific).

Running xoreos

Please have a look at the Running xoreos page.