Build STK on Linux
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.
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
First of all, you will need a compiler and the autotools build system. When building the current Git master, 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 libbluedevil-devel.x86_64
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 libbluetooth-dev
Then build SuperTuxKart using CMake
You'll have to run these commands inside your stk-code directory. The stk-assets directory has to be in the parent directory of stk-code
make VERBOSE=1 -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.
To enable wiiuse, add:
To run supertuxkart. just start it from the build directory:
NOTE: make install is currently broken!! 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
If you want to use the eclipse ide, use the following approach:
In the trunk :
mkdir cmake_build cd cmake_build cmake -G "Eclipse CDT4 - Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug ..
This will generate project files based on the cmake files.
Now you can open Eclipse, Import -> Existing projects into workspace, browse to the trunk and import the build project.
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.)
Right-click the project -> properties -> C/C++ Build
- Uncheck "Use default build command"
- Enter as build command "make VERBOSE=1 -j2" (replace 2 by the number of cores)
- Change the build directory to cmake_build
Now you can build the project by :
- Right-click project -> Build Project
- Or by using the build button at the top
For easier code browsing an making use of Eclipse features :
C/C++ Build -> Discovery options
- Automate discovery of path and symbols
- Discovery profile : GCC per project scanner into profile
Right-click project -> index -> rebuild