Wednesday, April 11, 2012

Building Jigsaw on Mac OS X natively

No sooner had I got Jigsaw builds working on the Mac, using Virtual Box, Michael McMahon updates the code base to build natively and then before you can blink Henri Gomez pushes out some jigsaw DMGs to install. Great! now it is even easier to play with Jigsaw on the Mac.

However, if like me you want to hack and build the source, here are some details.

The build dependencies are:
That's simple right? well I went through a couple of iterations for this to work.

If there is a previous version of Xcode installed I recommend removing it:
sudo /Developer/Library/uninstall-devtools --mode=all
The latest version Xcode is a little saner and installs in one location. Then, switch Xcode to the latest installation:
sudo xcode-select -switch /Applications/
Some of the JDK build scripts will use "xcode-select -print-path" to determine the path to the command line tools.

The installation of Xcode does not install the command line tools, such as gcc, g++ and make. Such tools can be installed by running Xcode, selecting the Preferences dialog, selecting the Downloads tab, and clicking to install the Command Line Tools.

Finally, if OpenJDK 7u4 was installed before Xcode 4.2.3 was installed it necessary to reinstall the former (as stated here).

If you have the Oracle OpenJDK 7 distribution installed then set the environment variable ALT_BOOTDIR to:
export ALT_BOOTDIR=/Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home
Building natively took about 22 minutes, approximately one third faster than on Ubuntu within VirtualBox. The gain was mostly for building hotspot (implying VirtualBox is not so efficient at managing multiple CPUs).

While on the subject of building there is work going on to improve the build system, plus the build structure will at some point be modularized as part of the JDK modularization effort, thus making building separate parts easier. All in all this means building is gonna get easier and faster.


  1. If you don't want to install Xcode, Apple now also releases a command line tools package containing gcc:
    (the link requires a Apple developer account)

    Have fun,