Building Spring on Linux: Difference between revisions

From Spring
Jump to navigationJump to search
Andre (talk | contribs)
No edit summary
 
(97 intermediate revisions by 27 users not shown)
Line 1: Line 1:
== Build From Source ==
[[Engine_Development|Development]] < [[Building_spring|Building Spring]] < {{FULLPAGENAME}}


'''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)'''
= Build From Source on Linux =
If you prefer to use your distributions package system (release versions only), refer to the Linux [[SetupGuide]].


For 0.77b5 these are: TODO add them here.
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.


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.
<span class=warning>'''Warning:'''<br/>
'''Be careful when building from source.'''<br/>
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'')!
</span>


=== Get Source ===
== Obtaining the Source ==
{{Obtaining_The_Source_Code}}


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.
= Get Dependencies =


==== Tarball ====
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.


<code><pre>
If your distributions is not listed below, you should be able to figure out the correct package names from this.
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
</pre></code>


'''NOTE: The .zip release is for windows only. Linux users have to get .bz2 like shown above.'''
== 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''


==== Subversion ====
== Debian ==


<code><pre>
For Jessie (debian 8.0 stable) this should work:
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
</pre></code>


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):
<pre>
<code><pre>
sudo apt-get install build-essential zlib1g-dev libfreetype6-dev cmake \
svn co svn://caspring.org:3691/tags/spring_0.77b5 \
libsdl2-dev libopenal-dev libglew-dev zip libvorbis-dev libxcursor-dev \
/usr/local/src/spring_0.77b5
libdevil-dev libboost-system1.55-dev libboost-thread1.55-dev \
</pre></code>
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
</pre>


=== 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.
=== Ubuntu  ===
<pre>
# compiler and build tools
sudo apt-get install build-essential cmake cmake-gui git


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.
# 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
</pre>


==== Debian ====
to speed up compiling/linking, you can install gold, an alternative linker and when you plan to develop / recompile often ccache :


For Etch (debian 4.0 stable) and Sid (debian unstable), I've confirmed the
<pre>sudo apt-get install binutils-gold ccache</pre>
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.


<code><pre>
to make ccache useful, the cache size needs to be increased by:
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
</pre></code>


==== Gentoo ====
<pre>ccache -M 5G</pre>
This has been tested to work with a clean install of gentoo 2007.0:


<code><pre>
to set it to 5GB.
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
</pre></code>


==== Fedora ====
== Gentoo ==
This has been tested to work with a clean install of gentoo 2008.0:


On Fedora 8, these dependencies should be sufficient:
<pre>
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
</pre>


<code><pre>
Or better you install Spring via [http://springrts.com/wiki/Gentoo_install layman], it will install all dependencies.
yum install scons boost-devel openal-devel SDL-devel \
DevIL-devel glew-devel java-1.7.0-icedtea-devel libvorbis-devel
</pre></code>


Fedora 9 has issues with 0.76b1, because it uses GCC 4.3 which changed a few compilation warnings into errors. However, the [http://spring.clan-sy.com/phpbb/viewtopic.php?f=20&t=12802 inofficial Linux installer] may work for you (it installs a precompiled binary).
== Fedora ==


=== Build And Install ===
On Fedora 31:


The build will spew out warnings like the following, which you can safely ignore:
<pre>
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
</pre>


<code><pre>
== Slackware ==
warning: division by zero
warning: 'q' may be used uninitialized in this function
</pre></code>
==== Using Scons ====
Configure and build:


<code><pre>
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 [http://slackbuilds.org/ here].
scons configure
scons
</pre></code>


Install:
Try to use [http://idlemoor.github.io/slackrepo/ slackrepo], will search, update and install spring and dependences.


<code><pre>
= Build And Install =
scons install
</pre></code>


==== Using CMake (2.6 or newer) ====
== Using CMake (2.6 or newer) ==
Configure and build:
Configure and build:


<code><pre>
<pre>
cmake .
cmake .
make
make spring
</pre></code>
</pre>


Install:
Install:


<code><pre>
<pre>
make install
make install-spring
</pre></code>
</pre>
 
 
Default install paths are:
 
<code>/usr/local/bin/spring</code> Spring executable
 
<code>/usr/local/share/games/spring</code> read-only data
 
If you want <code>~/spring</code> prefix instead of <code>/usr/local</code>, configure like this:
 
<pre>
cmake -DCMAKE_INSTALL_PREFIX=~/spring .
</pre>
For further ways of customizing your build, have a look at the variables shown with:
<pre>
cmake -LH .
</pre>




Your paths are: Spring executable in <code>/usr/local/games/spring</code> and
For other targets see the output of <code>make help</code>.
read-only data in <code>/usr/local/share/games/spring</code>.


{{Finalizing_linux_install}}
= See Also: =
* [[Finalizing_linux_install]]
* [[Troubleshooting_linux]]


{{Linux_tips}}


{{Troubleshooting_linux}}
[[Category:Compiling]]
[[Category:Linux]]

Latest revision as of 08:42, 11 May 2020

Development < Building Spring < Building Spring on Linux

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

Tarballs

(For playing online official games on lobby.springrts.com - the spring lobby server)

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

Master repo URI: git://github.com/spring/spring.git
Backup repo: git://git.code.sf.net/p/springrts/code

Branches of interest:

  • master - latest stable, enforced for official games on lobby.springrts.com
  • maintenance - fixes for the latest stable
  • develop - major developments (most active, larger developments)

Assuming the GIT command line client is installed, you can clone (get locally) the repository with the commands below.

Latest Stable (master branch, useless for development purposes, lives as maintenance moving forward)

git clone --recursive git://github.com/spring/spring.git -b master

To later update it (get the changes other people did) with:

git pull --rebase

Maintenance (maintenance branch)

git clone --recursive git://github.com/spring/spring.git -b maintenance

Bleeding-edge (develop branch)

git clone --recursive git://github.com/spring/spring.git -b develop

Working with git

Please note that patches to the code must be done for either develop or maintenance. Such patches can be then sent 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.

Note: you can switch branches this way:<syntaxhighlight lang="bash">

  1. (optional) backup your current code changes

git stash

  1. switch branch

git checkout $MY_OTHER_BRANCH

  1. sometimes needed
  2. note, it deletes all your unstashed changes and all non-pushed commits on the new branch,
  3. but it doesn't delete untracked files.
  4. git reset --hard
  1. update/sync with remote repo

git pull --rebase

  1. (optional) if you want to apply the code changes backed-up in the first step
  2. git stash pop # reapplies your changes and DELETES the backup
  3. or
  4. git stash apply --index 0 # reapplies your changes and keep the backup (see `git stash list`)

</syntaxhighlight>

Submodules

To obtain the submodules you should clone the repository with --recursive as mentioned above. If you haven't done this, you can execute the following code <syntaxhighlight lang="bash"> git submodule sync git submodule update --init

</syntaxhighlight>

To update the submodules, you have to execute the same commands again or pull normally.

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: