Building:Linux:SCons

From FIFE development wiki
Revision as of 14:20, 11 February 2013 by Trendy (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Tux-32x32.png Platform-dependent information: Linux.

The following passage contains information that is specific to Linux and other POSIX-based operating systems.

This guide describes how you can compile the FIFE sourcecode into a binary on your Linux (and basically on every other POSIX) system. FIFE uses scons as a build-wrapper. Use File.png build/linux2-config.py to customize dependency paths and other build options

Compiling

GNU/Debian
Command.pngapt-get install scons
in Folder.png trunk of checked out source code run Command.pngscons ext
compile external dependencies (guichan and libpng) and install them to <FIFE>/ext/install/lib
Command.pngscons compiles the engine

You can see compiles flags, their description, default and actual values with Command.pngscons -h

Debian based systems (e.g. Ubuntu) shortcut
Command.pngsudo apt-get install build-essential scons libsdl1.2-dev libboost-dev libsdl-ttf2.0-dev libsdl-image1.2-dev libvorbis-dev libalut-dev python-dev libboost-regex-dev libboost-system-dev libboost-filesystem-dev libboost-test-dev swig zlib1g-dev libxcursor-dev libopenal-dev libasound2-dev libguichan-dev


Build problems
Required lib XXX not found
library and its headers (-dev package?) are installed?
libs registered system-wide (directory listed in File.png /etc/ld.so.conf)? Does the linker find them Command.pngld -l LIB_NAME?
ensure that a pkg-config .pc file is available for the missing library (see section for lib SDL_ttf below)
try copying a .pc file from a subdir of the FIFE tree to /usr/lib/pkgconfig
try editing the .pc file to set the prefix to the correct location
Command.pngpkg-config --libs LIB_NAME to test it
use 'ln' to create a link from a specific lib file to one required by FIFE (for example, I had to create a link from libboost_filesystem.so to libboost_filesystem-mt.so)
Required lib SDL_ttf not found
try and create a symbolic link for the pkg config file SDL.pc to sdl.pc for case sensitivity with Command.pngln -s /usr/lib/pkgconfig/sdl.pc /usr/lib/pkgconfig/SDL.pc

NOTE: If you are getting a message that scons cant find SDL_ttf and you are using a debian based system you should also install the libsdl-ttf2.0-dev and python2.6-dev packages.

If you have installed SDL_ttf and tips above don't help. Try this tutorial [1], download source code and compile with: g++ lesson07.cpp -lSDL -lSDL_ttf -lSDL_image, to check if SDL_ttf works. If so, copy all *.pc files to directory that keeps them in your system (my was /usr/lib/pkgconfig/) and edit them to show directory that contain placeholders for libs. Easiest way is to find SDL.h file (if in /usr/locale/include do not change *.pc files) and than change paths in *.pc files.

FreeBSD

Customize dependency paths and other build options
Copy File.png build/freebsd6-config-dist.py to File.png freebsd6-config.py or File.png build/freebsd7-config-dist.py to File.png freebsd7-config.py in same folder, its content override the default settings

You need to make sure you have installed the dependencies via ports before compiling FIFE. If you have scons installed via ports, in Folder.png trunk of checkout source run Command.pngscons ext=1 && scons. After FIFE has been successfully built it's sufficent to run just Command.pngscons

Builds problems
Required lib XXX not found
installed the dependencies via ports?
The damn lib is fine, but scons ignores it
ensure that scons finds the libs/headers; you can either:
  • register the libs (system-wide) for pkg-config
  • register the libs (as non-root) for pkg-config and build with:
Command.pngexport PKG_CONFIG_PATH=/some/path Command.pngscons useenv=yes
This may sound complicated, but if you know what the -I and -L compiler flags do, it isn't. Search for the pkg-config lib dir (e.g. /usr/lib/pkgconfig) and look at one of the files. If you want to register lib foo, the filename should be File.png foo.pc so just a copy an existing file and edit as required (probably Libs: and CFlags:, maybe Name:, too).
edit File.png freebsd6-config-dist.py or File.png freebsd7-config-dist.py
use context.env.Append() to add search paths either with CPPPATH or LIBPATH.