RFR: 7113349 JDK8 port to macosx

John Rose john.r.rose at oracle.com
Sat Mar 3 12:19:35 PST 2012

On Mar 3, 2012, at 6:14 AM, Henri Gomez wrote:

> Guys could you detail JDK8 build process on OSX ?
> I'd like to add this to my openjdk-osx-build project. 

I'm rediscovering it myself.  The switch to macosx in jdk8 was phased: hotspot first, then jdk.  Before jdk was updated for macosx, builds were basically broken.

For the moment, you can follow the mlvm instructions, which will cause you to get snapshots of Michael's work (as macosx-7113349.patch), and these will make a jdk8 repo able to build macosx.  When Michael's work promotes, I'll remove those patches from mlvm, and things will get a lot (a lot!) more stable on macosx.

Adding a new platform to OpenJDK is not trivial.  I'm glad the teething pains have been as light as they have been.  (But the adventure's not over yet, is it?)

Like everybody, I have a messy hairy build script (derived from those which have been posted).  The changes I have had to make recently include:

1. Upgrade to Lion; download Xcode; install the command line tools.
2. Set LP64=1.  (Avoid 32-bit builds, at least for now.)
3. Add Michael's patches to jdk.  (Crucial!)
4. Set ALT_BOOTDIR to a download of OpenJDK 7 preview on macosx: http://jdk7.java.net/macportpreview/
5. Remove ALT_FREETYPE_* settings from the build script.
6. Find the compilers using xcrun:  CC=$(  xcrun -find gcc ); CXX=$( xcrun -find g++ )
7. Set OPENJDK=true for luck.  (Not sure if this is necessary.)

To do this, I chose to upgrade to Lion and ditch 32-bit, rather than experiment with alternatives.  Yes, I wimped out, and that doesn't help customers who want to run 32-bit systems or Snowleopard.

N.B. The Lion upgrade was pretty scary, because I got the notorious "install hangs forever" failure mode.  Time Machine saved my bacon, by allowing me to regress back to my Snowleopard image, run disk repair, and try again.  My advice:  Do not upgrade to Lion without a full backup, and without running the Disk Utility's repair function.

Another bit of hard-won advice:  If you are relying on Time Machine as I did, go to preferences and remove exclusions form the backup list.  I had excluded my Downloads directory for obvious reasons.  I found it anxiety provoking when I did an emergency reversion to Snowleopard and found all my Downloads were gone.  Also, I had a folder called /Backup in which I manually stashed backups.  This also was gone after the full restore; not sure why.  (It didn't matter; the extra backup copies were totally redundant, again for obvious reasons.)  Time Machine will restore your system to usability, and will faithfully restore stuff under /Users, but it seems to be buggy with random stuff under the file system root.

— John

More information about the macosx-port-dev mailing list