Building the BSD port of OpenJDK, Java 1.7 on Max OS X 10.5.8
This content began its life at http://confluence.concord.org/display/CCTR/Build+OpenJDK+Java+1.7.0+on+Mac+OS+X+10.5, but should be annotated and extended as we learn more. See the BSD-Port mailing list for information.
Dependencies
The original OpenJDK build could be built using the SoyLatte 1.6 binaries from Landon Fuller. The project has matured to a point that the original bootstrap binary will not work. Kurt Miller produced a new set of PPC based binaries which can be used to bootstrap the build, or you can use a binary available from John Yeary. These new binaries are based on Shark and work in interpreted mode.
OpenJDK 7 32-bit PPC
Please select a binary to use to boot strap your build. You can use openjdk7-zerovm-ppc-jyeary-2012-02-16-07-18-b00.zip or Kurt Miller's macppc builds.
- Download the binaries.
- Copy the binaries to /usr/local/XXX where the XXX represents the binary package like /usr/local/openjdk7-zerovm-ppc-jyeary-2012-02-16-07-18-b00
- Test the installation.
Code Block |
---|
$ /usr/local/openjdk7-zerovm-ppc-jyeary-2012-02-16-07-18-b00/bin/java \-version openjdk version "1.7.0-internal" OpenJDK Runtime Environment (build 1.7.0-internal-jyeary_2012_02_16_07_18-b00) OpenJDK Zero VM (build 21.0-b17, interpreted mode) |
Mercurial
Assuming you have MacPorts installed:
Code Block |
---|
$ sudo port install mercurial +bash_completion |
Otherwise you can download and install the latest version of Mercurial and install it.
Test the mercurial install:
Code Block |
---|
$ hg --version Mercurial Distributed SCM (version 2.0.2+20120104) (see http://mercurial.selenic.com for more information) Copyright (C) 2005-2011 Matt Mackall and others This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
Create ~/.hgrc file. The example below is what my current file looks like.
Code Block |
---|
$ cat .hgrc [ui] username = John Yeary <johnyeary@gmail.com> [extensions] #hgext.forest=/Users/jyeary/Development/mercurial/hgforest-crew/forest.py mq= hgk= fetch= [diff] nodates=1 git=1 |
Checkout OpenJDK Source Code
- Check out the code.
- Change permissions on get_source.sh
- Run get_source.sh This will fetch the additional code and any updates to the forest.
Code Block |
---|
$ hg clone http://hg.openjdk.java.net/bsd-port/bsd-port $ cd bsd-port $ chmod 755 get_source.sh $ ./get_source.sh |
Once the process completes, you should have something similar to the listing below:
Code Block |
---|
$ ls -l total 696 drwxr-xr-x 13 jyeary jyeary 442 Jan 18 08:30 .hg -rw-r--r-- 1 jyeary jyeary 51 Jan 18 08:30 .hgignore -rw-r--r-- 1 jyeary jyeary 6248 Jan 18 08:30 .hgtags -rw-r--r-- 1 jyeary jyeary 1503 Jan 18 08:30 ASSEMBLY_EXCEPTION -rw-r--r-- 1 jyeary jyeary 19263 Jan 18 08:30 LICENSE -rw-r--r-- 1 jyeary jyeary 16341 Jan 18 08:30 Makefile -rw-r--r-- 1 jyeary jyeary 1808 Jan 18 08:30 README -rw-r--r-- 1 jyeary jyeary 110836 Jan 18 08:30 README-builds.html -rw-r--r-- 1 jyeary jyeary 172135 Jan 18 08:30 THIRD_PARTY_README drwxr-xr-x 2 jyeary jyeary 68 Feb 16 19:34 build drwxr-xr-x 11 jyeary jyeary 374 Jan 18 08:33 corba -rwxr-xr-x 1 jyeary jyeary 1367 Jan 18 08:30 get_source.sh drwxr-xr-x 13 jyeary jyeary 442 Jan 18 08:39 hotspot -rw-r--r-- 1 jyeary jyeary 1963 Jan 18 23:48 hotspot.log drwxr-xr-x 19 jyeary jyeary 646 Jan 18 11:19 jaxp drwxr-xr-x 19 jyeary jyeary 646 Jan 18 11:20 jaxws drwxr-xr-x 12 jyeary jyeary 408 Jan 18 08:55 jdk drwxr-xr-x 13 jyeary jyeary 442 Jan 18 09:07 langtools drwxr-xr-x 18 jyeary jyeary 612 Jan 18 08:30 make drwxr-xr-x 3 jyeary jyeary 102 Jan 18 08:30 test |
Build OpenJDK
The version below is adapted from Kurt Miller's script. Edit the path information to fit your directory structure.
Code Block |
---|
#!/bin/sh cd bsd-port time env -i \ PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin \ LANG=C \ make \ CC=gcc-4.2 \ CXX=g++-4.2 \ ALLOW_DOWNLOADS=true \ ALT_BOOTDIR=/usr/local/openjdk7-zerovm-ppc-jyeary-2012-01-18-b00 \ ALT_FREETYPE_HEADERS_PATH=/usr/X11R6/include \ ALT_FREETYPE_LIB_PATH=/usr/X11R6/lib \ ALT_CACERTS_FILE=/System/Library/Frameworks/JavaVM.framework/Home/lib/security/cacerts \ LIBFFI_CFLAGS="-I/usr/include/ffi" \ DEFAULT_LIBPATH="/lib:/usr/lib:/usr/X11R6/lib:/usr/local/lib" \ NO_DOCS=true \ ZERO_BUILD=true \ ZERO_ENDIANNESS=big \ ZERO_LIBARCH=ppc \ ZERO_ARCHDEF=PPC \ ZERO_ARCHFLAG="-arch ppc" \ PARALLEL_COMPILE_JOBS=4 \ HOTSPOT_BUILD_JOBS=2 |
After some period of time you should get a successful build print out like the one below:
Code Block |
---|
## Build times ########## Target all_product_build Start 2012-02-16 07:18:10 End 2012-02-16 10:52:41 00:32:10 corba 00:10:10 hotspot 00:17:34 jaxp 00:18:43 jaxws 02:09:04 jdk 00:06:48 langtools 03:34:31 TOTAL ######################### real 214m40.082s user 118m0.258s sys 17m33.478s |
Please check with the BSD-Port mailing list if you encounter problems.
Error Recovery
Try cleaning if you get errors.
Some errors when compiling are fixed by cleaning. You can temporarily add the clean command to the end of build.sh and source it to clean the build products.
Code Block |
---|
$ make ALT_BOOTDIR=/usr/local/openjdk7-zerovm-ppc-jyeary-2012-01-18-b00 clobber |
X11 is needed for build.
If you have not installed this with Mac OS X, or have deleted it, you need to install it. A copy can be obtained from http://xquartz.macosforge.org/trac/wiki/X112.4.0.
Update the bsd-port directory
If updates have been made to the tree, perhaps to fix a bug, you can update your sources with:
Code Block |
---|
cd bsd-port ; ./get_source.sh |
Smoketest
If the build completes do a simple test by asking the JVM to print its version info. It should look something like this:
Code Block |
---|
$ ./build/bsd-ppc/j2sdk-image/bin/java -version openjdk version "1.7.0-internal" OpenJDK Runtime Environment (build 1.7.0-internal-jyeary_2012_02_16_07_18-b00) OpenJDK Zero VM (build 21.0-b17, interpreted mode) |
Then, see how to switch java versions on Mac OS X.
OLD INFORMATION
SoyLatte 32-bit Java 1.6 binaries
One can use Landon Fuller's SoyLatte 32-bit Java 1.6 binaries to build the OpenJDK bsd port. After downloading the binaries, copy the whole directory to /usr/local/soylatte16-i386-1.0.3
Test the SoyLatte install:
Code Block |
---|
$ /usr/local/soylatte16-i386-1.0.3/bin/java -version java version "1.6.0_03-p3" Java(TM) SE Runtime Environment (build 1.6.0_03-p3-landonf_19_aug_2008_14_55-b00) Java HotSpot(TM) Server VM (build 1.6.0_03-p3-landonf_19_aug_2008_14_55-b00, mixed mode) |
Forest extension to Mercurial
This is the canonical source for the Forest extension:
Code Block |
---|
$ hg clone http://hg.akoha.org/hgforest |
You can also use Patrick Mézard's clone of hgforest instead (just a couple of fixes to Simon's work):
Code Block |
---|
$ hg clone http://bitbucket.org/pmezard/hgforest-crew |
After cloning hgforest-crew add an hgext.forest item with the path to hgforest-crew/forest.py in the extensions section in your ~/.hgrc file.
JiBX v1.1.5
The JiBX library (Binding XML to Java Code) is a prerequisite for building. Install v1.1.5 of the JiBX: Binding XML to Java Code: downloads.
Build OpenJDK
Code Block |
---|
$ cat build.sh # source build.sh env \-i PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin \ make \ ALLOW_DOWNLOADS=true \ ALT_BOOTDIR=/usr/local/soylatte16-i386-1.0.3/ \ ALT_FREETYPE_HEADERS_PATH=/usr/X11R6/include \ ALT_FREETYPE_LIB_PATH=/usr/X11R6/lib \ ALT_JIBX_LIBS_PATH=/Users/stephen/dev/java/jibx/lib \ ANT_HOME=/usr/share/ant \ NO_DOCS=true \ HOTSPOT_BUILD_JOBS=1 |
Build openjdk like this:
Code Block |
---|
$ source build.sh |