Friday, July 25, 2008

Building OpenJDK

[This might be already out of date.]

Here's how I build a 32 bit OpenJDK (build 31) on my Ubuntu 8.04 (Hardy Heron) system.

1. Download
Download the following two files
from the download page, into the directory ~/openjdk7-ws/ and you get two files: the source bundle
and the binary plugs

2. Install required packages
Make sure that you install the following Ubuntu packages (I use the Synaptic Package Manger)
  • ant
  • ant-optional
  • gawk
  • gcc
  • g++
  • libasound2-dev
  • libcupsys2-dev
  • libfreetype6-dev
  • libmotif-dev
  • libx11proto-print-dev
  • libxi-dev
  • libxrender-dev
  • libxt-dev
  • libxext-dev
  • libxtst-dev
  • sun-java6-jdk

3. Unpack the source

Unzip the source bundle by typing
$ cd ~/openjdk7-ws
$ unzip
and you will get the source directory

4. Unpack the binary plugs

Expand the binary plugs by typing
$ cd ~/openjdk7-ws
$ java -jar jdk-7-ea-plug-b31-linux-i586-17_jul_2008.jar
which invokes a Java GUI extractor. Accept the license and select ~/openjdk7-ws as the destination and you get the binary plugs directory

5. Suppress compiler warnings and errors

Edit the file
and add the following compiler option
CFLAGS += -Wno-write-strings
at the end of the list of the compiler options (line 60.)

And replace
in the first line of the six .sh files under
and change the value of variable SH from sh to bash in line 121 of

6. Build

Start the build by typing the following
$ cd ~/openjdk7-ws
$ unset JAVA_HOME
$ export ALT_BOOTDIR=/usr/lib/jvm/java-6-sun
$ export ALT_BINARY_PLUGS_PATH=~/openjdk7-ws/openjdk-binary-plugs
$ export LANG=C
$ make debug_build
and wait for a while and you will get the debug build in
$ ~/openjdk7-ws/openjdk/build/linux-i586-debug/j2sdk-image
To build a product build, type
$ make product_build
and you will get the product build in
$ ~/openjdk7-ws/openjdk/build/linux-i586/j2sdk-image
To clean the build directory, use
$ make clobber

No comments: