Skip to main content
This revision made December 10, 2013 18:39, by rjdkolb


NOTE: $SOURCE_CODE is where you installed the source code to. If you are using the AdoptOpenJDKVMBuild then this is /home/openjdk/sources If you are using YourOwnEnvironment then it's likely to be something like /home/<your username>/sources

NOTE: the last letter in jdk8_tl refers to the small letter 'l' and not the digit 1 - and applicable to all references to this term throughout the wiki.

Auto Configure

We're using the new build-infra based build system for OpenJDK.

To execute the new build-infra build, run the following:

 cd $SOURCE_CODE ;
 cd jdk8_tl ;
 bash configure ;

NOTE: With the new build system, its no long needed to be navigate to the ../common/makefiles folder, you can run bash configure from the root (i.e. $SOURCE_CODE/jdk8_tl).
NOTE: This will likely fail the first time due to missing packages. The autoconf tool will tell you exactly what's missing, see the Install Missing Packages section below.

Install Missing Packages

Debian/Ubuntu

This works for:

  • Ubuntu 12.04 and 12.10
  • Raspbian Wheezy (Raspberry Pi)
  • Probably most Debian based distros
  • Fedora up from 17

You'll need to enter your sudo password and say Y when prompted:

 sudo apt-get install build-essential openjdk-7-jdk libX11-dev libxext-dev libxrender-dev libxtst-dev libxt-dev libfreetype6-dev libcups2-dev libasound2-dev ccache g++-4.7-multilib libffi-dev

NOTE: ccache and g++-4.7-multilib are optional but speed up and support C++ builds in Eclipse respectively. If you get an error with g++ -4.7-multilib, replace that with g++ -4.6 -multilib

Windows

See how to Build Windows.

Mac OS X

See how to Build OpenJDK on the MacOS.

Fedora

This works for:

  • Fedora up from 19
 $ sudo yum groupinstall "Development Tools"
 $ sudo yum install gcc-c++
 $ sudo yum install libXrender-devel
 $ sudo yum install freetype-devel
 $ sudo yum install libXt-devel
 $ ./configure 
 $  make DEBUG_BINARIES=true SCTP_WERROR="" all  

( thanks for this flag Omair Majid from RedHat issues with GCC 4.8.1)

A simple way to radically speed up compilation of native code (typically hotspot and native libraries in JDK) is to install ccache:

 sudo yum install ccache

Known GCC issues when using with OpenJDK

Details of known issues with GCC 4.8.1 and OpenJDK can be found at : http://gcc.gnu.org/onlinedocs/gccint.pdf

See chapter 17: Target Description Macros and Functions; Section 17.22 Controlling Debugging Information Format

Check the default version of java

To check which version of Java or the java compiler is installed on your system, enter the following command in a terminal window respectively:

  java -version
 
 or 
 
  javac -version

You should see something like the below output for the first command (your minor and build number versions might be newer):

 java version "1.7.0_04"
 Java(TM) SE Runtime Environment (build 1.7.0_04-b20)
 Java HotSpot(TM) 64-Bit Server VM (build 23.0-b21, mixed mode)

NOTE: In order to build the OpenJDK projects, you require JDK/JRE version 1.7 installed on your system and set as the default Java version to use.

Windows

See Build Windows.

Choosing the default Java to use

Debian/Ubuntu/Fedora

If your system has more than one version of Java, configure which one your system uses by entering the following command in a terminal window

 sudo update-alternatives --config java

This will present you with a selection that looks similar to the following (the details may differ for you):

 There are 2 choices for the alternative java (providing /usr/bin/java).  
 Selection Path Priority Status 
 ———————————————————— 
 * 0 /usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 auto mode 
 1 /usr/lib/jvm/jre1.7.0/jre/bin/java 3 manual mode  
 
 Press enter to keep the current choice[*], or type selection number: 1

Raspbian (A Debian wheezy port, optimised for the Raspberry Pi)

NB A successful build can take up to 12 hours Make sure you have at least an 8gig SD card and you are using the entire card.

Follow the instruction of the Debian/Ubuntu build except :

  • sudo vi /etc/dphys-swapfile , set to 1000 (sets swap to 1 gig) - reboot
  • checkout and get_source.sh as per normal.
  • ./configure --with-jvm-variants=zero
  • make CONF=linux-arm-normal-zero-release
  • make profiles CONF=linux-arm-normal-zero-release


Windows

See Build Windows.

Rerun autoconf

Once all of the packages are installed, run:

Debian/Ubuntu

 bash configure - if you are positioned at the root

You should see a success message similar to the below:

 ====================================================
 A new configuration has been successfully created in
 /home/openjdk/sources/jdk8_tl/build/linux-x64-normal-server-release
 using default settings.
 
 Configuration summary:
 * Debug level:    release
 * JDK variant:    normal
 * JVM variants:   server
 * OpenJDK target: OS: linux, CPU architecture: x86, address length: 64
 * Boot JDK:       /usr/lib/jvm/java-7-openjdk-amd64 
 
 Build performance summary:
 * Cores to use:   1
 * Memory limit:   2003 MB
 * ccache status:  installed and in use 

Note: In the case of Ubuntu 12.10, the above might fail when it does not find a valid installation of JDK or JRE. It can be fixed by running sudo apt-get install openjdk-7-jre-headless, or any other openjdk-7 package of choice.

See configure command arguments for build performance optimisation.

Windows

See Build Windows page.

Next Step

OR

Difference compared to previous revision
This works for: * Ubuntu 12.04 and 12.10 * Raspbian Wheezy (Raspberry Pi) * Probably most Debian based distros * Fedora up from 17 You'll need to enter your sudo password and say ''Y'' when prompted: sudo apt-get install build-essential openjdk-7-jdk libX11-dev libxext-dev libxrender-dev libxtst-dev libxt-dev libfreetype6-dev libcups2-dev libasound2-dev ccache g++-4.7-multilib libffi-dev '''NOTE:''' ccache and g++-4.7-multilib are optional but speed up and support C++ builds in Eclipse respectively. If you get an error with g++ -4.7-multilib, replace that with g++ -4.6 -multilib ... * 0 /usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 auto mode 1 /usr/lib/jvm/jre1.7.0/jre/bin/java 3 manual mode Press enter to keep the current choice[*], or type selection number: 1 == Raspbian (A Debian wheezy port, optimised for the Raspberry Pi)== NB A successful build can take up to 12 hours Make sure you have at least an 8gig SD card and you are using the entire card. Follow the instruction of the Debian/Ubuntu build except : * sudo vi /etc/dphys-swapfile , set to 1000 (sets swap to 1 gig) - reboot * checkout and get_source.sh as per normal. * ./configure --with-jvm-variants=zero * make CONF=linux-arm-normal-zero-release * make profiles CONF=linux-arm-normal-zero-release == Windows ==
 
 
Close
loading
Please Confirm
Close