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
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 canconfigure
Add 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 isrelease
In addition, there are several compilation levels to provide more information during debugging. For example:
bash ./configure --enable-debug
This will generatefastdebug
Version 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
Viewbuild
Directory, you can seelinux-x86-normal-server-fastdebug
Switchjdk/bin
Directory:
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 startupGDB
Add 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