Compilation on Linux

From Stellarium Wiki
Jump to: navigation, search

Each time Stellarium is released, the sourcecode is released in Github's packaging system. Building sourcecode that is released in this way should give you a working copy of Stellarium which is functionally identical to the binaries for that release.

It is also possible to get the "in development" sourcecode using Git. This may contain new features which have been implemented since the last release of Stellarium, so it's often more fun. Warning: Bazaar versions of the Stellarium sourcecode are work in progress, and as such may produce an unstable program, may not work at all, or may not even compile.

If you're new to the command line, you might also find this page interesting.


Building latest released version

First make sure all build dependencies are installed on your system (or see Older build dependencies for series 0.12).

Extract the tarball containing the source code. Open a terminal and cd to the directory where you wish to build Stellarium. Save the tarball to that directory and do this command in a terminal (if you prefer, you might use arK or some other graphical archive tool):

 $ tar zxf stellarium-0.13.3.tar.gz

You should now have a directory stellarium-0.13.3 with the source code in it.

  • In a terminal and change into the source directory:
cd stellarium-0.13.3
  • Make the build directory and change into it
mkdir -p builds/unix
cd builds/unix
cmake ../..

By default this will configure Stellarium to be installed in the /usr/local area. If you want another location, use this option to cmake, e.g.:

cmake -DCMAKE_INSTALL_PREFIX=/opt/stellarium ../..
  • Run make
  • Install the program (as root if necessary)
make install

That's it. You should now have Stellarium built and installed.

Creating source package

After building of Stellarium you can create a source package for distributions:

make package_source

Creating binary packages

After building of Stellarium you can create a binary packages for distributions.


  • After building of source code (simple binary package):
make package


  • After building of TGZ binary package (Note: a building recommended with -DCMAKE_INSTALL_PREFIX=/usr):
cpack -G RPM


  • After building of TGZ binary package (Note: a building recommended with -DCMAKE_INSTALL_PREFIX=/usr):
cpack -G DEB

Building latest development version

First, make sure you have all the build dependencies installed.

Getting the source code

Execute these commands:

git clone

This will create the directory stellarium which contains the source code.

Building from source

  • Change into the stellarium directory which was created by the bzr command above
cd stellarium 
  • Make a builds/unix directory and change into it:
mkdir -p builds/unix
cd builds/unix

By default this will configure Stellarium to be installed in the /usr/local/ area. If this is OK, run cmake like this:

cmake ../..

or, if you would prefer to specify an alternative installation prefix, select it like this

cmake -DCMAKE_INSTALL_PREFIX=/opt/mylocation/ ../..
  • Now build using make:
  • To run Stellarium from the source tree, change back to the root of the source tree, and call the binary like this:
cd ../..
  • If you want to run from the stellarium folder without using the terminal copy the stellarium binary from builds/unix/src to the stellarium folder. Then a click on the binary will start stellarium.
  • If you want to install the program, from the builds/unix directory enter this command (as root if necessary):
make install

Updating Git

If you have previously built the Git code, but want to see what changes have been made since you did that, just cd into the stellarium directory and use the command:

git pull

This will download just the changes which were made since you last retrieved files from the repository. Often, all that will be required is to build from the make stage, but if there are new files you will need to build from the CMake stage.

Enabling Sound and Video Support

Stellarium's sound and video support is a compile time option. To use sound in Stellarium you need to have a version of Qt which supports the multimedia[1]. You also need a recent version of cmake.

Sound support is controlled by the cmake option ENABLE_MEDIA. You can change this setting using cmake, by editing the CMakeCache.txt file, or by supplying the -DENABLE_MEDIA=1 option when you first run cmake.

Tested on Ubuntu: You need to install GStreamer plugins. Most critical seems to be gstreamer0.10-ffmpeg from, then it plays MP4 (h264), Apple MOV(Sorenson) and WMV. Some type of AVI failed. If Stellarium is built with ENABLE_MEDIA, package managers should also make sure to change dependencies to include these. (This is however a nonstandard ppa, not sure how to proceed here!)

Current Build Issues

Note that the development code is a work in progress, and as such, please don't expect it to build straight off the bat. Often it will be fine, but sometimes the build will be broken.

If the build seems to be broken for extended periods, try a thorough clean of the build directory (i.e. remove builds/unix), and start from the beginning. Check there are no new dependencies which you are missing. If you still have trouble, post to the forums or stellarium-pubdevel mailing list.

Could not find a package configuration file provided by "Qt5Positioning"

If you get the following error when executing cmake:

 -- Platform: Linux-4.4.0-64-generic
 -- Found Qt5: /usr/lib/x86_64-linux-gnu/qt5/bin/qmake (found suitable version "5.5.1")
 -- GPS: support by Qt's NMEA handling enabled.
 CMake Error at CMakeLists.txt:435 (FIND_PACKAGE):
 By not providing "FindQt5Positioning.cmake" in CMAKE_MODULE_PATH this
 project has asked CMake to find a package configuration file provided by
 "Qt5Positioning", but CMake did not find one.
 Could not find a package configuration file provided by "Qt5Positioning"
 with any of the following names:
 Add the installation prefix of "Qt5Positioning" to CMAKE_PREFIX_PATH or set
 "Qt5Positioning_DIR" to a directory containing one of the above files.  If
 "Qt5Positioning" provides a separate development package or SDK, be sure it
 has been installed.

Then either install the latest dependencies:

 sudo apt-get install libgps-dev libqt5positioning5 qtpositioning5-dev libqt5positioning5-plugins

or execute instead:



  1. You should install the qtmultimedia5-dev and libqt5multimedia5-plugins packages
Personal tools
in this wiki
other languages