Compile In Linux

From FreeOrionWiki

Jump to: navigation, search

Each linux distribution will come with varying components already installed, although some libraries may be older than the version required by FreeOrion. Hopefully the notes below will help to identify what is required for your particular distribution.


Contents

[edit] Compiler

GCC 4.x is required. See this forum thread.


[edit] Platform specifics

[edit] Ubuntu

To build gigi or FreeOrion you first need to install the following packages using Synaptic (you will need to have the Universe repository included):

  • python (should already be installed)
  • scons
  • libfreetype6 and libfreetype6-dev
  • bcp
  • libdevil1c2 and libdevil-dev
  • libsdl1.2debian (should already be installed), libsdl1.2-dev
  • graphviz and graphviz-dev

You can install all of these (including dependencies) from the command line using this:

sudo apt-get install python scons libfreetype6-dev bcp libdevil-dev libsdl1.2-dev libsdl-mixer1.2-dev graphviz-dev libalut-dev liblog4cpp5-dev

[edit] Ubuntu (FeistyFawn and EdgyEft)

The log4cpp libs are still missing, so lets install them:

sudo apt-get install liblog4cpp4 liblog4cpp4-dev

[edit] Ubuntu (DapperDrake and before)

Your Ubuntu log4cpp package is too old so you will need to download the required version from the Debian archive (liblog4cpp4 and liblog4cpp4-dev) then install them:

sudo dpkg --install liblog4cpp4_0.3.5-rc3-1_i386.deb
sudo dpkg --install liblog4cpp4-dev_0.3.5-rc3-1_i386.deb

[edit] Ubuntu (Hardy and Intrepid) and Debian testing

sudo apt-get install python2.5-dev
sudo apt-get install libboost1.35-dev

This will automatically bring in the following dependencies for boost

 gccxml libboost-date-time1.35-dev libboost-date-time1.35.0 libboost-filesystem1.35-dev
 libboost-filesystem1.35.0 libboost-graph1.35-dev libboost-graph1.35.0 libboost-iostreams1.35-dev
 libboost-iostreams1.35.0 libboost-program-options1.35-dev libboost-program-options1.35.0
 libboost-python1.35-dev libboost-python1.35.0 libboost-regex1.35-dev libboost-regex1.35.0
 libboost-serialization1.35-dev libboost-serialization1.35.0 libboost-signals1.35-dev
 libboost-signals1.35.0 libboost-system1.35-dev libboost-system1.35.0 libboost-test1.35-dev
 libboost-test1.35.0 libboost-thread1.35-dev libboost-thread1.35.0 libboost-wave1.35-dev
 libboost-wave1.35.0 libboost1.35-dev libboost1.35-doc

[edit] GiGi

Before attempting to build FreeOrion you will first need to build and install the GiGi library.

The GiGi source should be automatically downloaded from SVN along with the FreeOrion source code. If not, it can be manually downloaded:

svn co https://gigi.svn.sourceforge.net/svnroot/gigi/trunk gigi

Change into the GiGi directory and build the library:

cd freeorion/FreeOrion/GG
scons
sudo scons install

Since improvements and changes will be made to GiGi periodically, you should keep it up to date with:

cd freeorion/FreeOrion/GG
svn update
scons
sudo scons install


[edit] FreeOrion

After GiGi is compiled and installed, compile FreeOrion:

cd freeorion/FreeOrion
scons

When improvements have been made to FreeOrion, you should build the new version:

cd freeorion/FreeOrion
svn update
scons


[edit] Clean After Dependency Changes

It has been reported that on Gentoo, it may be necessary to clean your old build before rebuilding GiGi or FreeOrion after updates that make changes to dependencies or versions of dependencies used, such as Boost. To do this:

scons --clean


[edit] User stories

[edit] Compilation Errors

[edit] Bogus build errors

You may see errors during the build process like this:

Checking for freetype2 >= 9.0.0... no
Checking for C header file ft2build.h... yes
Checking for FT_Init_FreeType() in C library freetype... yes
Checking DevIL version >= 1.6.1... (cached) no
Checking for C header file IL/il.h... yes


These failed messages refer to scons not finding an installed package for these components. The subsequent successful checks show that despite there being no pkg-config ".pc" file, the required header and library files were successfully located.

[edit] SCons Can't Find Libraries/Dependencies

If SCons is not able to find a library (e.g. Boost, GiGi, etc) that is installed, you need to be certain SCons is looking in the right directories. Your distribution may install the library in an unexpected location, or you may have manually installed the library in a non-standard directory (e.g. /home/user/freeorion/Boost). You will need to configure scons to look in these additional directories. The command:

scons -h

lists the command-line options for SCons, including how to configure dependency directories. The command (add or remove options to match your needs):

scons configure prefix=/usr/local/freeorion with_boost_include=/usr/local/include/boost with_ogre_include=/usr/include/OGRE

will store these options permanently in the file options.cache. Run configure again, or edit options.cache, to change the settings.

[edit] Undefined reference to `_vsnprintf'

This is a bug in the latest version of Devil. GiGi's configure script should've taken care of it. If it didn't, you can fix the error yourself: Check the il_tiff.c file and add this line at the top:

#define _vsnprintf vsnprintf 

and then recompile [1]

[edit] PI and PS2INCH are not declared

You may see these errors during compilation:

UI/TechTreeWnd.cpp:99: error: 'PI' was not declared in this scope
UI/TechTreeWnd.cpp:1845: error: 'PS2INCH' was not declared in this scope

Recent versions of graphviz do not define PI or PS2INCH. See this forum post for the small patch to UI/TechTreeWnd.cpp.

[edit] boost 1.36

In your distribution is newer boost library. See this forum post

[edit] Runtime Errors

[edit] Segmentation Fault

If after compiling everything, you run freeorion and get a segmentation fault:

$ ./freeorion
Segmentation fault

[edit] Video mode set failed: Couldn't find matching GLX visual

Your video mode is probably set to 16-bit instead of 32-bit, which is what FreeOrion defaults to. You need to either change your X server color depth to 32-bit, or edit the FreeOrion config file in ~/freeorion/config.xml and change color-depth from 32 to 16. You can also try the command line argement:

./freeorion --color-depth 16


[edit] IDE for development

  • Text editor and scons to compile
  • Eclipse is open source multiplatform IDE and can be used to compile FreeOrion, but plugins to support scons and subversion have to be installed. See howto Compile With Eclipse.
Personal tools