Lab Notes - Compiling Stellarium 0.12.n in OS X
Stellarium is an excellent open source application used for astronomy. It is not directly developed for the iMac and OS X, but uses cross platform components which allow it to be compiled on other operating systems. As development is not OS X specific, it relies on volunteers who give their own time to compile versions for Intel and PPC versions. Here we will attempt to cover how to compile under OS X on an Intel iMac with Lion from original source code, to make up to date versions easier to compile. Original source of these notes is the Stellarium website, but we have modified them specifically for our iMac.
Original Stellarium Wiki link http://stellarium.org/wiki/index.php/Compilation_on_Mac_OS_X
Pre-requisites - OS X:
|Tool||Source and File||Lab Version|
|You need a machine with Mac OS X 10.4 (latest version 10.4.11) or later.
||App Store||Lion 10.7.5 / 14/04/2013|
Install the latest version of Apple's Developer Tools: http://developer.apple.com/technology/xcode.html
Apple's latest Xcode Developer Tools (version 4.4 or later for Mountain Lion, 4.1 or later for Lion), are found at the Apple Developer Connection site, or in the Mac App Store.
Xcode 4 and later users need to first accept the Xcode EULA by either launching Xcode or running:
Note: if upgrading from a previous version of Xcode that is not stand-alone, the previous Xcode folders are removed and you may loose other tools installed in these folders - in our case the Qt libraries were removed. This would show up as missing files in CMake. Xcode should be upgraded and the Qt install below re-run if necessary.
|App Store||4.6.1 / 14/04/2013|
Third party tools required:
|Tool||Source and File||Lab Version|
|Install the latest version of Qt libraries.
The main pkg file in the dmg will guide you through the steps to getting Qt 4.8.5 Opensource Edition installed on your machine.
After a successful install, you can find most new things in /Developer. Specifically things will be located in the following places:
• Qt Designer, Qt Linguist: /Developer/Applications/Qt
- the above script can be run via terminal and from the /Developer/Tools directory via the command "sudo python uninstall-qt.py" or as "sudo python /Developer/Tools/uninstall-qt.py"
Note this is from the root directory "Developer" not the user sub-directory "Developer".
Qmake, moc etc are searched for in the cmake process.
The above link is to install a version of Qt 4.8.5 without debug chars. This reduces the size of the final app once built.
Requires Xcode 4.1 or later for Lion, and its command line developer tools which can be installed from within Xcode itself now.
Macports can be installed from the Macports website listed on the right, once installed you can use the command in Terminal sudo port -v selfupdate to update the current MacPorts install.
Use in Terminal sudo port install intltool (which will install all you need).
To list installed ports use command in Terminal port list installed
To upgrade already installed ports use the command sudo port upgrade outdated
Install the latest version of cmake via Terminal using
$ sudo port install cmake
|Install bazaar making use of macports via Terminal
$ sudo port install bzr
Install from download.
Building Stellarium itself:
Create a build directory under your user home folder with Finder or shell - the following directory is just an example, you can pick any name and path you want. This directory may already exist for projects if
you have used Xcode, and we have used this directory to keep all projects
|2||Using 'Finder' open folder 'Developer', if a previous stellarium 'branch' directory exists, then rename 'stellarium_nn' where 'nn' is a number.
|3||Using shell change to Developer directory and in that directory checkout the sources with the bzr command
- this does require a shell session. This will download the
stellarium source into a new folder called "stellarium", under the
"Developer" folder. Note that at any point you can delete this "stellarium" folder and
and start the download process again from step 3.
$ cd ~/Developer
$ bzr branch lp:stellarium stellarium
|4||We setup the build directory under
the "stellarium" folder once it is downloaded.
$ cd stellarium
$ mkdir -p builds/macosx
[-p: the parameter will also create all directories leading up to the given directory that do not exist already. If the given directory already exists, ignore the error]
$ cd builds/macosx [Example Screen 3]
If anything goes wrong in later steps we can delete the contents of macosx and start again at step 4.
|5||Then we run cmake - No changes to CMakeLists.txt at this time.
$ cmake ../..
|6||Then we run make to compile all the objects from
the CMake files lists.
|8||To produce the final package that
can run as a standalone application:
$ make install
$ make macosx_bundle
The app package is built in macosx.
|Typical Build Log|
To repeat the process, return to step 2.