====================================================
A new configuration has been successfully created in
/home/linuxidc/jdk8u-dev/build/linux-x86_64-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
Tools summary:
* Boot JDK: java version "1.7.0_161" OpenJDK Runtime Environment (IcedTea 2.6.12) (7u161-2.6.12-1) OpenJDK 64-Bit Server VM (build 24.161-b01, mixed mode) (at /usr/lib/jvm/java-7-openjdk-amd64)
* Toolchain: gcc (GNU Compiler Collection)
* C Compiler: Version 7.3.0 (at /usr/bin/gcc)
* C++ Compiler: Version 7.3.0 (at /usr/bin/g++)
Build performance summary:
* Cores to use: 7
* Memory limit: 7872 MB
这里再补充说明下,在递归执行依赖检查的过程中可能会提示这个 libx11-dev,Ubuntu 18.04.1 LTS是这么提示安装项目的:
sudo apt-get install libX11-dev libxext-dev libxrender-dev libxtst-dev libxt-dev
libX11-dev的X是大写的,应该会提示找不到这个依赖项,这个时候要把大写X改成小写的x,为 libx11-dev,就可以找到依赖项了。
到这一步,OpenJDK8的编译环境就已经准备好了,下一步就是编译OpenJDK8。
三、进行编译
编译的代码很简单,直接make all即可,当然也可以按照README-builds.html中对make执行带参数编译,说明如下:
Make Target
Description
empty
build everything but no images
all
build everything including images
all-conf
build all configurations
images
create complete j2sdk and j2re images
install
install the generated images locally, typically in /usr/local
clean
remove all files generated by make, but not those generated by configure
dist-clean
remove all files generated by both and configure (basically killing the configuration)
help
give some help on using make, including some interesting make targets
在编译前还有几个注意事项,这些注意事项在文件README-builds.html中也是有体现的:
设定语言选项,可先执行echo $LANG,看下输出,如果不是C,则执行export LANG=C;
设定PATH,可先执行echo $PATH,看下输出,如果没有boot JDK,则执行export PATH="/usr/lib/jvm/java-7-openjdk-amd64/bin:${PATH}";
检查JAVA_HOME ,可先执行echo $JAVA_HOME,看下输出,如果有值则需要unset JAVA_HOME;
这三步检查执行通过后,就可以执行make命令了。一切顺利的话,就可以看到这样的编译结果:
## Finished docs (build time 00:01:46)
----- Build times -------
Start 2018-09-23 16:59:30
End 2018-09-23 17:08:39
00:00:19 corba
00:00:13 demos
00:01:46 docs
00:03:26 hotspot
00:00:18 images
00:00:13 jaxp
00:00:17 jaxws
00:02:01 jdk
00:00:25 langtools
00:00:11 nashorn
00:09:09 TOTAL
-------------------------
Finished building OpenJDK for target 'all'
看到这样的结果,表示编译成功,可以到多个目录下的bin目录执行./java -version来验证。