X

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

Guest Author


src="//cdn.app.compendium.com/uploads/user/e7c690e8-6ff9-102a-ac6d-e4aebca50425/f4a5b21d-66fa-4885-92bf-c4e81c06d916/Image/f690dc48eff16c7e3410a5bf770efcbe/openjdk.png">



The complete requirements, pre-requisites, and steps to build
OpenJDK 7 port on Mac OSX are href="http://wikis.sun.com/display/OpenJDK/Mac+OS+X+Port">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 href="http://mercurial.berkwood.com/">mercurial.berkwood.com
    (zip bundle for 10.7 is href="http://mercurial.berkwood.com/binaries/Mercurial-2.0-py2.7-macosx10.7.zip">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 fixhref="http://java.net/jira/secure/IssueNavigator.jspa?mode=show&requestId=10795">
some bugs, file
new bugs
, or discuss at thehref="http://mail.openjdk.java.net/mailman/listinfo/macosx-port-dev">
macosx-port-dev mailing list.


Join the discussion

Comments ( 3 )
  • guest Sunday, December 30, 2012

    Arun, excellent post.

    I am get it error:

    ERROR: FreeType version 2.3.0 or higher is required. \n /bin/mkdir -p /Users/josediaz/tools/macosx-port/build/macosx-universal/btbins

    rm -f /Users/josediaz/tools/macosx-port/build/macosx-universal/btbins/freetype_versioncheck

    Failed to build freetypecheck. \n

    Exiting because of the above error(s). \n

    make: *** [post-sanity] Error 1

    I am searching Freetype for mac.

    Jose


  • Arun Gupta Friday, January 4, 2013

    You may like to ask your question at:

    http://mail.openjdk.java.net/mailman/listinfo/build-dev


  • guest Tuesday, May 14, 2013

    There is a pretty detailed explanation on how to build OpenJDK here:

    https://github.com/hgomez/obuildfactory/wiki

    Werner


Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.