
Setting up the minimum build environment for the most compatible Linux builds
OpenJDK 6 on Linux was developed for and most excessively tested with those GCC toolchains available at that time. Modern Linux distributions have newer toolchains, for example, Ubuntu 12.04 has GCC 4.6. Newer toolchains may have more advanced optimizations and provide slightly faster code, but older ones should be more stable for OpenJDK.
Oracle published the minimum build environment description for OpenJDK 6. It says:
"Building with the MBE will generate the most compatible bits that install on, and run correctly on, the most variations of the same base OS and hardware architecture."
We are going to build OpenJDK 6 on one of the minimum build environment platforms—Debian Linux 5.0 Lenny. The build instructions are exactly the same for i586 and amd64 architectures, so they won't be mentioned further in this recipe.
The build steps are similar to the previous recipe so we'll concentrate on different steps.
Getting ready
In this recipe, we will need Debian Lenny running. Installation images may be downloaded from the Debian CDImage archive. Lenny may not be compatible with some of the hardware on newer laptops, but should run fine with virtualization tools such as Oracle VirtualBox or VMware.
How to do it...
The following steps will help us to set up the minimum build environment:
- Add archive repositories to the
/etc/apt/sources.list
file:deb http://archive.kernel.org/debian-archive/debian lenny main contrib non-free deb-src http://archive.kernel.org/debian-archive/debian lenny main contrib non-free
- Install OpenJDK 6 binaries and build dependencies:
sudo apt-get install openjdk-6-jdk sudo apt-get build-dep openjdk-6 sudo apt-get install libmotif-dev
- Download and decompress Apache Ant:
wget http://archive.apache.org/dist/ant/binaries/apache-ant-1.8.4-bin.tar.gz tar xzf apache-ant-1.8.4-bin.tar.gz
- Create a new text file
buildenv.sh
with environment settings, and import its content into the current bash shell:export LD_LIBRARY_PATH= export CLASSPATH= export JAVA_HOME= export LANG=C export ALT_BOOTDIR=/usr/lib/jvm/java-6-openjdk export ANT_HOME=path/to/apache-ant-1.8.4/ export PATH=$ANT_HOME/bin:$PATH . buildenv.sh
- Download and decompress the official OpenJDK 6 build 30 tarball:
mkdir openjdk-6-src-b30-21_jan_2014 cd openjdk-6-src-b30-21_jan_2014 wget https://java.net/projects/openjdk6/downloads/download/openjdk-6-src-b30-21_jan_2014.tar.gz tar xzf openjdk-6-src-b30-21_jan_2014.tar.gz rm openjdk-6-src-b30-21_jan_2014.tar.gz
- Start the build process from the
openjdk-6-src-b30-21_jan_2014
directory:make 2>&1 | tee make.log
- Wait for the build to finish.
How it works...
Archive repository setup is required because the official Lenny repositories are no longer available.
A newer version of Apache Ant is required because the bundled Version 1.7.0 in Lenny is too old and OpenJDK 6 requires Ant 1.7.1 or higher.
There's more...
Other older Linux distributions such as Ubuntu 8.04 or Fedora 9 also may be used as the minimum build environment.
See also
- The Building OpenJDK 6 on Ubuntu Linux 12.04 LTS recipe
- The official build instructions for OpenJDK, 6 with the description of minimum build platforms, at http://hg.openjdk.java.net/jdk6/jdk6/raw-file/tip/README-builds.html#MBE
- The Debian CDImages archive at http://cdimage.debian.org