Compile and debug openjdk8 on Ubuntu 12.04

Source: Internet
Author: User
Preface

The materials I read now are compiled by openjdk7, and openjdk8 seems to have been compiled by openjdk7 in a large way.

make sanity

Will prompt that the sanity rule cannot be found, and then the compilation process is basically direct

./configuremake all

The official readme statement is clear.

The following process is recorded:

Download Code
hg clone http://hg.openjdk.java.net/jdk8u/jdk8u jdk8ucd jdk8u bash ./get_source.sh

Then download the code and enter the code directory:

cd jdk8u
Install dependency
sudo aptitude build-dep openjdk-7 sudo aptitude install openjdk-7-jdk
Configuration
  • Environment Variable
export LANG=C export PATH="/usr/lib/jvm/java-7-openjdk/bin:${PATH}"
  • Configure compilation options
bash ./configure

In this way, the corresponding default configuration is generated. If you need to compile the debugging version, you canconfigureAdd parameters.

A new configuration has been successfully created in/home/minix/SourceCode/openjdk8/jdk8u/build/linux-x86-normal-server-releaseusing default settings.Configuration summary:* Debug level:    release* JDK variant:    normal* JVM variants:   server* OpenJDK target: OS: linux, CPU architecture: x86, address length: 32Tools summary:* Boot JDK:       java version "1.7.0_17" Java(TM) SE Runtime Environment (build 1.7.0_17-b02) Java HotSpot(TM) Server VM (build 23.7-b01, mixed mode)  (at /home/minix/Software/jdk1.7.0_17)* C Compiler:     gcc-4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5) version 4.6.3 (at /usr/bin/gcc-4.6)* C++ Compiler:   g++-4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5) version 4.6.3 (at /usr/bin/g++-4.6)Build performance summary:* Cores to use:   3* Memory limit:   3878 MB* ccache status:  not installed (consider installing)Build performance tip: ccache gives a tremendous speedup for C++ recompilations.You do not have ccache installed. Try installing it.You might be able to fix this by running ‘sudo apt-get install ccache‘.

We can see that the ccache package is missing and you can install it as prompted. The prompt shows that the compilation level isreleaseIn addition, there are several compilation levels to provide more information during debugging. For example:

bash ./configure --enable-debug

This will generatefastdebugVersion configuration information:

A new configuration has been successfully created in/home/minix/openjdk8/jdk8u/build/linux-x86-normal-server-fastdebugusing configure arguments ‘--enable-debug‘.Configuration summary:* Debug level:    fastdebug* JDK variant:    normal* JVM variants:   server* OpenJDK target: OS: linux, CPU architecture: x86, address length: 32Tools summary:* Boot JDK:       java version "1.7.0_17" Java(TM) SE Runtime Environment (build 1.7.0_17-b02) Java HotSpot(TM) Server VM (build 23.7-b01, mixed mode)  (at /home/minix/Software/jdk1.7.0_17)* C Compiler:     gcc-4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5) version 4.6.3 (at /usr/bin/gcc-4.6)* C++ Compiler:   g++-4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5) version 4.6.3 (at /usr/bin/g++-4.6)Build performance summary:* Cores to use:   3* Memory limit:   3878 MB* ccache status:  installed and in use

Note that the compilation level has changedfastdebug.

Compile

Compile directly

make

You can, if prompted

No CONF given, but more than one configuration found in /home/minix/openjdk8/jdk8u//build.Available configurations:* linux-x86-normal-server-fastdebug* linux-x86-normal-server-releasePlease retry building with CONF=<config pattern> (or SPEC=<specfile>)

Which compilation configuration should be specified:

make CONF=linux-x86-normal-server-fastdebug

After the compilation is successful, a message is displayed:

----- Build times -------Start 2014-08-22 10:56:52End   2014-08-22 11:16:3100:00:30 corba00:13:38 hotspot00:00:22 jaxp00:00:30 jaxws00:04:10 jdk00:00:29 langtools00:19:39 TOTAL

ViewbuildDirectory, you can seelinux-x86-normal-server-fastdebug

Switchjdk/binDirectory:

cd linux-x86-normal-server-fastdebug/jdk/bin/

Run the executable file Java

./java -version

Will be prompted

openjdk version "1.8.0-internal-fastdebug"OpenJDK Runtime Environment (build 1.8.0-internal-fastdebug-minix_2014_08_22_10_56-b00)OpenJDK Server VM (build 25.40-b05-fastdebug, mixed mode)
Debugging

The following shows a startupGDBAdd breakpoints and run a Java program.

$ gdb javaGNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2.1) 7.4-2012.04Copyright (C) 2012 Free Software Foundation, Inc.License GPLv3+: GNU GPL version 3 or later 

Compile and debug openjdk8 on Ubuntu 12.04

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.