Compilation on Mac OS X
This document attempts to describe how to build Stellarium for Macosx from source, post version 0.9.0. It tries to list all the dependencies and steps. This process ought to improve over time. It largely supersedes Building universal Stellarium 0.8.1 on an Intel Mac.
IMPORTANT: These instructions currently build Stellarium that is not a universal binary, it is specific to the machine (PPC or Intel) that it was made on. Universal binaries buildable by all is yet a goal for the Macosx port. The built Stellarium is also currently dependent on how and where libraries are installed on your system: if you've got some interesting setup, a build you make with it might not run so good on other macs with less interesting setups.
Before the list of build dependencies, there are some minimum system requirements to follow these instructions:
- Macosx 10.4, as most recent as possible. As of this writing 2007-07-02, 10.4.10 is available and known to work for both PPC and Intel. Earlier versions might work, but I don't know, and more steps might be needed. Note also that 10.4.7 should be avoided at all costs.
- Xcode as recent as possible. This author has Xcode 2.4.1. See . Earlier versions might work, but I don't know, and more steps might be needed.
- fink installed, preferably in the default /sw. See  or
- MacPorts installed. See .
From the list of build dependencies, we need to actually *think* about only the following:
- Cmake, from 
- libpng, get this via fink with "fink install libpng3" (you might need "sudo" in front of that)
- libjpeg, get this via fink with "fink install libjpeg" (likewise)
- libboost, get this via fink with "fink install boost1.33" (1.33 was most current as of this writing)
- libsdl, this can also be finked with "fink install sdl-shlibs"
- Qt 4.3, go out to , look for their open-source downloads of Qt/Mac. This should be installed the default way.
- SDL_mixer, if and only if you want audio. This I had to compile especially (get from []), the fink build had some hidden dependencies (timidity, for instance, wants things in /usr/local...) that I removed with this configure for SDL_mixer:
CPPFLAGS="-I/sw/include -I/sw/include/ogg" LDFLAGS="-L/sw/lib" ./configure --prefix=/sw --disable-music-midi --disable-music-timidity-midi --disable-music-ogg-shared --disable-music-mp3-shared --enable-music-ogg --enable-music-mp3
- subversion, here I found fink's svn not so good for 1.4.3, I had to resort to . Another option is this package by Martin Ott, Developer of CodingMonkeys
Just type this one command in Terminal
sudo port install subversion cmake boost libsdl_mixer libsdl qt4-mac freetype
Advantage of this setup is, that you use the macports cmake, so you dont have to manually specify include-dirs and paths for qt, sdl and fonts (see below).
Make a directory
And in that directory in your favorite shell, utter the svn command to check out the source:
svn co https://stellarium.svn.sourceforge.net/svnroot/stellarium/trunk/stellarium stellarium
Now things start to look like the linux instructions some:
cd stellarium mkdir -p builds/macosx cd builds/macosx
Now the moment of truth: the cmake command (i'm in bash!):
SDL_INCLUDE_DIR=/sw/include/SDL cmake -G "Unix Makefiles" ../..
This says: set the environment variable SDL_INCLUDE_DIR to /sw/include/SDL, use the "Unix Makefiles" generator of cmake. If it doesn't find Qt, you should maybe append the path to Qt to your shell path:
It will think about that for a bit, and then complain:
CMake Error: Error in cmake code at /Users/Shared/stellarium/stellarium/cmake/FindFreeType2.cmake:41: MESSAGE Could not find the FreeType2 library and header files. Current CMake stack: /Users/Shared/stellarium/stellarium/CMakeLists.txt;/usr/share/cmake-2.4/Modules/CMakeCInformation.cmake;/usr/share/cmake-2.4/Modules/CMakeCXXInformation.cmake;/Users/Shared/stellarium/stellarium/cmake/FindFreeType2.cmake
This is all right: cmake never seems to be able to correctly find freetype2 here on the mac. You are still in builds/macosx. In this directory now there should be a CMakeCache.txt file. Edit that file, and find the line:
and change it to read:
Now utter the same cmake command a second time, and it should think some more, and end up with:
-- Configuring done -- Generating done -- Build files have been written to: /Users/Shared/stellarium/stellarium/builds/macosx
Now we can perform the build itself, two steps:
make make install make macosx_bundle
Now up in /Users/Shared/stellarium, you ought to see a Stellarium.app, ready to run!
With current revision (rev 2567) of source code (as of 2007-10-24), the app will crash when launched from the Finder. To get it work, you'll have to launch it from the terminal:
Or you can fix where the app looks for the dynamic lib, like this:
cd /Users/Shared/stellarium/Stellarium.app/Contents/MacOS/ install_name_tool -change libstelMain.dylib @executable_path/libstelMain.dylib stellarium
This way the app should launch correctly from the Finder. --Mina 12:02, 24 October 2007 (PDT)
You can check to see if the source code has been updated on the server at any time by going in a terminal window to
And entering the command
svn -u status
Any file that it mentions is either changed locally, or changed on the server (svn help status for details of the output of this command). Unless you are working on the source code yourself, anything mentioned is an update. You can update from this directory also with
IMPORTANT: you should delete or move aside the old /Users/Shared/stellarium/Stellarium.app before each new build.
Why Not Xcode?
Cmake has an Xcode generator (as opposed to "Unix Makefiles"), but I haven't had good luck with it. The xcodeproj files generated are not readable by the xcode here. I don't know if that is a fault of my environment (which I do not think is special), or something else.
Cmake generally has made this whole compilation process on the mac both more repeatable, and more like the other platforms (or, at least, more like the unix and such...). This is a Good Thing.
All kinds of things might go wrong!
- if the cmake or the build complains about a missing library, it might need installation. Start with fink.
- if the compilation breaks on some code, it may be that the developers are in the middle of something, and come back in a svn revision or so.
- anything else I haven't remembered or encountered!
Loadable Module Support
I was able to get loadable module support working, and have submitted patches for the CMakeLists.txt files in StellaGui and HelloStelModule. These build straightforwardly:
- edit the top-level CMakeLists.txt file to point to where your real stellarium source and build directories are.
- make builds/macosx and cd to it
- run cmake and make:
cmake -G "Unix Makefiles" ../.. make make install
and you should have StellaGui or HelloStelModule as a directory in builds/macosx, which you can copy to ~/Library/Preferences/Stellarium/modules/ (you may have to make that directory).
- make the build a universal binary (somehow...)