老大哥:编译JDK好难呀,我要放弃Java了,我:别呀,看我的

老大哥:编译JDK好难呀,我要放弃Java了,我:别呀,看我的

一次又一次的编译JDK;

一次又一次的失败.

在这里插入图片描述

最终

冲破层层难关,来总结一下在Centos7环境下编译OpenJDK的过程.

你可能会问了:我看其他文章里都是要求的一下子装很多很多的软件的呀,在这里怎么一个也不安装了.

你也许翻了10篇文章有9篇文章都写了一堆下面这个玩意:

当然了,并不是不对,是根本不知道怎么来的.

这里我是故意放的一个图片,就是不让你直接复制,哈哈,复制不出来吧,那就对了,跟着我来!!!!!!!
在这里插入图片描述

我只想问你,你是不是有一头问号.

在这里插入图片描述

没关系,这篇文章让你彻底清醒

这篇文章就是来做你编译jdk的翻的最后的一个博客.

我想教会的你的是如何解决问题,并不是一下子帮你解决好.

这样子才能学到东西

一,创建放置源码的文件夹

因为咱们要编译的是jdk12,所以这里创建一个jdk12的文件夹,可以随意起名字

[root@TrueDei ~]# mkdir jdk12
[root@TrueDei ~]# cd jdk12/
[root@TrueDei jdk12]# 

二,测试是否已经包含了jdk

如果已经存在,请删除或者卸载掉

[root@TrueDei ~]# java 
bash: java: 未找到命令
[root@TrueDei ~]# 

三,如何获取Openjdk的源码

可以通过这个网站获取OpenJDK的源码:http://hg.openjdk.java.net/jdk/

你可以选择任意一个你喜欢的

在这里插入图片描述

你也可以根据自己的喜好,来选择要下载的压缩包的格式

在这里插入图片描述

这个地址就是咱们需要的,或者直接右击上面的格式复制链接地址:http://hg.openjdk.java.net/jdk/jdk12/archive/tip.tar.gz

在这里插入图片描述

四,下载jdk源码,并解压

首先你要确定你的Linux是否可以上网

在这里插入图片描述

下载源码我们使用的是wget,如果没有,可以安装一下

[root@TrueDei jdk12]# wget http://hg.openjdk.java.net/jdk/jdk12/archive/tip.tar.gz
bash: wget: 未找到命令
[root@TrueDei jdk12]# yum -y install wget

下载jdk的源码

[root@TrueDei jdk12]# wget http://hg.openjdk.java.net/jdk/jdk12/archive/tip.tar.gz

在这里插入图片描述

如果出现下面这个,则是没下载完全:

[root@TrueDei jdk12]# tar -zxf tip.tar.gz 

gzip: stdin: unexpected end of file
tar: 归档文件中异常的 EOF
tar: 归档文件中异常的 EOF
tar: Error is not recoverable: exiting now
[root@TrueDei jdk12]#

可以使用windows,或者使用其他物理机下载好,然后想办法传过去

我的物理机是Deepin,所以我可以使用scp命令拷贝过去

truedei@truedei:Downloads$ ll jdk12-06222165c35f.zip 
-rw-r--r-- 1 truedei truedei 180327483 5月  20 23:36 jdk12-06222165c35f.zip
truedei@truedei:Downloads$ 
truedei@truedei:Downloads$ scp jdk12-06222165c35f.zip  [email protected]:/root/jdk12/
[email protected]'s password: 
jdk12-06222165c35f.zip                                         100%  172MB  82.4MB/s   00:02    
truedei@truedei:Downloads$ 

因为需要使用unzip来解压,所以没有的同学先要安装一下

[root@TrueDei jdk12]# yum -y install unzip

解压

[root@TrueDei jdk12]# unzip jdk12-06222165c35f.zip 

再次解压就没问题了

[root@TrueDei jdk12]# ll
总用量 176104
drwxr-xr-x. 8 root root       271 5月   9 11:21 jdk12-06222165c35f
-rw-r--r--. 1 root root 180327483 5月   9 11:20 jdk12-06222165c35f.zip
[root@TrueDei jdk12]# 
[root@TrueDei jdk12]# 
[root@TrueDei jdk12]# ll jdk12-06222165c35f
总用量 48
-rw-r--r--.  1 root root  2114 3月  20 2019 ADDITIONAL_LICENSE_INFO
-rw-r--r--.  1 root root  1522 3月  20 2019 ASSEMBLY_EXCEPTION
drwxr-xr-x.  3 root root   158 5月   9 11:21 bin
-rw-r--r--.  1 root root  1649 3月  20 2019 configure
drwxr-xr-x.  3 root root    99 5月   9 11:21 doc
-rw-r--r--.  1 root root 19274 3月  20 2019 LICENSE
drwxr-xr-x. 23 root root  4096 5月   9 11:21 make
-rw-r--r--.  1 root root  2785 3月  20 2019 Makefile
-rw-r--r--.  1 root root   341 3月  20 2019 README
drwxr-xr-x. 78 root root  4096 5月   9 11:21 src
drwxr-xr-x. 14 root root   217 5月   9 11:21 test
[root@TrueDei jdk12]# 

进入到解压后的文件夹里

[root@TrueDei jdk12]# 
[root@TrueDei jdk12]# cd jdk12-06222165c35f
[root@TrueDei jdk12-06222165c35f]# 

五,安装编译的此OpenJDK之前的版本

安装要编译的JDK的上一个版本JDK(因为编译JDK时要有一个编译期可使用的JDK,官方称作这个JDK叫Bootstrap JDK)

安装上一版本JDK,这里安装JDK11

可以使用一下命令来查看一下yum源的仓库里有哪些版本的

可以看到,只有6,7,8,11版本的java

[root@TrueDei jdk12-06222165c35f]# 
[root@TrueDei jdk12-06222165c35f]# yum search java | grep jdk
ldapjdk-javadoc.noarch : Javadoc for ldapjdk
java-1.6.0-openjdk.x86_64 : OpenJDK Runtime Environment
java-1.6.0-openjdk-demo.x86_64 : OpenJDK Demos
java-1.6.0-openjdk-devel.x86_64 : OpenJDK Development Environment
java-1.6.0-openjdk-javadoc.x86_64 : OpenJDK API Documentation
java-1.6.0-openjdk-src.x86_64 : OpenJDK Source Bundle
java-1.7.0-openjdk.x86_64 : OpenJDK Runtime Environment
java-1.7.0-openjdk-accessibility.x86_64 : OpenJDK accessibility connector
java-1.7.0-openjdk-demo.x86_64 : OpenJDK Demos
java-1.7.0-openjdk-devel.x86_64 : OpenJDK Development Environment
java-1.7.0-openjdk-headless.x86_64 : The OpenJDK runtime environment without
java-1.7.0-openjdk-javadoc.noarch : OpenJDK API Documentation
java-1.7.0-openjdk-src.x86_64 : OpenJDK Source Bundle
java-1.8.0-openjdk.i686 : OpenJDK Runtime Environment 8
java-1.8.0-openjdk.x86_64 : OpenJDK Runtime Environment 8
java-1.8.0-openjdk-accessibility.i686 : OpenJDK accessibility connector
java-1.8.0-openjdk-accessibility.x86_64 : OpenJDK accessibility connector
java-1.8.0-openjdk-demo.i686 : OpenJDK Demos 8
java-1.8.0-openjdk-demo.x86_64 : OpenJDK Demos 8
java-1.8.0-openjdk-devel.i686 : OpenJDK Development Environment 8
java-1.8.0-openjdk-devel.x86_64 : OpenJDK Development Environment 8
java-1.8.0-openjdk-headless.i686 : OpenJDK Headless Runtime Environment 8
java-1.8.0-openjdk-headless.x86_64 : OpenJDK Headless Runtime Environment 8
java-1.8.0-openjdk-javadoc.noarch : OpenJDK 8 API documentation
java-1.8.0-openjdk-javadoc-zip.noarch : OpenJDK 8 API documentation compressed
java-1.8.0-openjdk-src.i686 : OpenJDK Source Bundle 8
java-1.8.0-openjdk-src.x86_64 : OpenJDK Source Bundle 8
java-11-openjdk.i686 : OpenJDK Runtime Environment 11
java-11-openjdk.x86_64 : OpenJDK Runtime Environment 11
java-11-openjdk-demo.i686 : OpenJDK Demos 11
java-11-openjdk-demo.x86_64 : OpenJDK Demos 11
java-11-openjdk-devel.i686 : OpenJDK Development Environment 11
java-11-openjdk-devel.x86_64 : OpenJDK Development Environment 11
java-11-openjdk-headless.i686 : OpenJDK Headless Runtime Environment 11
java-11-openjdk-headless.x86_64 : OpenJDK Headless Runtime Environment 11
java-11-openjdk-javadoc.i686 : OpenJDK 11 API documentation
java-11-openjdk-javadoc.x86_64 : OpenJDK 11 API documentation
java-11-openjdk-javadoc-zip.i686 : OpenJDK 11 API documentation compressed in a
java-11-openjdk-javadoc-zip.x86_64 : OpenJDK 11 API documentation compressed in
java-11-openjdk-jmods.i686 : JMods for OpenJDK 11
java-11-openjdk-jmods.x86_64 : JMods for OpenJDK 11
java-11-openjdk-src.i686 : OpenJDK Source Bundle 11
java-11-openjdk-src.x86_64 : OpenJDK Source Bundle 11
ldapjdk.noarch : The Mozilla LDAP Java SDK
[root@TrueDei jdk12-06222165c35f]# 

我们选择jdk11的安装

[root@TrueDei jdk12-06222165c35f]# 
[root@TrueDei jdk12-06222165c35f]# yum -y install java-11-openjdk-devel

安装好就会可以查看版本信息

[root@TrueDei jdk12-06222165c35f]# 
[root@TrueDei jdk12-06222165c35f]# java -version
openjdk version "11.0.7" 2020-04-14 LTS
OpenJDK Runtime Environment 18.9 (build 11.0.7+10-LTS)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.7+10-LTS, mixed mode, sharing)
[root@TrueDei jdk12-06222165c35f]# 

六,安装必要的依赖

安装GCC 版本至少4.8以上, 官方推荐版本7.8 或 CLang 3.2 以上

SCL(Software Collections)是为了给RHEL/CentOS 用户提供一种以方便、安全地安装和使用应用程序和运行时环境的多个(而且可能是更新的)版本的方式,同时避免把系统搞乱。与之相对的是第三方源,它们可能会在已安装的包之间引起冲突

[root@TrueDei jdk12-06222165c35f]# yum install -y centos-release-scl
[root@TrueDei jdk12-06222165c35f]# yum install -y devtoolset-7
[root@TrueDei jdk12-06222165c35f]# scl enable devtoolset-7 bash

下载的速度决定于自己的网速

七,编译

你可能会问了:我看其他文章里都是要求的一下子装很多很多的软件的呀,在这里怎么一个也不安装了.

我想教会的你的是如何解决问题,并不是一下子帮你解决好.

这样子才能学到东西

这里就安装额这些,咱们直接编译,边编译,边发现问题,边解决问题:

再来看一下当前的目录

[root@TrueDei jdk12-06222165c35f]# pwd
/root/jdk12/jdk12-06222165c35f
[root@TrueDei jdk12-06222165c35f]#
[root@TrueDei jdk12-06222165c35f]# 
[root@TrueDei jdk12-06222165c35f]# ll
总用量 48
-rw-r--r--.  1 root root  2114 3月  20 2019 ADDITIONAL_LICENSE_INFO
-rw-r--r--.  1 root root  1522 3月  20 2019 ASSEMBLY_EXCEPTION
drwxr-xr-x.  3 root root   158 5月   9 11:21 bin
-rw-r--r--.  1 root root  1649 3月  20 2019 configure
drwxr-xr-x.  3 root root    99 5月   9 11:21 doc
-rw-r--r--.  1 root root 19274 3月  20 2019 LICENSE
drwxr-xr-x. 23 root root  4096 5月   9 11:21 make
-rw-r--r--.  1 root root  2785 3月  20 2019 Makefile
-rw-r--r--.  1 root root   341 3月  20 2019 README
drwxr-xr-x. 78 root root  4096 5月   9 11:21 src
drwxr-xr-x. 14 root root   217 5月   9 11:21 test
[root@TrueDei jdk12-06222165c35f]# 

编译:

在Linux中以后的路还长,遇到这种问题一定是不可避免的,所以要好好看了,一定要学到.

[root@TrueDei jdk12-06222165c35f]# bash configure 
Runnable configure script is not present
Generating runnable configure script at /root/jdk12/jdk12-06222165c35f/build/.configure-support/generated-configure.sh

Autoconf is not found on the PATH, and AUTOCONF is not set.
You need autoconf to be able to generate a runnable configure script.
You might be able to fix this by running 'sudo yum install autoconf'.
Error: Cannot find autoconf
[root@TrueDei jdk12-06222165c35f]# 

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-sp7d0gyr-1590072127453)(/media/truedei/文档/大学/CSDN/JVM虚拟机/编译jdk.assets/1590066809518.png)]

安装本次缺少的依赖:

[root@TrueDei jdk12-06222165c35f]# yum install -y autoconf

继续执行:

[root@TrueDei jdk12-06222165c35f]# bash configure 
.
.
.
.
忽略.......
..
.
.
checking how to link with libstdc++... static
checking for X... no
configure: error: Could not find X11 libraries. You might be able to fix this by running 'sudo yum install libXtst-devel libXt-devel libXrender-devel libXrandr-devel libXi-devel'.
configure exiting with result code 1

如上提示需要这些依赖,那么继续安装

[root@TrueDei jdk12-06222165c35f]# yum install libXtst-devel libXt-devel libXrender-devel libXrandr-devel libXi-devel -y

继续编译

[root@TrueDei jdk12-06222165c35f]# bash configure 
.
.
.
.
忽略.......
..
.
.
checking for cups/ppd.h... no
configure: error: Could not find cups! You might be able to fix this by running 'sudo yum install cups-devel'. 
configure exiting with result code 1
[root@TrueDei jdk12-06222165c35f]# 

如上提示的缺少如下依赖: yum install cups-devel

继续安装上面缺少的依赖

[root@TrueDei jdk12-06222165c35f]# yum install cups-devel -y

继续编译

[root@TrueDei jdk12-06222165c35f]# bash configure 
.
.
.
.
忽略.......
..
.
.
checking for fontconfig/fontconfig.h... no
configure: error: Could not find fontconfig! You might be able to fix this by running 'sudo yum install fontconfig-devel'. 
configure exiting with result code 1
[root@TrueDei jdk12-06222165c35f]# 

本次缺少: yum install fontconfig-devel

继续安装上面缺少的依赖:

[root@TrueDei jdk12-06222165c35f]# yum install fontconfig-devel -y

继续编译

[root@TrueDei jdk12-06222165c35f]# bash configure 
.
.
.
.
忽略.......
..
.
.
checking for alsa/asoundlib.h... no
configure: error: Could not find alsa! You might be able to fix this by running 'sudo yum install alsa-lib-devel'.
configure exiting with result code 1
[root@TrueDei jdk12-06222165c35f]# 

Could not find alsa! You might be able to fix this by running 'sudo yum install alsa-lib-devel'.

继续安装:

[root@TrueDei jdk12-06222165c35f]# yum install alsa-lib-devel -y

继续编译:

[root@TrueDei jdk12-06222165c35f]# bash configure 
configure: Configuration created at Sat May  9 12:33:14 EDT 2020.
checking for basename... /usr/bin/basename
checking for bash... /usr/bin/bash
checking for cat... /usr/bin/cat
checking for chmod... /usr/bin/chmod
checking for cmp... /usr/bin/cmp
checking for comm... /usr/bin/comm
checking for cp... /usr/bin/cp
checking for cut... /usr/bin/cut
checking for date... /usr/bin/date
checking for gdiff... no
checking for diff... /usr/bin/diff
checking for dirname... /usr/bin/dirname
checking for echo... /usr/bin/echo
checking for expr... /usr/bin/expr
checking for file... /usr/bin/file
checking for find... /usr/bin/find
checking for head... /usr/bin/head
checking for gunzip... /usr/bin/gunzip
checking for pigz... no
checking for gzip... /usr/bin/gzip
checking for ln... /usr/bin/ln
checking for ls... /usr/bin/ls
checking for gmkdir... no
checking for mkdir... /usr/bin/mkdir
checking for mktemp... /usr/bin/mktemp
checking for mv... /usr/bin/mv
checking for nawk... no
checking for gawk... /usr/bin/gawk
checking for printf... /usr/bin/printf
checking for greadlink... no
checking for readlink... /usr/bin/readlink
checking for rm... /usr/bin/rm
checking for rmdir... /usr/bin/rmdir
checking for sh... /usr/bin/sh
checking for sort... /usr/bin/sort
checking for tail... /usr/bin/tail
checking for gtar... /usr/bin/gtar
checking for tee... /usr/bin/tee
checking for touch... /usr/bin/touch
checking for tr... /usr/bin/tr
checking for uname... /usr/bin/uname
checking for uniq... /usr/bin/uniq
checking for wc... /usr/bin/wc
checking for which... /usr/bin/which
checking for xargs... /usr/bin/xargs
checking for gawk... gawk
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for fgrep... /usr/bin/grep -F
checking for a sed that does not truncate output... /usr/bin/sed
checking for cygpath... no
checking for df... /usr/bin/df
checking for cpio... /usr/bin/cpio
checking for nice... /usr/bin/nice
checking for pandoc... no
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking openjdk-build os-cpu... linux-x86_64
checking openjdk-target os-cpu... linux-x86_64
checking compilation type... native
checking for top-level directory... /root/jdk12/jdk12-06222165c35f
checking if custom source is suppressed (openjdk-only)... no
checking which debug level to use... release
checking which variants of the JVM to build... server
checking for sysroot... 
checking for toolchain path... 
checking for extra path... 
checking where to store configuration... in default location
checking what configuration name to use... linux-x86_64-server-release
checking for apt-get... no
checking for yum... yum
checking for gmake... /opt/rh/devtoolset-7/root/usr/bin/gmake
configure: Testing potential make at /opt/rh/devtoolset-7/root/usr/bin/gmake, found using gmake in PATH
configure: Using GNU make at /opt/rh/devtoolset-7/root/usr/bin/gmake (version: GNU Make 4.2.1)
checking if make --output-sync is supported... yes
checking for output-sync value... none
checking if find supports -delete... yes
checking what type of tar was found... gnu
checking that grep (/usr/bin/grep) -Fx handles empty lines in the pattern list correctly... yes
checking for unzip... /usr/bin/unzip
checking for zip... /usr/bin/zip
checking for ldd... /usr/bin/ldd
checking for greadelf... no
checking for readelf... /opt/rh/devtoolset-7/root/usr/bin/readelf
checking for dot... no
checking for hg... no
checking for git... no
checking for stat... /usr/bin/stat
checking for time... no
checking for flock... /usr/bin/flock
checking for dtrace... no
checking for gpatch... no
checking for patch... no
checking bash version... 4.2.46
checking if bash supports pipefail... yes
checking if bash supports errexit (-e)... yes
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for default LOG value... 
checking headless only... no
checking for graphviz dot... no, cannot generate full docs
checking for pandoc... no, cannot generate full docs
checking full docs... no, missing dependencies
checking for cacerts file... default
checking for jni library path... default
checking if packaged modules are kept... yes (default)
checking for version string... 12-internal+0-adhoc.root.jdk12-06222165c35f
checking for javac... /usr/bin/javac
checking for java... /usr/bin/java
configure: Found potential Boot JDK using java(c) in PATH
checking for Boot JDK... /usr/lib/jvm/java-11-openjdk-11.0.7.10-4.el7_8.x86_64
checking Boot JDK version... openjdk version "11.0.7" 2020-04-14 LTS OpenJDK Runtime Environment 18.9 (build 11.0.7+10-LTS) OpenJDK 64-Bit Server VM 18.9 (build 11.0.7+10-LTS, mixed mode, sharing) 
checking for java in Boot JDK... ok
checking for javac in Boot JDK... ok
checking for javadoc in Boot JDK... ok
checking for jar in Boot JDK... ok
checking for jarsigner in Boot JDK... ok
checking if Boot JDK is 32 or 64 bits... 64
checking for local Boot JDK Class Data Sharing (CDS)... yes, created
checking for Build JDK... yes, will use output dir
configure: Using default toolchain gcc (GNU Compiler Collection)
checking for gcc... /opt/rh/devtoolset-7/root/usr/bin/gcc
checking resolved symbolic links for CC... no symlink
configure: Using gcc C compiler version 7.3.1 [gcc (GCC) 7.3.1 20180303 (Red Hat 7.3.1-5)]
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether /opt/rh/devtoolset-7/root/usr/bin/gcc accepts -g... yes
checking for /opt/rh/devtoolset-7/root/usr/bin/gcc option to accept ISO C89... none needed
checking for g++... /opt/rh/devtoolset-7/root/usr/bin/g++
checking resolved symbolic links for CXX... no symlink
configure: Using gcc C++ compiler version 7.3.1 [g++ (GCC) 7.3.1 20180303 (Red Hat 7.3.1-5)]
checking whether we are using the GNU C++ compiler... yes
checking whether /opt/rh/devtoolset-7/root/usr/bin/g++ accepts -g... yes
checking how to run the C preprocessor... /opt/rh/devtoolset-7/root/usr/bin/gcc -E
checking how to run the C++ preprocessor... /opt/rh/devtoolset-7/root/usr/bin/g++ -E
configure: Using gcc linker version 2.28 [GNU ld version 2.28-11.el7]
checking for ar... ar
configure: Rewriting AR to "/opt/rh/devtoolset-7/root/usr/bin/ar"
checking for strip... strip
configure: Rewriting STRIP to "/opt/rh/devtoolset-7/root/usr/bin/strip"
checking for nm... nm
configure: Rewriting NM to "/opt/rh/devtoolset-7/root/usr/bin/nm"
checking for gobjcopy... no
checking for objcopy... objcopy
configure: Rewriting OBJCOPY to "/opt/rh/devtoolset-7/root/usr/bin/objcopy"
checking for gobjdump... no
checking for objdump... objdump
configure: Rewriting OBJDUMP to "/opt/rh/devtoolset-7/root/usr/bin/objdump"
checking for c++filt... c++filt
configure: Rewriting CXXFILT to "/opt/rh/devtoolset-7/root/usr/bin/c++filt"
checking for jtreg... no
checking for jtreg test harness... no, not found
checking for jmh (Java Microbenchmark Harness)... no, disabled
checking for jib... no
checking if @file is supported by gcc... yes
checking if the C compiler supports "-m64"... yes
checking if the C++ compiler supports "-m64"... yes
checking if both compilers support "-m64"... yes
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking stdio.h usability... yes
checking stdio.h presence... yes
checking for stdio.h... yes
checking size of int *... 8
checking for target address size... 64 bits
checking whether byte ordering is bigendian... no
checking if native warnings are errors... true (default)
checking if the C++ compiler supports "-std=gnu++98 -Werror"... yes
checking for library containing clock_gettime... none required
configure: GCC >= 6 detected; adding -fno-delete-null-pointer-checks and -fno-lifetime-dse
configure: GCC >= 6 detected; adding -fno-delete-null-pointer-checks and -fno-lifetime-dse
checking if the C compiler supports "-ffp-contract=off"... yes
checking if the C++ compiler supports "-ffp-contract=off"... yes
checking if both compilers support "-ffp-contract=off"... yes
checking what type of native debug symbols to use... external
checking for dtrace tool... not found, cannot build dtrace
checking sys/sdt.h usability... no
checking sys/sdt.h presence... no
checking for sys/sdt.h... no
checking if dtrace should be built... no, missing dependencies
checking if Hotspot gtest unit tests should be built... yes
checking if static link of stdc++ is possible... yes
checking how to link with libstdc++... static
checking for X... libraries , headers 
checking for gethostbyname... yes
checking for connect... yes
checking for remove... yes
checking for shmat... yes
checking for IceConnectionNumber in -lICE... yes
checking for X11/extensions/shape.h... yes
checking for X11/extensions/Xrender.h... yes
checking for X11/extensions/XTest.h... yes
checking for X11/Intrinsic.h... yes
checking for X11/extensions/Xrandr.h... yes
checking if XlinearGradient is defined in Xrender.h... yes
checking cups/cups.h usability... yes
checking cups/cups.h presence... yes
checking for cups/cups.h... yes
checking cups/ppd.h usability... yes
checking cups/ppd.h presence... yes
checking for cups/ppd.h... yes
checking fontconfig/fontconfig.h usability... yes
checking fontconfig/fontconfig.h presence... yes
checking for fontconfig/fontconfig.h... yes
checking for FREETYPE... yes
checking for freetype... yes (using pkg-config)
Using freetype: system
checking for ALSA... yes
checking for which libjpeg to use... bundled
checking for which giflib to use... bundled
checking for PNG... yes
checking for which libpng to use... bundled
checking for compress in -lz... yes
checking for which zlib to use... system
checking for system zlib functionality... ok
checking for which lcms to use... bundled
checking for cos in -lm... yes
checking for dlopen in -ldl... yes
checking if shenandoah can be built... yes
checking if zgc can be built... yes
checking if jvmci module jdk.internal.vm.ci should be built... yes
checking if graal module jdk.internal.vm.compiler should be built... yes
checking if aot should be enabled... yes
checking if cds should be enabled... yes
checking if elliptic curve crypto implementation is present... yes
checking if jtreg failure handler should be built... no, missing jtreg
checking if the CDS classlist generation should be enabled... yes
checking if any translations should be excluded... no
checking if static man pages should be copied... yes
checking if a default CDS archive should be generated... yes
checking for number of cores... 1
checking for memory size... 991 MB
checking for appropriate number of jobs to run in parallel... 1
checking flags for boot jdk java command ...  -Duser.language=en -Duser.country=US  -XX:+UnlockDiagnosticVMOptions -XX:-VerifySharedSpaces -XX:SharedArchiveFile=/root/jdk12/jdk12-06222165c35f/build/linux-x86_64-server-release/configure-support/classes.jsa -Xshare:auto 
checking flags for boot jdk java command for big workloads...  -Xms64M -Xmx512M -XX:ThreadStackSize=1536
checking flags for bootcycle boot jdk java command for big workloads... -Xms64M -Xmx512M -XX:ThreadStackSize=1536
checking flags for boot jdk java command for small workloads...  -XX:+UseSerialGC -Xms32M -Xmx512M -XX:TieredStopAtLevel=1
checking whether to use sjavac... no
checking whether to use javac server... yes
checking If precompiled header is enabled... yes
checking that precompiled headers work... yes
checking is ccache enabled... no
checking if build directory is on local disk... yes
checking JVM features for JVM variant 'server'... "aot cds cmsgc compiler1 compiler2 epsilongc g1gc graal jfr jni-check jvmci jvmti management nmt parallelgc serialgc services shenandoahgc vm-structs zgc"
configure: creating /root/jdk12/jdk12-06222165c35f/build/linux-x86_64-server-release/configure-support/config.status
config.status: creating /root/jdk12/jdk12-06222165c35f/build/linux-x86_64-server-release/spec.gmk
config.status: creating /root/jdk12/jdk12-06222165c35f/build/linux-x86_64-server-release/bootcycle-spec.gmk
config.status: creating /root/jdk12/jdk12-06222165c35f/build/linux-x86_64-server-release/buildjdk-spec.gmk
config.status: creating /root/jdk12/jdk12-06222165c35f/build/linux-x86_64-server-release/compare.sh
config.status: creating /root/jdk12/jdk12-06222165c35f/build/linux-x86_64-server-release/Makefile

====================================================
A new configuration has been successfully created in
/root/jdk12/jdk12-06222165c35f/build/linux-x86_64-server-release
using default settings.

Configuration summary:
* Debug level:    release
* HS debug level: product
* JVM variants:   server
* JVM features:   server: 'aot cds cmsgc compiler1 compiler2 epsilongc g1gc graal jfr jni-check jvmci jvmti management nmt parallelgc serialgc services shenandoahgc vm-structs zgc' 
* OpenJDK target: OS: linux, CPU architecture: x86, address length: 64
* Version string: 12-internal+0-adhoc.root.jdk12-06222165c35f (12-internal)

Tools summary:
* Boot JDK:       openjdk version "11.0.7" 2020-04-14 LTS OpenJDK Runtime Environment 18.9 (build 11.0.7+10-LTS) OpenJDK 64-Bit Server VM 18.9 (build 11.0.7+10-LTS, mixed mode, sharing)  (at /usr/lib/jvm/java-11-openjdk-11.0.7.10-4.el7_8.x86_64)
* Toolchain:      gcc (GNU Compiler Collection)
* C Compiler:     Version 7.3.1 (at /opt/rh/devtoolset-7/root/usr/bin/gcc)
* C++ Compiler:   Version 7.3.1 (at /opt/rh/devtoolset-7/root/usr/bin/g++)

Build performance summary:
* Cores to use:   1
* Memory limit:   991 MB

一直到不报错为止

在这里插入图片描述

八,继续make

开始编译,编译完后,进入到jdk目录下的 ./build/配置名称/jdk 可以看到编译后的文件 (配置名称没有设置的话,会是编译的机器名)

这个时间可能会特别慢,等待吧,可以去刷一道算法题再回来

[root@TrueDei jdk12-06222165c35f]# make images

make完成之后是下面这个样子

在这里插入图片描述

九,测试成果

进入到编译后的jdk目录

[root@TrueDei jdk12-06222165c35f]# pwd
/root/jdk12/jdk12-06222165c35f
[root@TrueDei jdk12-06222165c35f]# 
[root@TrueDei jdk12-06222165c35f]# 
[root@TrueDei jdk12-06222165c35f]# cd build/linux-x86_64-server-release/jdk/bin/
[root@TrueDei bin]# 
[root@TrueDei bin]# 
[root@TrueDei bin]# 
[root@TrueDei bin]# pwd
/root/jdk12/jdk12-06222165c35f/build/linux-x86_64-server-release/jdk/bin
[root@TrueDei bin]# 
[root@TrueDei bin]# 
[root@TrueDei bin]# ll java
-rwxr-xr-x. 1 root root 12992 5月   9 13:04 java
[root@TrueDei bin]# 
[root@TrueDei bin]# ./java -version
openjdk version "12-internal" 2019-03-19
OpenJDK Runtime Environment (build 12-internal+0-adhoc.root.jdk12-06222165c35f)
OpenJDK 64-Bit Server VM (build 12-internal+0-adhoc.root.jdk12-06222165c35f, mixed mode)
[root@TrueDei bin]# 
[root@TrueDei bin]# 

如果对你有帮助,可以分享给你身边的朋友。或者给俺点个大大的赞和大大的评论,点赞和评论就是给我最大的支持,感谢。
水平有限,难免会有疏漏或者书写不合理的地方,欢迎交流讨论。
作者:TrueDei
作者主页:https://truedei.blog.csdn.net/
原文地址:https://truedei.blog.csdn.net/article/details/106269373
转载说明:如需转载请注明原地址和作者名。

如果喜欢我的文章,还没看够可以关注我,我会用心写好每一篇文章。

猜你喜欢

转载自blog.csdn.net/qq_17623363/article/details/106269373
今日推荐