Development < Building Spring < Building Spring on Linux
Contents |
Build From Source on Linux
If you prefer to use your distributions package system (release versions only), refer to the Linux SetupGuide.
If there is no package tailored for your distribution, you have to install from sources manually. Doing this for distributions where packages are available is not recommended.
Warning:
Be careful when building from source.
You might encounter sync errors in online play if:
- you are using an untested compiler (gcc from the 4.x serie should be safe)
- you use non-standard compiler settings (be careful about -march)!
Obtaining the Source
Tarballs
(For playing online)
Using Git is the recommended way to get the sources of the engine.
In spite of, you can use the official tarballs to compile Spring without git.
Note: Do NOT use the zip-files from github, they are missing important data to compile Spring.
See Building spring for build instructions.
Git
Spring project page at github (status page)
Master repo URI: git://github.com/spring/spring.git
Backup repo: git://git.code.sf.net/p/springrts/code
Latest Stable (master branch)
Assuming the GIT command line client is installed, you can clone the repository with
git clone git://github.com/spring/spring.git -b master
and update it with:
git pull --rebase
Bleeding-edge (develop branch)
This will also allow you to make a patch out of the changes you make to the code, and send it to one of the developers with repository access. If you are new to git and github, you may want to have a look at this guide to get you started.
Just as above with a minimal change:
git clone git://github.com/spring/spring.git -b develop
and update with:
git pull --rebase
Note: you can switch branches this way:
# backup your current changes
git stash
# switch branch
git checkout $MY_OTHER_BRANCH
# sometimes needed
# note, it deletes all your unstashed changes and all non-pushed commits on the new branch,
# but it doesn't delete untracked files.
#git reset --hard
# update/sync with remote repo
git pull --rebase
#optional
#git stash pop # reapplies your changes and DELETES the backup
#or
#git stash apply --index 0 # reapplies your changes and keep the backup (see `git stash list`)
Optional AI's
If you want to also compile the AI's, you have to type
git submodule sync
git submodule update --init
to update the submodules, you have to execute the same commands again.
Get Dependencies
To compile, you will have to install some development packages Spring depends on. These vary from distro to distro and may also depend on your specific configuration.
If your distributions is not listed below, you should be able to figure out the correct package names from this.
Full list
- Programs necessary to build
- cmake
- 7zip (aka p7zip or 7z)
- The usual build toolchain
- gcc
- make
- Libraries
- SDL
- boost (version 1.35 or later)
- threads
- regex
- signals
- system
- program-options
- libdeviL (IL)
- OpenAL (openal-soft, older openal-0.0.8 does not work)
- OpenGL headers (mesa, GLEW, etc.)
- zlib
- freetype (2)
- ogg, vorbis and vorbisfile
- Optional (for AI Interfaces and Skirmish AIs)
- python (2.5+)
- jdk (1.5+)
Debian
For Etch (debian 4.0 stable) and Sid (debian unstable), I've confirmed the following to be the minimal set that is necessary to get. This works with Ubuntu 8.10, too. As of ~ July 2009, spring depends on boost 1.35+ (if your distro is behind, you can try some unofficial backports).
Also, on 64-bit, be sure to build against DevIL 1.6.8-rc2+, as 1.6.7 has a bug in the PNG loading code that causes issues.
sudo aptitude install build-essential zlib1g-dev libfreetype6-dev cmake
sudo aptitude install libsdl1.2-dev libopenal-dev libglew-dev zip
sudo aptitude install libvorbis-dev libxcursor-dev libdevil-dev
sudo aptitude install libboost-system1.37-dev libboost-system1.37-thread-dev
sudo aptitude install libboost-system1.37-regex-dev
sudo aptitude install libboost-system1.37-serialization-dev
sudo aptitude install libboost-system1.37-program-options-dev
and cmake, depending on what you use for building (I advise to use cmake). On debian 5.0 (lenny), libglew1.5-dev is required as well.
Ubuntu
# compiler and build tools
sudo apt-get install build-essential cmake cmake-gui git
# spring dependencies
sudo apt-get install libglew-dev libsdl-dev libdevil-dev libopenal-dev \
libogg-dev libvorbis-dev libfreetype6-dev p7zip-full libxcursor-dev \
libboost-thread-dev libboost-regex-dev libboost-system-dev \
libboost-program-options-dev libboost-signals-dev
# alternatively, you can try ...
sudo apt-get build-dep spring
... and that should install all the required dependencies (it should but it appears to be broken - SpliFF 2011-02-21).
NOTE: On Ubuntu the CMake scripts currently don't detect FREETYPE_INCLUDE_DIR. You will need to set this by hand (using -DFREETYPE_INCLUDE_DIR="/usr/include/freetype2/freetype" or by adding an 'advanced' entry in cmake-gui). (this problem is either not reproducible with Ubuntu 10.10, or not present in spring master anymore)
to speed up compiling/linking, you can install gold, an alternative linker and an ccache:
sudo apt-get install binutils-gold ccache
to make ccache useful, the cache size needs to be increased by:
ccache -M 5G
to set it to 5GB.
Gentoo
This has been tested to work with a clean install of gentoo 2008.0:
emerge cmake \>=media-libs/freetype-2.0.0 \>=media-libs/libsdl-1.2.0
emerge media-libs/openal media-libs/glew dev-libs/boost
emerge app-arch/zip media-libs/libogg
USE="png jpg tiff opengl" emerge media-libs/devil
Fedora
On Fedora 8:
yum install cmake boost-devel openal-devel SDL-devel \
DevIL-devel glew-devel libvorbis-devel
On Fedora 12-15:
yum install gcc-c++ cmake boost-devel DevIL-devel freetype-devel \
glew-devel libvorbis-devel libXcursor-devel openal-devel SDL-devel p7zip
Slackware
On Slackware 13, cmake, ogg & vorbis, boost, glew and SDL already come with the full regular install, both libs and headers. You can find helper scripts to easily compile and package DevIL, OpenAL and spring itself here.
Build And Install
Using CMake (2.6 or newer)
Configure and build:
cmake .
make spring
Install:
make install-spring
Default install paths are:
/usr/local/bin/spring Spring executable
/usr/local/share/games/spring read-only data
If you want ~/spring prefix instead of /usr/local, configure like this:
cmake -DCMAKE_INSTALL_PREFIX=~/spring .
For further ways of customizing your build, have a look at the variables shown with:
cmake -LH .
Ububtu 9.10 - if it cannot locate freetype include dir, then use:
cmake -DFREETYPE_INCLUDE_DIR=/usr .
If you experience performance problems on multi-core systems, you may additionally build the MT version of spring:
make spring-multithreaded
And install with:
make install-spring-multithreaded
Other targets are: spring-headless and spring-dedicated.
Linux specific Troubleshooting
Compiletime
invalid use of ILvoid / ALCvoid
NOTE: this was fixed for Slackware 13.1
During compiling, if you get a lot of the following errors:
/usr/include/IL/il.h:497: error: '<anonymous>' has incomplete type
/usr/include/IL/il.h:497: error: invalid use of 'ILvoid'
This happens because the version of libdevil-dev you have installed is not compatible with gcc version 4.2 and newer. Update it.
Ingame
Slow Mouse
Run:
echo '# Slow fullscreen cursor fix for Spring' >> ~/.xsessionrc
echo 'SDL_MOUSE_RELATIVE=0' >> ~/.xsessionrc
echo 'export SDL_MOUSE_RELATIVE' >> ~/.xsessionrc
And log out and log in again.
The mouse should now be as fast as in windowed mode.
Rotating Buildings
You can rotate a building before you give the build order, but the keys that do this do not work in Linux by default for some users. Issue the following commands in the beginning of the game:
/bind keycodex buildfacing inc
/bind keycodey buildfacing dec
Keycodex and keycodey above are just placeholders. What you want to write depends on which key you want to use. To see what keycodes any keys have, do:
/keydebug yes
And then hit the keys you want to use, and spring prints the keycodes in the message buffer.
If you want to save these keys you have to edit the uikeys.txt.
Problems with Audio
The engine needs at least OpenAL Soft 1.6 for its sound. If you still have the old openal-0.0.8 installed, you should update it.
Additionally, pulseaudio causes lots of issues, so try to disable it for spring if you have sound problems.
Desync in game
Spring only send the commands and not the result over the network, so it needs to run all math in a repeatable manner, so all other clients in a multiplayer match get the same results. So some CPU specific features have to enabled/disabled. If you desync, you either have a CPU that is not SSE1 capable, or you set the wrong -march/-mtune compiler flags. If you compile Spring via CMake, remove CMakeCache.txt, and leave the march flag at the default.
If You Still Have Problems
Join either IRC chat in #taspring on Freenode or #sy on QuakeNet, or ask for help in the lobby channels #sy or #springlobby.
However, generic Linux problems not really related to installing spring should be asked elsewhere.
Prepare to list your distribution, which installation method you used, and what exactly is the error.
FAQ
IRC
How
Okay, so you need human help. This is how NOT to do it:
15:54 -!- **** [n=****@*] has joined #taspring
15:54 < ****> Hi, i have a problem with compiling spring on debian
15:54 < ****> can anyone help me?
15:57 -!- **** [n=****@*] has quit [Client Quit]
Do not ask to ask, instead go straight to business by stating the exact problem you have, and giving all necessary information. What you were trying to achieve, how did you try to do it, what happened and what did you expect to happen.
Then WAIT for someone to notice you.
Where
- #sy @ QuakeNet
- #sy @ springrts.com (with a Spring lobby client only, f.e SpringLobby)
- #taspring @ FreeNode