Building Spring on Linux: Difference between revisions

From Spring
Jump to navigationJump to search
Dimko (talk | contribs)
No edit summary
Dimko (talk | contribs)
No edit summary
Line 135: Line 135:


{{Troubleshooting_linux}}
{{Troubleshooting_linux}}
i didnt screw anything up, i only added one last line

Revision as of 21:47, 7 February 2009

Build From Source on Linux

For other platforms see Building Spring


If prefer to use your distributions package system, 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: You might encounter sync errors in online play if you are not using the exact same version of the compiler and same compiler settings as used for prebuilt packages! (Applies to GCC <4.0)

For 0.77b5 these are: TODO add them here.


Get Source

You can either download the source as a tarball (recommended; v. 0.77b5) or get it from the subversion repository. Either way, the result is the same.

Tarball

cd /usr/local/src # or /var/tmp, or whatever
wget http://planetspring.free.fr/spring/src/spring_0.77b5-spring_0.77b5_src.tar.bz2
tar xjf spring_0.77b2-spring_0.77b5_src.tar.bz2
cd spring_0.77b5

NOTE: The .zip release is for windows only. Linux users have to get .bz2 like shown above.

Subversion

aptitude install subversion # if you are not on debian, figure it out
svn co https://spring.clan-sy.com/svn/spring/tags/spring_0.77b5 \
	/usr/local/src/spring_0.77b5
cd /usr/local/src/spring_0.77b5

If the above subversion host happens to be down (which is unlikely since you're reading this wiki page now), you can try the following hourly updated mirror (replace the svn co line above with the following line):

svn co svn://caspring.org:3691/tags/spring_0.77b5 \
	/usr/local/src/spring_0.77b5

Dependencies

You will need 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. The scons configure will whine if you forget something, but it does not check if you remembered to install zip, even though you still need it.

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. that Spring 0.77b5 depends on the boost libraries version 1.34.* and won't work on lower versions. (updated libboost-serialization-dev, and libvorbis-dev dependencies for 0.76b1)

Also, on 64-bit be sure to build against devIl 1.6.8-rc2 or higher, 1.6.7 has a bug in the PNG loading code that causes issues.

sudo aptitude install scons build-essential zlib1g-dev libfreetype6-dev
sudo aptitude install libsdl1.2-dev libopenal-dev libglew-dev libboost-dev
sudo aptitude install libboost-thread-dev libboost-regex-dev libdevil-dev
sudo aptitude install libboost-serialization-dev python2.5-dev zip
sudo aptitude install libvorbis-dev libxcursor-dev

Gentoo

This has been tested to work with a clean install of gentoo 2007.0:

emerge dev-util/scons \>=media-libs/freetype-2.0.0 \>=media-libs/libsdl-1.2.0
emerge media-libs/openal =dev-lang/python-2.4\* media-libs/glew dev-libs/boost
emerge media-libs/devil app-arch/zip media-libs/libogg

Fedora

On Fedora 8, these dependencies should be sufficient:

yum install scons boost-devel openal-devel SDL-devel \
DevIL-devel glew-devel java-1.7.0-icedtea-devel libvorbis-devel 

Fedora 9 has issues with 0.76b1, because it uses GCC 4.3 which changed a few compilation warnings into errors. However, the inofficial Linux installer may work for you (it installs a precompiled binary).

Build And Install

The build will spew out warnings like the following, which you can safely ignore:

warning: division by zero
warning: 'q' may be used uninitialized in this function

Using Scons

Configure and build:

scons configure
scons

Install:

scons install

Using CMake (2.6 or newer)

Configure and build:

cmake .
make

Install:

make install


Your paths are: Spring executable in /usr/local/games/spring and read-only data in /usr/local/share/games/spring.


Finalizing installation

You should have Spring installed by now; if not, please see the SetupGuide.

Maps & Mods

Since Spring is only an engine, you need to download games for it, and the maps that go with those games.

SpringLobby will automatically do this for you when you attempt to join a game with a map or mod that you do not currently have, using an integrated downloader.

If you want to download it manually or browse existing maps, there are several easy to use websites:

Pick any of those sites, download a map or mod, and then double click it. This will move it to your Spring folder, using the spring map/mod installer program. If you wish to move maps/mods by hand, they are located under ~/.spring/maps/ or ~/.spring/mods/ (if the folder does not exist - create it). Do not unpack the file in any way though, just download and save it. Reload your maps/mods in SpringLobby, (Tools - Reload maps/mods) and they will be ready to use.

These sites also may provide other neat things like Lua widgets, epic replays, AI bots (for playing offline or to team up on with a friend). Generally the installation requires you to download the file and place it in the appropriate folder in your ~/.spring directory. (you may have to create the folder)

Hint: If you know the name of the map you want, there is a Search function provided in those websites. Just write a part of the name, like one word, and you will easily find the map you were looking for.

Template:Linux tips

Linux specific Troubleshooting

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.

See also