Skip to content

How to build and package OpenJDK8 with Lambda on Linux

hgomez edited this page Feb 4, 2013 · 2 revisions

Some pre-requisites are required to build OpenJDK8 with Lambda on Linux

Build and package pre-requisites

Be sure to have git, mercurial, gcc/g++, make and required libs and some mandatory tools installed. Java 7 should be installed.

Ensure JAVA_HOME env var point to a valid Java 7 location, example for openSUSE 12.2 :

export JAVA_HOME=/opt/obuildfactory/openjdk7
export PATH=$JAVA_HOME/bin:$PATH

Ubuntu 12.x / Mint 14

sudo apt-get install git mercurial zip bzip2 unzip tar
sudo apt-get install ccache make gcc g++ ca-certificates ca-certificates-java
sudo apt-get install libX11-dev libxext-dev libxrender-dev libxtst-dev libxt-dev  
sudo apt-get install libasound2-dev libcups2-dev libfreetype6-dev

openSUSE / SLES

sudo zypper install git-core mercurial zip bzip2 unzip tar 
sudo zypper install ccache make gcc gcc-c++ ca-certificates-cacert ca-certificates-mozilla
sudo zypper install libstdc++-devel alsa-devel cups-devel xorg-x11-devel libjpeg62-devel giflib-devel 
sudo zypper install curl rpm-build gpg
sudo zypper install java-1_7_0-openjdk-devel

CentOS 5/6

sudo yum install git-core mercurial zip bzip2 unzip tar 
sudo yum install ccache make gcc gcc-c++ libstdc++-devel 
sudo yum install alsa-lib-devel cups-devel libX11-devel libXext-devel libXt-devel libXrender-devel libXtst-devel libXi-devel libjpeg-devel giflib-devel freetype-devel
sudo yum install curl rpm-build gpg
sudo yum install java-1.7.0-openjdk-devel

Fedora 16/17

sudo yum install git-core mercurial zip bzip2 unzip tar 
sudo yum install ccache make gcc gcc-c++ 
sudo yum install libstdc++-devel libstdc++-static alsa-lib-devel cups-devel libX11-devel libXext-devel libXt-devel libXrender-devel libXtst-devel libXi-devel libjpeg-devel giflib-devel freetype-devel 
sudo yum install curl rpm-build gpg rpmbuild rpm-sign
sudo yum install java-1.7.0-openjdk-devel

Prepare environment

For example, you want to build OpenJDKs in openjdkathome directory under your home directory.

mkdir ~/openjdkathome
cd ~/openjdkathome
git clone https://github.com/hgomez/obuildfactory.git

Building OpenJDK

Building is activated by XBUILD env var set to true

cd ~/openjdkathome
XUSE_NEW_BUILD_SYSTEM=true XBUILD=true ./obuildfactory/openjdk8-lambda/linux/standalone-job.sh

After some minutes you should see this logs :

----- Build times -------
Start 2013-02-04 17:53:44
End   2013-02-04 18:05:41
00:00:19 corba
00:00:18 demos
00:06:20 hotspot
00:00:56 images
00:00:18 jaxp
00:00:22 jaxws
00:03:00 jdk
00:00:23 langtools
00:11:57 TOTAL
-------------------------
make[1]: Leaving directory `/root/openjdkathome/sources/openjdk8-lambda'
openjdk version "1.8.0-jdk8-b66"
OpenJDK Runtime Environment (build 1.8.0-jdk8-b66-20121130)
OpenJDK 64-Bit Server VM (build 25.0-b10, mixed mode)
openjdk version "1.8.0-jdk8-b66"
OpenJDK Runtime Environment (build 1.8.0-jdk8-b66-20121130)
OpenJDK 64-Bit Server VM (build 25.0-b10, mixed mode)

You'll find JDK/JRE tarballs under OBF_DROP_DIR/openjdk8

ls -l OBF_DROP_DIR/openjdk8
total 267180
-rw-r--r-- 1 henri henri 120085110 dec.  19 18:25 j2re-image-x86_64-b68-20121219.tar.bz2
-rw-r--r-- 1 henri henri 153501403 dec.  19 18:24 j2sdk-image-x86_64-b68-20121219.tar.bz2

Clean vs Incremental build

By default, build are performed in incremental mode, ie only updated code is recompiled, reducing overall build time.

But experience in OpenJDK show that weird things happens sometimes and it's better to start from scratch and perform a clean build.

To activate clean mode, use XCLEAN env var ie :

cd ~/openjdkathome
XCLEAN=true XUSE_NEW_BUILD_SYSTEM=true XBUILD=true ./obuildfactory/openjdk8/linux/standalone-job.sh