Building Spring on Linux: Difference between revisions

From Spring
Jump to navigationJump to search
Hoijui (talk | contribs)
 
(62 intermediate revisions by 17 users not shown)
Line 2: Line 2:


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


<font style="color: #f44">'''Warning: Be carefull when building from source. You might encounter sync errors in online play if you are using special compilers (all GCC from the 4.x series should be safe) or unstandard compiler settings (be carefull about -march)!'''</font>
<span class=warning>'''Warning:'''<br/>
<br/><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>


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


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


== Full list ==
== Full list ==
Line 26: Line 30:
*** ''make''
*** ''make''
* Libraries
* Libraries
** SDL
** SDL2
** ''boost'' (version 1.35 or later)
*** ''threads''
*** ''regex''
*** ''signals''
*** ''system''
** ''libdeviL'' (IL)
** ''libdeviL'' (IL)
** OpenAL (openal-soft, older openal-0.0.8 does not work)
** OpenAL (openal-soft, older openal-0.0.8 does not work)
** OpenGL headers (mesa, GLEW, etc.)
** OpenGL headers (mesa, GLEW, etc.)
** ''zlib''
** ''zlib''
** ''freetype6''
** ''freetype'' (2)
** ''ogg'', ''vorbis'' and ''vorbisfile''
** ''ogg'', ''vorbis'' and ''vorbisfile''
* Optional (for AI Interfaces and Skirmish AIs)
** ''curl''
* Optional (for AI Interfaces, Skirmish AIs and unit tests)
** ''python'' (2.5+)
** ''python'' (2.5+)
** ''jdk'' (1.5+)
** ''jdk'' (1.5+)
** ''boost'' (version 1.47 or later)
*** ''chrono''
*** ''filesystem''
*** ''threads''
*** ''system''
*** ''chrono''


== Debian ==
== Debian ==


For Etch (debian 4.0 stable) and Sid (debian unstable), I've confirmed the
For Jessie (debian 8.0 stable) this should work:
following to be the minimal set that is necessary to get. This works with Ubuntu 8.10, too.
The version of spring from git repository depends on boost at least version 1.35.* (if your distro is behind you can try [https://launchpad.net/~pgquiles/+archive/ppa some unofficial backports]) and won't work on lower versions.


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


<code><pre>
sudo aptitude install build-essential zlib1g-dev libfreetype6-dev
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


</pre></code>
=== Ubuntu  ===
<pre>
# compiler and build tools
sudo apt-get install build-essential cmake cmake-gui git


and either scons and python2.5-dev or 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.
# 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>


=== Ubuntu 8.04 ===
to speed up compiling/linking, you can install gold, an alternative linker and when you plan to develop / recompile often ccache :
Additionally you will need to install these packages:
 
<code><pre>
<pre>sudo apt-get install binutils-gold ccache</pre>
apt-get install p7zip-full libboost-thread1.40-dev libboost-regex1.40-dev
 
apt-get install libboost-program-options1.40-dev libboost-signals1.40-dev
 
</pre></code>
to make ccache useful, the cache size needs to be increased by:
(or exchange the libboost 1.40 for 1.37 if you're using that version)
 
<pre>ccache -M 5G</pre>
 
to set it to 5GB.


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


<code><pre>
<pre>
emerge cmake \>=media-libs/freetype-2.0.0 \>=media-libs/libsdl-1.2.0
emerge cmake \>=media-libs/freetype-2.0.0 \>=media-libs/libsdl-2
emerge media-libs/openal media-libs/glew dev-libs/boost
emerge media-libs/openal media-libs/glew dev-libs/boost
emerge app-arch/zip media-libs/libogg
emerge app-arch/zip media-libs/libogg
USE="png jpg tiff opengl" emerge media-libs/devil  
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.


== Fedora ==
== Fedora ==


On Fedora 8, these dependencies should be sufficient:
On Fedora 31:


<code><pre>
<pre>
yum install cmake boost-devel openal-devel SDL-devel \
sudo dnf install gcc-c++ cmake boost-devel DevIL-devel freetype-devel libunwind-devel \
DevIL-devel glew-devel libvorbis-devel  
glew-devel libvorbis-devel libXcursor-devel openal-devel SDL2-devel p7zip jsoncpp-devel
</pre></code>
</pre>


On Fedora 12, these dependencies should be sufficient:
== Slackware ==


<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].
yum install gcc-c++ cmake boost-devel DevIL-devel freetype-devel \
glew-devel libvorbis-devel libXcursor-devel openal-devel SDL-devel p7zip
</pre></code>


== Slackware ==
Try to use [http://idlemoor.github.io/slackrepo/ slackrepo], will search, update and install spring and dependences.
 
On Slackware 13, cmake, ogg vorbis, boost, glew and SDL already come with the full regular install, both libs and headers. Also [http://slackbuilds.org/ here] you will find helper scripts to easily compile and package DEvIL, openAL and spring itself.


= Build And Install =
= Build And Install =
Line 106: Line 121:
Configure and build:
Configure and build:


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


Install:
Install:


<code><pre>
<pre>
make install-spring
make install-spring
</pre></code>
</pre>




Line 124: Line 139:
<code>/usr/local/share/games/spring</code> read-only data
<code>/usr/local/share/games/spring</code> read-only data


If you want <code>/usr</code> prefix instead of <code>/usr/local</code>, configure like this:
If you want <code>~/spring</code> prefix instead of <code>/usr/local</code>, configure like this:


<code><pre>
<pre>
cmake -DCMAKE_INSTALL_PREFIX=/usr .
cmake -DCMAKE_INSTALL_PREFIX=~/spring .
</pre></code>
</pre>
For further ways of customizing your build, have a look at the variables shown with:
For further ways of customizing your build, have a look at the variables shown with:
<code><pre>
<pre>
cmake -LH .
cmake -LH .
</pre></code>
</pre>
 
If you experience performance problems on multi-core systems, you may additionally build the MT version of spring:
 
<code><pre>
make spring-mt
</pre></code>
 
And install with:
<code><pre>
make install-spring-mt
</pre></code>
 
Other targets are: <code>spring-hl</code> and <code>spring-dedicated</code>.


== Using Scons ==
Configure and build:
<code><pre>
scons configure
scons
</pre></code>
Install:


<code><pre>
For other targets see the output of <code>make help</code>.
scons install
</pre></code>


<br/>
= See Also: =
{{Finalizing_linux_install}}
* [[Finalizing_linux_install]]
* [[Troubleshooting_linux]]


<br/>
{{Troubleshooting_linux}}


[[Category:Compiling]]
[[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: