Building_Spring_on_Linux - beyond-all-reason/springrts_engine_wiki_mirror GitHub Wiki

Development < Building Spring <

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.6 series should be safe)
  • you use non-standard compiler settings (be careful about -march)!

Obtaining the Source

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
    • SDL2
    • 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
    • curl
  • Optional (for AI Interfaces, Skirmish AIs and unit tests)
    • python (2.5+)
    • jdk (1.5+)
    • boost (version 1.47 or later)
      • chrono
      • filesystem
      • threads
      • system
      • chrono

Debian

For Jessie (debian 8.0 stable) this should work:

sudo apt-get install build-essential zlib1g-dev libfreetype6-dev cmake \
libsdl2-dev libopenal-dev libglew-dev zip libvorbis-dev libxcursor-dev \
libdevil-dev libboost-system1.55-dev libboost-thread1.55-dev \
libboost-regex1.55-dev libboost-serialization1.55-dev \
libboost-program-options1.55-dev libboost-chrono1.55-dev \
libunwind-dev  libboost-filesystem1.55-dev \
libboost-signals1.55-dev libboost-test1.55-dev \
xsltproc libfontconfig1-dev libcurl4-openssl-dev

Ubuntu

# compiler and build tools
sudo apt-get install build-essential cmake cmake-gui git

# spring dependencies
sudo apt-get install libglew-dev libsdl2-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 \
 libboost-chrono-dev libboost-filesystem-dev libunwind8-dev \
 default-jdk libcurl4-gnutls-dev

to speed up compiling/linking, you can install gold, an alternative linker and when you plan to develop / recompile often 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-2
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

Or better you install Spring via layman, it will install all dependencies.

Fedora

On Fedora 31:

sudo dnf install gcc-c++ cmake boost-devel DevIL-devel freetype-devel libunwind-devel \
glew-devel libvorbis-devel libXcursor-devel openal-devel SDL2-devel p7zip jsoncpp-devel

Slackware

On Slackware 13, cmake, ogg & vorbis, boost, glew and SDL2 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.

Try to use slackrepo, will search, update and install spring and dependences.

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 .

For other targets see the output of make help.

See Also:

Category:Compiling Category:Linux

⚠️ **GitHub.com Fallback** ⚠️