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.

Thursday, April 5, 2012

Building Jigsaw on Mac OS X using VirtualBox

Jigsaw is the OpenJDK project for modularity in the JDK.

Currently the easiest way I have found to get started with Jigsaw on a Mac is to check out and build the source on a virtual machine running Linux.

I boot-strapped from reading Julien's very useful blog entry on building Jigsaw. My experience was a little smoother.

I am using Mac OS X 10.7.3 with VirtualBox 4.1.10.

Create a virtual machine

First, the virtual machine needs configured and installed with an operating system.

Create a new virtual machine with at least 1GB of memory and 16GB of disk space (space gets tight if the default 8GB is selected).

Download the Ubuntu 11.10 32 bit ISO and hook up the ISO to the CD drive of the virtual machine (see the Storage section of the settings dialog).

Start up the virtual machine, install Ubuntu, and update the OS to the latest packages.

The above steps should take about 40 to 50 minutes to complete, given a reasonable network connection.

Prepare the virtual machine

Next, the virtual machine needs to be prepared to checkout the Jigsaw source and build it.

Install OpenJDK 7 and it's build dependencies:
sudo apt-get build-dep openjdk-7 
sudo apt-get install openjdk-7-jdk
Jigsaw will be built using OpenJDK 7, commonly referenced in this context as the bootstrap JDK.

Install mercurial:
sudo apt-get mercurial
The Jigsaw repository (like that for other OpenJDK projects) uses the Mercurial distributed version control system.

Check out and build

Now the source can be checked out and built. Check out the source forest:
hg clone
and then execute:
cd jigsaw 
to get all source trees in the forest i.e. this is a multi-project repository (i don't yet know if the forest extension can be utilized).

Set the following environment variables:
export LANG=C 
export ALT_BOOTDIR=/usr/lib/jvm/java-7-openjdk-i386 
The ALT_BOOTDIR variable declares the location of the bootstrap JDK that will be used to build Jigsaw. The ALLOW_DOWNLOADS variable ensures that source not within the repository, namely that for JAXP and JAX-WS, will be downloaded.

Then make Jigsaw:
make sanity 
make all
On my machine it took about 50 minutes to build. The installation of Jigsaw is located in the directory build/linux-i586. Execution can be verified:
./build/linux-i586/bin/java -version
and the output should be something like:
openjdk version "1.8.0-internal"  
OpenJDK Runtime Environment (build 1.8.0-internal-sandoz_2012_04_04_13_06-b00)  
OpenJDK Client VM (build 23.0-b11, mixed mode)
I can get this down to about 30 minutes by reconfiguring the virtual machine to have 4 CPUs (the same as the host machine) and setting the following environment variables:
export NO_DOCS=true
The next blog entry will explain how to compile, install and execute modules.

Wednesday, April 4, 2012

Java Boomerang

Friday 30th of March was my last day at CloudBees.

Monday 2nd of April was my first day back at Oracle. I have joined the Java Platform team (more on that later in another blog entry).

CloudBees is a great company full of great people and is on track to be a success disrupting the middleware market with the RUN@cloud, DEV@cloud, the integrated set of services, and Jenkins Enterprise. It's fantastic to see Jenkins and the community go from strength to strength. I wish the team the very best of luck. CloudBees is two years old today, Happy Birthday! Keep up the internal meme generation service!

However, personally, the time is not right for me to work at home in a startup.

So, it is with mixed feelings that I say I am sad about leaving CloudBees but also very excited about joining Oracle and the Java Platform team.