Build STK on Linux

(Installing dependencies)
m (Installing dependencies)
 
Line 1: Line 1:
-
== Installing dependencies ==
+
Note that these instructions apply to STK versions more recent than 0.8 alpha. If you want to compile an older version, please use the history feature of the wiki.
-
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.
+
<div class="outer_info">
 +
    <div class="inner_msg">
 +
'''If you are a packager making a package for a Linux distribution''', please do '''not''' try to modify our build system to use system versions of bullet and irrlicht. In both cases we use a specific and/or modified version of the library, and linking STK against the system library will only introduce bugs (corrupted graphics, memory leaks) into SuperTuxKart. Thanks
 +
</div></div>
-
* Fedora
 
-
yum install gcc-c++ autoconf automake libogg-devel libvorbis-devel openal-soft-devel fribidi-devel subversion libcurl-devel cmake irrlicht-devel
 
-
* Ubuntu
 
-
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
 
-
== Installing Irrlicht ==
+
== Installing dependencies ==
-
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. SuperTuxKart 0.7.3 should be built using Irrlicht 1.7.3. If you want to compile the current SVN of STK, you will need Irrlicht's trunk.
+
First of all, you will need a c++ compiler, the autotools build system and cmake. Other dependencies you will need include openal, ogg, vorbis. You don't need to install irrlicht, bullet, enet or wiiuse because they are included in the git repository.
-
The latest SVN trunk of SuperTuxKart uses the trunk of Irrlicht, which can be found at
+
* Fedora
-
https://irrlicht.svn.sourceforge.net/svnroot/irrlicht/trunk
+
<code>yum install gcc-c++ autoconf automake git-core libogg-devel libvorbis-devel libXrandr-devel mesa-libGL-devel mesa-libGLU-devel openal-soft-devel fribidi-devel subversion libcurl-devel cmake libbluedevil-devel</code>
 +
* Ubuntu/Debian
 +
<code>sudo apt-get install autoconf automake build-essential cmake git libogg-dev libvorbis-dev libopenal-dev libxxf86vm-dev libgl1-mesa-dev libglu1-mesa-dev libcurl4-openssl-dev libfribidi-dev libfreetype6-dev libbluetooth-dev subversion libxrandr-dev zlib1g-dev libpng12-dev libjpeg-turbo8-dev libsm-dev</code>
-
Go in /source/Irrlicht inside that. Note that it's recommended to build Irrlicht in release mode for full performance (default is debug mode)
+
== Obtain code and assets ==
-
NDEBUG=1 make
+
STK is splitted up into code and assets, so you need these two commands two get both:
 +
<code>git clone https://github.com/supertuxkart/stk-code.git stk-code # about 130 MB
 +
svn checkout https://svn.code.sf.net/p/supertuxkart/code/stk-assets stk-assets # about 650 MB</code>
 +
See [[Source control]] for more information.
-
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.
+
The <TT>stk-code</TT> and the <TT>stk-assets</TT> directory need to be in the same folder. This means that you need the following folder structure:
-
 
+
* base dir
-
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.
+
** stk-code
 +
*** src
 +
*** lib
 +
*** ...
 +
** stk-assets
 +
*** tracks
 +
*** ...
== Building SuperTuxKart ==
== 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.
+
Next, build SuperTuxKart using CMake:
 +
 
 +
<code>cd stk-code
 +
mkdir cmake_build
 +
cd cmake_build
 +
cmake ..
 +
make -j2
 +
</code>
-
=== CMake ===
+
You can speed up compilation heavily by changing the number behind <tt>-j</tt> to the number of cores you have.
-
mkdir cmake_build
+
-
cd cmake_build
+
-
cmake ..
+
-
make
+
-
or, if Irrlicht is not installed system-wide, replace the 'cmake' part with:
+
=== CMake Options ===
 +
There is a varity ofCMake options. The most important ones are listed below:
 +
* To make a debug build add <tt>-DCMAKE_BUILD_TYPE=Debug</tt> like this: <code>cmake .. -DCMAKE_BUILD_TYPE=Debug</code>
-
cmake .. -DIRRLICHT_DIR=/full/path/to/irrlicht
+
* 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, ie: <code>cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo</code>
-
to make a debug build add '''-DCMAKE_BUILD_TYPE=Debug''' like this:
+
* wiiuse can be enable with <code>-DUSE_WIIUSE=yes</code>
-
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.
+
Finally, you can simply run SuperTuxKart from the build directory:
 +
<code>./bin/supertuxkart</code>
-
And (optionally) to install:
+
Optionally, STK can be installed /usr/local in using
-
sudo make install
+
<code>sudo make install</code>''
-
this will install in /usr/local. If you want to install somewhere else, replace the "cmake" command with something like:
+
If you want to install somewhere else, add the following options to cmake:
-
cmake .. -DCMAKE_INSTALL_PREFIX=/opt/stk
+
<code>-DCMAKE_INSTALL_PREFIX=/path/to/install</code>
-
Our CMake build system is younger so we welcome success/failure stories :)
+
If you want to update your copy of STK to the current git/SVN versions, go to the parent directory of stk-code:
 +
<code>cd stk-code
 +
git pull
 +
cd cmake_build
 +
make -j2
 +
cd ../../stk-assets
 +
svn update</code>
-
=== Autotools ===
+
== Using Eclipse ==
 +
If you want to use the eclipse ide, use the following approach:
-
''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.''
+
In the trunk :
 +
    mkdir cmake_build
 +
    cd cmake_build
 +
    cmake -G "Eclipse CDT4 - Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug ..
-
Simply use the usual autotools build triplet :
+
This will generate project files based on the cmake files.
-
./configure
+
Now you can open Eclipse, Import -> Existing projects into workspace, browse to the trunk and import the build project.
-
make
+
-
# optional
+
-
sudo make install
+
-
(if you obtained the STK source code from SVN, you will first need to run <TT>./autogen.sh</TT>)
+
Though, I recommend making a new project with the trunk as directory so that you can actually browse the source in the IDE and use the source control (SVN/GIT) plugins.
 +
Now right-click on this project -> New -> Convert to C++ Project (Possibly not needed if you made a C++ project in the previous step.)
-
If irrlicht is not installed system-wide, replace the './configure' part with :
+
Right-click the project -> properties -> C/C++ Build
 +
* Uncheck "Use default build command"
 +
* Enter as build command "make -j2" (replace 2 by the number of cores)
 +
* Change the build directory to cmake_build
-
./configure --with-irrlicht=/full/path/to/irrlicht
+
Now you can build the project by :
 +
* Right-click project -> Build Project
 +
* Or by using the build button at the top
-
== Troubleshooting ==
+
For easier code browsing an making use of Eclipse features :
-
Depending on whether your irrlicht build uses internal or external libpng/libjpeg dependencies, you may need to configure STK this way :
+
C/C++ Build -> Discovery options
 +
* Automate discovery of path and symbols
 +
* Discovery profile : GCC per project scanner into profile
 +
Apply
-
./configure LDFLAGS="-lpng -ljpeg -lbz2"
+
Right-click project -> index -> rebuild

Latest revision as of 22:06, 18 March 2016

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

User Tools