Build Open JDK 7 on Mac OSX (TOTD #172)

Posted by arungupta on Oracle Blogs See other posts from Oracle Blogs or by arungupta
Published on Mon, 28 Nov 2011 11:41:35 -0600 Indexed on 2011/11/29 2:00 UTC
Read the original article Hit count: 601

Filed under:



The complete requirements, pre-requisites, and steps to build OpenJDK 7 port on Mac OSX are described here. The steps are very clearly explained and here are the exact ones I followed on my MacBook Pro 10.7.2:
  1. Confirm the version of pre-installed Java as:
    > java -version
    java version "1.6.0_26"
    Java(TM) SE Runtime Environment (build 1.6.0_26-b03-383-11A511c)
    Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02-383, mixed mode)
  2. Download and install Mercurial from mercurial.berkwood.com (zip bundle for 10.7 is here). It gets installed in the /usr/local/bin directory.
  3. Get the source code as (commands highlighted in bold):

    hg clone http://hg.openjdk.java.net/macosx-port/macosx-port
    destination directory: macosx-port
    requesting all changes
    adding changesets
    adding manifests
    adding file changes
    added 437 changesets with 364 changes to 33 files
    updating to branch default
    31 files updated, 0 files merged, 0 files removed, 0 files unresolved
    cd macosx-port
    chmod 7555 get_source.sh
    ./get_source.sh
    # Repos:  corba jaxp jaxws langtools jdk hotspot
    Starting on corba
    Starting on jaxp
    Starting on jaxws
    Starting on langtools
    Starting on jdk
    Starting on hotspot
    # hg clone http://hg.openjdk.java.net/macosx-port/macosx-port/corba corba
    requesting all changes
    adding changesets
    adding manifests
    adding file changes
    added 396 changesets with 3275 changes to 1379 files

    . . .

    # exit code 0
    # cd ./corba && hg pull -u
    pulling from http://hg.openjdk.java.net/macosx-port/macosx-port/corba
    searching for changes
    no changes found
    # exit code 0
    # cd ./jaxp && hg pull -u
    pulling from http://hg.openjdk.java.net/macosx-port/macosx-port/jaxp
    searching for changes
    no changes found
    # exit code 0
  4. Install Xcode from the App Store. Include /Developer/usr/bin in PATH.

    Note: JDK 1.6.0_26 ame pre-installed on my laptop and I installed Xode after that. The compilation went fine and there was no need to re-install the Java for Mac OS X as mentioned in the original steps.
  5. Build the code as:

    make ALLOW_DOWNLOADS=true SA_APPLE_BOOT_JAVA=true
    ALWAYS_PASS_TEST_GAMMA=true ALT_BOOTDIR=`/usr/libexec/java_home -v
    1.6` HOTSPOT_BUILD_JOBS=`sysctl -n hw.ncpu`

    The final output is shown as:

    >>>Finished making images @ Sat Nov 19 00:59:04 WET 2011 ...
    >>>Finished making images @ Sat Nov 19 00:59:04 WET 2011 ...
    ########################################################################
    ##### Leaving jdk for target(s) sanity all docs images #####
    ########################################################################
    ##### Build time 00:17:42 jdk for target(s) sanity all docs images #####
    ########################################################################

    ## Build times ##########
    Target all_product_build
    Start 2011-11-19 00:32:40
    End 2011-11-19 00:59:04
    00:01:46 corba
    00:04:07 hotspot
    00:00:51 jaxp
    00:01:21 jaxws
    00:17:42 jdk
    00:00:37 langtools
    00:26:24 TOTAL
    #########################
  6. Change the directory and verify the version:

    >cd build/macosx-universal/j2sdk-image/1.7.0.jdk/Contents/Home/bin
    >./java -version
    openjdk version "1.7.0-internal"
    OpenJDK Runtime Environment (build 1.7.0-internal-arungup_2011_11_19_00_32-b00)
    OpenJDK 64-Bit Server VM (build 21.0-b17, mixed mode)

Now go fix some bugs, file new bugs, or discuss at the macosx-port-dev mailing list.

© Oracle Blogs or respective owner

Related posts about /General