This document describes how to build Stellarium from sources on Mac OS X. This process ought to improve over time.

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.10.4 release and using an Intel machine with Leopard (10.5). The process has been validated on 10.6, 10.7 and 10.8.x.

+

The set of instructions was written for the 0.13.0 release and using an Intel machine with Mountain Lion (10.8) or later (10.8.5 at the moment)<ref>If you build Stellarium 0.10.6+ by yourself on Mac OS X 10.4.11 then you need edit info.plist file then change value for LSMinimumSystemVersion key. You'll have to get [ftp://ftp.qt.nokia.com/qt/source/ older versions of Qt (Carbon)] too, if you want to create universal binaries (PPC and Intel).</ref>.

== Prepare Mac OS X to build Stellarium ==

== Prepare Mac OS X to build Stellarium ==

−

Since Stellarium version 0.10.6, you need a machine with Mac OS X 10.5. These instructions were tested with Mac OS X 10.6 (latest version 10.6.8) or later<ref>If you build Stellarium 0.10.6+ by yourself on Mac OS X 10.4.11 then you need edit info.plist file then change value for LSMinimumSystemVersion key. You'll have to get [ftp://ftp.qt.nokia.com/qt/source/ older versions of Qt (Carbon)] too, if you want to create universal binaries (PPC and Intel).</ref>.

+

'''Note: if you need an universal binary, see section [[#Compiling dependencies to build an universal binary|Compiling dependencies to build an universal binary]] below.'''

# Install the latest version of Apple's Developer Tools: http://developer.apple.com/technology/xcode.html

# Install the latest version of Apple's Developer Tools: http://developer.apple.com/technology/xcode.html

−

# Install the latest version of cmake: http://www.cmake.org/cmake/resources/software.html

+

# Install the latest stable version of Qt5 from the dmg (5.1.1 at the moment): http://qt-project.org/downloads#qt-lib ([http://download.qt-project.org/official_releases/qt/5.1/5.1.1/qt-mac-opensource-5.1.1-clang-offline.dmg direct download])

−

# Install the latest version of Qt Libraries from the dmg (4.8.2 at the time these instructions were written): http://qt.nokia.com/downloads/downloads#qt-lib

We have to compile the dependencies with special flags to be able to generate an universal binary. If you don't intend to create an universal package you can skip this and going to the next section: [[#Building stellarium itself]]

+

−

+

−

In case you are compiling in a Leopard or Snow Leopard machine you have to recompile stellarium dependencies making use of the oldest system libraries (in our case those in 10.4 aka Tiger). We need the following compilation flags:

+

−

+

−

a. We want to generate a single binary for both intel and ppc architectures so:

+

−

+

−

-arch i386 -arch ppc

+

−

+

−

b. We want to link with the old framework and system libraries:

+

−

+

−

-mmacosx-version-min=10.4

+

−

-isysroot /Developer/SDKs/MacOSX10.4u.sdk/ (Not sure if this is really needed)

+

−

+

−

=== Compiling dependencies ===

+

−

+

−

- Libiconv: It's important to compile libiconv in the first place because gettext depends on it. Get the latest release from here: http://www.gnu.org/software/libiconv/ Uncompress the file in your favorite directory and configure and compile like this:

At the moment of writing these steps 4.6.2 is the latest version of Qt. Trolltech provides support from MacOS 10.4 to 10.6 so our binaries will be constrained by this. I went through these instructions in a Leopard machine. To compile in Snow Leopard it's necessary to consider the following notes copied from the Qt 4.6.0 changelog:

+

−

+

−

* Gcc 4.2 is used by default. Configure with -platform macx-g++40 to select 4.0.

+

−

* Using the 10.4u SDK requires gcc 4.0.

+

−

* Configuring for the Cocoa port (-cocoa) produces 64-bit binaries by default. Use the -arch flags to override.

+

−

* Building for ppc64 is no longer supported by the gcc tool chain.

+

−

* Building for ppc is still supported.

+

−

+

−

I haven't tried to generate universal binaries on a Snow Leopard machine. We have to validate these steps.

+

−

+

−

== 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)

Create a build directory with your favorite shell (the following directory is just an example, you can pick any name and path you want)

Line 61:

Line 21:

$ cd ~/Development

$ cd ~/Development

−

And in that directory checkout the sources with the bzr command

+

=== Getting Stellarium source code ===

+

+

In that directory checkout the sources with the bzr command

$ bzr branch lp:stellarium stellarium

$ bzr branch lp:stellarium stellarium

Line 71:

Line 33:

$ bzr pull

$ bzr pull

−

=== Time to compile stellarium ===

+

=== Time to compile Stellarium ===

We setup the build directory

We setup the build directory

Line 79:

Line 41:

$ cd builds/macosx

$ cd builds/macosx

−

[[Configuring Build Options|We run cmake]]<ref>If you've installed the Qt Creator dmg instead of the Qt Libraries, cmake will complain that it can't find Qt and you'll have to pass as an option the location of your QtSDK installation, e.g.

Other things will later go wrong too, especially when making the application bundle.

+

−

</ref>...

+

$ cmake ../..

$ cmake ../..

Line 92:

Line 51:

== Packaging ==

== Packaging ==

−

'''IMPORTANT''': you should delete or move aside the old Stellarium.app before each new build.

+

'''IMPORTANT''': you should delete or move aside the old Stellarium.app before each new build:

−

$ make install

+

$ rm -r Stellarium.app/

−

$ make macosx_bundle

+

−

'''Note''' : before revision 5558, this last step didn't work correctly and raised the following error :

+

Then make the Mac OS X application:

−

make[2]: *** No rule to make target `CMakeFiles/install.dir/all', needed by `CMakeFiles/macosx_bundle.dir/all'. Stop.

+

−

make[1]: *** [CMakeFiles/macosx_bundle.dir/rule] Error 2

+

−

make: *** [macosx_bundle] Error 2

+

−

To correct this, you'll have modify file stellarium/builds/macosx/CMakeFiles/Makefile2<ref>Credits to Timothy Reaves, see http://sourceforge.net/mailarchive/message.php?msg_id=29131979</ref>, changing the line

+

−

CMakeFiles/macosx_bundle.dir/all: CMakeFiles/install.dir/all

+

−

to

+

−

CMakeFiles/macosx_bundle.dir/all:

+

−

This is now fixed, thanks to Timothy Reaves.

+

−

The macosx_bundle target includes a perl script that makes use of otool and install_name_tool to:

# recurse on those copied-in dependencies, stopping at a point where system libraries are called for.

== We recommend Qt Creator ==

== 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.

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.

+

+

== Compiling dependencies to build an universal binary ==

+

+

'''Note: This step is needed only if you need an universal binary. If you don't intend to create an universal package you can ignore this and refer to section [[#Building Stellarium itself|Building Stellarium itself]].'''

+

+

'''Note: This step is potentially outdated. If you know how to update it, feel free to do it.'''

+

+

We have to compile the dependencies with special flags to be able to generate an universal binary.

+

+

In case you are compiling in a Leopard or Snow Leopard machine you have to recompile stellarium dependencies making use of the oldest system libraries (in our case those in 10.4 aka Tiger). We need the following compilation flags:

+

+

a. We want to generate a single binary for both intel and ppc architectures so:

+

+

-arch i386 -arch ppc

+

+

b. We want to link with the old framework and system libraries:

+

+

-mmacosx-version-min=10.4

+

-isysroot /Developer/SDKs/MacOSX10.4u.sdk/ (Not sure if this is really needed)

+

+

=== Compiling dependencies ===

+

+

- Libiconv: It's important to compile libiconv in the first place because gettext depends on it. Get the latest release from here: http://www.gnu.org/software/libiconv/ Uncompress the file in your favorite directory and configure and compile like this:

At the moment of writing these steps 4.6.2 is the latest version of Qt. Trolltech provides support from MacOS 10.4 to 10.6 so our binaries will be constrained by this. I went through these instructions in a Leopard machine. To compile in Snow Leopard it's necessary to consider the following notes copied from the Qt 4.6.0 changelog:

+

+

* Gcc 4.2 is used by default. Configure with -platform macx-g++40 to select 4.0.

+

* Using the 10.4u SDK requires gcc 4.0.

+

* Configuring for the Cocoa port (-cocoa) produces 64-bit binaries by default. Use the -arch flags to override.

+

* Building for ppc64 is no longer supported by the gcc tool chain.

+

* Building for ppc is still supported.

+

+

I haven't tried to generate universal binaries on a Snow Leopard machine. We have to validate these steps.

== Troubleshooting ==

== Troubleshooting ==

Revision as of 18:16, 28 September 2013

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 release and using an Intel machine with Mountain Lion (10.8) or later (10.8.5 at the moment)[1].

Time to compile Stellarium

Packaging

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.

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.

Compiling dependencies to build an universal binary

Note: This step is needed only if you need an universal binary. If you don't intend to create an universal package you can ignore this and refer to section Building Stellarium itself.

Note: This step is potentially outdated. If you know how to update it, feel free to do it.

We have to compile the dependencies with special flags to be able to generate an universal binary.

In case you are compiling in a Leopard or Snow Leopard machine you have to recompile stellarium dependencies making use of the oldest system libraries (in our case those in 10.4 aka Tiger). We need the following compilation flags:

a. We want to generate a single binary for both intel and ppc architectures so:

-arch i386 -arch ppc

b. We want to link with the old framework and system libraries:

-mmacosx-version-min=10.4
-isysroot /Developer/SDKs/MacOSX10.4u.sdk/ (Not sure if this is really needed)

Compiling dependencies

- Libiconv: It's important to compile libiconv in the first place because gettext depends on it. Get the latest release from here: http://www.gnu.org/software/libiconv/ Uncompress the file in your favorite directory and configure and compile like this:

At the moment of writing these steps 4.6.2 is the latest version of Qt. Trolltech provides support from MacOS 10.4 to 10.6 so our binaries will be constrained by this. I went through these instructions in a Leopard machine. To compile in Snow Leopard it's necessary to consider the following notes copied from the Qt 4.6.0 changelog:

Gcc 4.2 is used by default. Configure with -platform macx-g++40 to select 4.0.

Using the 10.4u SDK requires gcc 4.0.

Configuring for the Cocoa port (-cocoa) produces 64-bit binaries by default. Use the -arch flags to override.

Building for ppc64 is no longer supported by the gcc tool chain.

Building for ppc is still supported.

I haven't tried to generate universal binaries on a Snow Leopard machine. We have to validate these steps.

Troubleshooting

All kinds of things might go wrong!

We will write here the most frequent problems and the possible solutions found by the developers.

References

↑ If you build Stellarium 0.10.6+ by yourself on Mac OS X 10.4.11 then you need edit info.plist file then change value for LSMinimumSystemVersion key. You'll have to get older versions of Qt (Carbon) too, if you want to create universal binaries (PPC and Intel).