Compilation on Mac OS X
This document describes how to build Stellarium from sources on Mac OS X. This process ought to improve over time.
The set of instructions was written for the 0.13.0 and later releases and using an Intel machine with Mountain Lion (10.8) or later, including El Capitan (10.11.6 at the moment). No universal builds were made since a lot of time (version 0.11.3, 2012-07-31).
Prepare Mac OS X to build Stellarium
First step: Install Developer Tools and Qt
- Install the latest version of Apple's Developer Tools: https://developer.apple.com/xcode/
- Install the latest stable version of Qt5 (5.6.1 at the moment): http://www.qt.io/download-open-source/ (offline installer)
- Add Qt5 to your PATH environment variable, adding to your .bash_profile file the following line:
Second step: Install CMake and Bazaar
You need some tools to build Stellarium on OS X. These tools are CMake and Bazaar. There are (at least) two simple options to install these tools on OS X. Choose only one of them (HomeBrew or MacPorts).
Option 1: With HomeBrew
Simpler, lighter and safer (doesn't need sudo) than MacPorts.
- Install HomeBrew: http://brew.sh
- Install CMake:
$ brew install cmake
- Install Bazaar:
$ brew install bazaar
- (optional) Install (and link) Gettext:
$ brew install gettext; brew link gettext --force
Option 2: With MacPorts
- Install MacPorts: http://www.macports.org/install.php
- Install CMake:
$ sudo port install cmake
- Install Bazaar:
$ sudo port install bzr
Last step: Restart terminal session
Don't forget to restart your terminal session, so that your new PATH setting is taken in account.
Building Stellarium itself
Create a build directory with your favorite shell (the following directory is just an example, you can pick any name and path you want)
$ mkdir ~/Development $ cd ~/Development
Getting Stellarium source code
In that directory checkout the sources with the bzr command
$ bzr branch lp:stellarium stellarium
For more details, see the Bazaar checkout instructions.
If you have already done it once, you have just to update your copy using this bzr command
$ bzr pull
Time to compile Stellarium
We setup the build directory
$ cd stellarium $ mkdir -p builds/macosx $ cd builds/macosx
We run cmake (see other configuration build options here) ...
$ cmake ../..
... or, if we want a release build (instead of a debug one), ...
$ cmake -DCMAKE_BUILD_TYPE=Release ../..
... and we compile
Optionnaly, we test our build
$ make tests
IMPORTANT: you should delete or move aside the old Stellarium.app before each new build:
$ rm -r Stellarium.app/
Then make the Mac OS X application:
$ make install $ make mac_app
The mac_app target includes a python script that makes use of otool and install_name_tool to:
- read the link dependencies of Stellarium.app/Contents/MacOS/stellarium,
- copy those dependencies into the app (.frameworks and .dylibs),
- recurse on those copied-in dependencies, stopping at a point where system libraries are called for.
Creating DMG (Apple Disk Image)
$ mkdir Stellarium $ cp -r Stellarium.app Stellarium $ hdiutil create -format UDZO -srcfolder Stellarium Stellarium.dmg
We recommend Qt Creator
The core group of developers of stellarium uses QtCreator as main IDE, its integration with Qt and the possibility of having a consistent tool through different platforms makes it the most suitable option for our goals.
All kinds of things might go wrong!
We will write here the most frequent problems and the possible solutions found by the developers.
Missing Qt Packages
If during the
cmake process, you receive an error like:
CMake Error at CMakeLists.txt:271 (FIND_PACKAGE): By not providing "FindQt5Core.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "Qt5Core", but CMake did not find one. Could not find a package configuration file provided by "Qt5Core" with any of the following names: Qt5CoreConfig.cmake qt5core-config.cmake Add the installation prefix of "Qt5Core" to CMAKE_PREFIX_PATH or set "Qt5Core_DIR" to a directory containing one of the above files. If "Qt5Core" provides a separate development package or SDK, be sure it has been installed.
CMAKE_PREFIX_PATH to the location of the your Qt install, something like
$ export CMAKE_PREFIX_PATH=~/Qt/5.7/clang_64