Build STK on Linux

(Installing Irrlicht)
Line 1: Line 1:
 +
Note that these instructions apply to STK versions more recent that 0.8 alpha. If you want to compile an older version, please use the history feature of the wiki.
 +
 +
== Installing dependencies ==
== Installing dependencies ==
Line 8: Line 11:
<code>sudo apt-get install autoconf automake build-essential cmake libogg-dev libvorbis-dev libopenal-dev libxxf86vm-dev libgl1-mesa-dev libglu1-mesa-dev libcurl4-openssl-dev libfribidi-dev</code>
<code>sudo apt-get install autoconf automake build-essential cmake libogg-dev libvorbis-dev libopenal-dev libxxf86vm-dev libgl1-mesa-dev libglu1-mesa-dev libcurl4-openssl-dev libfribidi-dev</code>
-
== Installing Irrlicht ==
 
-
Start by installing Irrlicht from your repositories, if it is found there. Otherwise check out [http://www.irrlicht3d.org/wiki/index.php?n=Main.InstallingIrrlicht How to Install Irrlicht] from the Irrlicht wiki.
+
== Building SuperTuxKart ==
-
* SuperTuxKart 0.7.3 should be built using Irrlicht trunk revision 3843.
+
From the STK root source directory, start by compiling irrlicht.
-
* If you want to compile the current SVN of STK, you will need a recent revision of Irrlicht from their SVN. Either try latest, or if that fails try revision 4256 which should work at the moment of writing this.
+
<code>cd lib/irrlicht/source/Irrlicht/
 +
NDEBUG=1 make -j2
 +
cd -</code>
-
The SVN repository of irrlicht may be found at
+
(in this sample I configure make to use 2 cores. You can use more/less depending on your configuration).
-
<code>https://irrlicht.svn.sourceforge.net/svnroot/irrlicht/trunk</code>
+
Note that these steps should be repeated whenever we update irrlicht.
-
Go in /source/Irrlicht inside that. Note that it's recommended to build Irrlicht in release mode for full performance (default is debug mode)
+
Then build SuperTuxKart using CMake
-
<code>NDEBUG=1 make</code>
+
-
The build environment can use Irrlicht either from an installed package (e.g. in /usr/local), or directly from the source tree. CMake should automatically detect Irrlicht if it is installed in default directories (/usr, /usr/local). '''It is recommended not to install irrlicht to /usr or /usr/local if you build it from source. Just leave it in place, this will be cleaner.''' See [[#Building_SuperTuxKart|below]] to help the build system find your Irrlicht.
 
-
 
-
If you have any problems with building irrlicht, please contact the irrlicht developers in their forum, since we most likely won't have the expertise to help with that.
 
-
 
-
== Building SuperTuxKart ==
 
-
 
-
As of 0.7.3, you may use either CMake or autotools to build SuperTuxKart. In the current SVN, autotools isn't actively being maintained any more. As such, use of CMake is encouraged.
 
-
 
-
=== CMake ===
 
<code>mkdir cmake_build
<code>mkdir cmake_build
cd cmake_build
cd cmake_build
cmake ..
cmake ..
-
make
+
make -j2
</code>
</code>
-
or, if Irrlicht is not installed system-wide, replace the 'cmake' part with:
+
(again in this sample I configure make to use 2 cores. You can use more/less depending on your configuration).
-
<code>cmake .. -DIRRLICHT_DIR=/full/path/to/irrlicht</code>
 
-
Note: if Irrlicht is installed system-wide, it may sometimes be necessary to also add <tt>-DIRRLICHT_INCLUDE_DIR</tt> and <tt>-DIRRLICHT_LIBRARY</tt>. This would then be set to the <tt>include</tt> directory in your Irrlicht directory, eg
+
To make a debug build add <tt>-DCMAKE_BUILD_TYPE=Debug</tt> like this:
-
 
+
-
<code>cmake .. -DIRRLICHT_DIR=/full/path/to/irrlicht -DIRRLICHT_INCLUDE_DIR=/full/path/to/irrlicht/include -DIRRLICHT_LIBRARY=/full/path/to/irrlicht/lib/Linux/libIrrlicht.a</code>
+
-
 
+
-
to make a debug build add <tt>-DCMAKE_BUILD_TYPE=Debug</tt> like this:
+
<code>cmake .. -DCMAKE_BUILD_TYPE=Debug</code>
<code>cmake .. -DCMAKE_BUILD_TYPE=Debug</code>
Line 50: Line 39:
Another option is to build the regular release version with its optimizations, but with debugging symbols still enabled. Replace the <tt>Debug</tt> with <tt>RelWithDebInfo</tt> for that.
Another option is to build the regular release version with its optimizations, but with debugging symbols still enabled. Replace the <tt>Debug</tt> with <tt>RelWithDebInfo</tt> for that.
-
And (optionally) to install:
+
 
 +
And finally, to install (optional):
<code>sudo make install</code>
<code>sudo make install</code>
Line 57: Line 47:
<code>cmake .. -DCMAKE_INSTALL_PREFIX=/opt/stk</code>
<code>cmake .. -DCMAKE_INSTALL_PREFIX=/opt/stk</code>
-
 
-
Our CMake build system is younger so we welcome success/failure stories :)
 
-
 
-
=== Autotools ===
 
-
 
-
''Note: This method is not actively being maintained in the current SVN. While it will often still work, the use of cmake is strongly advised.''
 
-
 
-
Simply use the usual autotools build triplet :
 
-
<code>./configure
 
-
make
 
-
</code>
 
-
 
-
and optionally
 
-
 
-
<code>sudo make install</code>
 
-
 
-
(if you obtained the STK source code from SVN, you will first need to run <TT>./autogen.sh</TT>)
 
-
 
-
 
-
If irrlicht is not installed system-wide, replace the './configure' part with :
 
-
 
-
<code>./configure --with-irrlicht=/full/path/to/irrlicht</code>
 
-
 
-
== Troubleshooting ==
 
-
 
-
Depending on whether your irrlicht build uses internal or external libpng/libjpeg dependencies, you may need to configure STK this way :
 
-
 
-
<code>./configure LDFLAGS="-lpng -ljpeg -lbz2"</code>
 

Revision as of 01:22, 6 November 2012

Note that these instructions apply to STK versions more recent that 0.8 alpha. If you want to compile an older version, please use the history feature of the wiki.


Installing dependencies

First of all, you will need a compiler and the autotools build system. When building the current SVN, you will also need cmake. Other dependencies you will need include openal, ogg, vorbis.

yum install gcc-c++ autoconf automake libogg-devel libvorbis-devel openal-soft-devel fribidi-devel subversion libcurl-devel cmake irrlicht-devel

sudo apt-get install autoconf automake build-essential cmake libogg-dev libvorbis-dev libopenal-dev libxxf86vm-dev libgl1-mesa-dev libglu1-mesa-dev libcurl4-openssl-dev libfribidi-dev


Building SuperTuxKart

From the STK root source directory, start by compiling irrlicht. cd lib/irrlicht/source/Irrlicht/ NDEBUG=1 make -j2 cd -

(in this sample I configure make to use 2 cores. You can use more/less depending on your configuration). Note that these steps should be repeated whenever we update irrlicht.

Then build SuperTuxKart using CMake

mkdir cmake_build cd cmake_build cmake .. make -j2

(again in this sample I configure make to use 2 cores. You can use more/less depending on your configuration).


To make a debug build add -DCMAKE_BUILD_TYPE=Debug like this:

cmake .. -DCMAKE_BUILD_TYPE=Debug

Another option is to build the regular release version with its optimizations, but with debugging symbols still enabled. Replace the Debug with RelWithDebInfo for that.


And finally, to install (optional):

sudo make install

this will install in /usr/local. If you want to install somewhere else, replace the "cmake" command with something like:

cmake .. -DCMAKE_INSTALL_PREFIX=/opt/stk

Retrieved from "http://supertuxkart.sourceforge.net/Build_STK_on_Linux"

User Tools