Compilation on Linux
Each time Stellarium is released, the sourcecode is released in Sourceforge'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 Subversion. This may contain new features which have been implemented since the last release of Stellarium, so it's often more fun. Warning: Subversion 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.
First make sure all build dependencies are installed on your system.
We now use CMake instead of automake/autoconf. A common problem is that you don't have a recent enough version of CMake. Make sure you have the version specified in the build dependencies page (the error which is seen if you have an old version of CMake is something to do with curl).
If you have both QT version 4 development tools and QT version 3 development tools installed on your system, make sure the commands for moc, uic and so on point at the QT4 versions. Ubuntu/Debian users might want to use this script to swap between them.
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.9.1.tar.gz
You should now have a directory stellarium-0.9.1 with the source code in it.
- In a terminal and change into the source directory:
- Make the build directory and change into it
mkdir -p builds/unix cd builds/unix
- Configure the build using 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:
cmake -DCMAKE_INSTALL_PREFIX=/opt/mylocation ../..
- Run make
- Install the program (as root if necessary)
That's it. You should now have Stellarium built and installed. Build takes a few minutes on a P4 1.7Ghz/512 Mb.
Subversion (development) version
First, make sure you have all the Build Dependencies installed.
Getting the sourcecode
Execute these commands:
svn co https://stellarium.svn.sourceforge.net/svnroot/stellarium/trunk/stellarium stellarium
This will create the directory stellarium which contains the source code.
Building the source
- Change into the stellarium directory which was created by the svn command above
- 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:
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 ../.. builds/unix/src/stellarium
- If you want to install the program, from the builds/unix directory enter this command (as root if necessary):
If you have previously build the SVN code, but want to see what changes have been made since you did that, just cd into the stellarium directory and use the command:
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.
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.
Selecting the QT or SDL build
The binary releases of Stellarium 0.9.1 use QT to provide the main window instead of SDL which was used in previous releases. It is still possible to build Stellarium with the SDL library for this if you prefer it, although it is likely that this option will cease to be possible in future.
If you want to build and SDL version of Stellarium 0.9.1, edit the CMakeLists.txt file, and search through the file until you see this section:
########### Others ########### # Define if we want to manage the main window with SDL or Qt4 # Note that Qt4 is required in any case anyway SET(USE_QT4 1) #SET(USE_SDL TRUE)
Comment out the "SET(USE_QT4 1)" line and un-comment the SET(USE_SDL TRUE) line, so that part of the file looks like this:
########### Others ########### # Define if we want to manage the main window with SDL or Qt4 # Note that Qt4 is required in any case anyway #SET(USE_QT4 1) SET(USE_SDL TRUE)
Then build from the CMake stage, and you should get an SDL version.