Development:Building:Mac OS X 10.7

From Camino Wiki
Jump to: navigation, search

Building on Mac OS X 10.7 is unfortunately complicated. Gecko 1.9.2 is not Xcode 4 / 10.7-build-friendly. This page contains a full list of supplemental instructions to help you complete a Cm2.1-M1.9.2 build on Mac OS X 10.7 with Xcode 4 (please be sure you follow all of the other instructions on Development:Building:Mozilla 1.9.2 Branch and Development:Building:Mac OS X 10.6). Please let us know of any additional issues by commenting in Bug 717513.


Preparing the build environment: installing Xcode 3 alongside Xcode 4

Xcode 4 (available for free through the Mac App Store) does not include the necessary tools for building Camino: the 10.4 SDK and the GCC 4.0 compiler. Those need to be fetched from Xcode 3. The necessary steps for obtaining these tools were originally documented in this post on Stack Overflow and reposted on Mac OS X Hints (note that those steps were written before Lion and Xcode 4.2 had been released; Xcode 4.2.1 changed a few things). Below are updated instructions.

Before installing Xcode 3, it is recommended that you uninstall Xcode 4 if it was installed. Any preferences, color scheme or key binding customizations will not be deleted.

Installing Xcode 3

Xcode 3 can be downloaded for free from Apple Developer site (direct download link). But the installer does a version check and won't allow installation on Lion 10.7.2. The necessary Xcode Toolset component is disabled. If the COMMAND_LINE_INSTALL environment variable is set, the version check can be bypassed (source: anatomic wax).

  1. Mount the Xcode 3.2.6 .dmg
  2. From a Terminal window:
    $ open "/Volumes/Xcode and iOS SDK/Xcode and iOS SDK.mpkg" will open.
  3. Create a destination folder before continuing with the installation process (e.g. /Xcode 3).
  4. Proceed with the installation through the installer. As noted in the Stack Overflow exchange above, do not install the “System Tools” or “Unix Development” packages of Xcode 3. But make sure to install the 10.4u SDK (the option is unchecked by default).

Install Xcode 4

The most recent version (4.2.1) doesn't allow any custom choices. By default it will install in /Developer.

Restoring 10.4u SDK support

$ cd /Developer/SDKs
$ sudo ln -s /Xcode3/SDKs/MacOSX10.4u.sdk .

Restoring GCC 4.0 support

$ cd /Developer/usr/bin
$ sudo ln -s /Xcode3/usr/bin/*4.0* .
$ cd /Developer/usr/libexec/
$ sudo ln -s /Xcode3/usr/libexec/gcc .

Let Xcode 4 see the GCC 4.0 compiler

$ cd /Developer/Library/Xcode/PrivatePlugIns
$ cd Xcode3Core.ideplugin/Contents/SharedSupport/Developer/Library/Xcode/Plug-ins
$ sudo ln -s "/Xcode3/Library/Xcode/Plug-ins/GCC 4.0.xcplugin" .

Command line build process

Similarly to building Gecko on Mac OS X 10.6, the following lines must be included in the .mozconfig file. Note that on Mac OS X 10.7 the explicit path to the compiler must be specified:

CC="/Xcode3/usr/bin/gcc-4.0 -arch i386"
CXX="/Xcode3/usr/bin/g++-4.0 -arch i386"
ac_add_options --target=i386-apple-darwin8.0.0

STRIP="strip -x -S"

# gecko crashreporter doesn't build on 10.6 and 10.7
ac_add_options --disable-crashreporter

An alternative way is to repeat the process above to install the GCC 4.0 compiler in a location that Gecko will understand without problems. By default, Gecko is looking in /usr. In this case the same .mozconfig as for Mac OS X 10.6 can be used.

$ cd /usr/bin; sudo ln -s /Xcode3/usr/bin/*4.0* .
$ cd /usr/libexec; sudo ln -s /Xcode3/usr/libexec/gcc .
$ cd /usr/lib; sudo ln -s /Xcode3/usr/lib/gcc .


  • On Mac OS X 10.7 Lion, the configure process silently fails to generate a number of defines, and the version detection for Xcode was not updated to handle the new output format of Xcode 4.
    • Attachment 587947 on Bug 717513 works around these issues.
      Note that after applying this patch, you’ll need to regenerate configure. If autoconf-2.13 was installed through MacPorts, the command is: cd /path/to/mozilla; autoconf213.
  • striptease will not build on 10.7; as this tool is only necessary for release builds, the failure can be worked around by disabling striptease.

Building in Xcode 4

Building in Xcode 4 (as opposed to the default command-line-driven build) is untested so far. However, the project file does appear to open correctly and see the correct compiler and SDK.

Building a Universal Binary

This is also currently untested. However, in addition to the instructions above, you’ll need to create the Xcode 3 as symlink mentioned on the Stack Overflow page in order to generate PPC binaries.

Personal tools