自己动手编译 JDK(MacOS)
相关文章从 Java 程序优雅停机到 Linux 信号机制初窥去年就尝试过自己编译 JDK,但是失败了,最近在分析Java 虚拟机是如何处理 Linux 信号的时候,虽然大体流程清晰了,但是还是有很多方面无法理解,所以编译调试 JDK 势在必行。我的操作系统版本:macOS Catalina 10.15.5。安装 XCode 和 Commnad Line Tools for XCode这个应该是可
相关文章
去年就尝试过自己编译 JDK,但是失败了,最近在分析 Java 虚拟机是如何处理 Linux 信号的时候,虽然大体流程清晰了,但是还是有很多方面无法理解,所以编译调试 JDK 势在必行。
我的操作系统版本:macOS Catalina 10.15.5。
安装 XCode 和 Commnad Line Tools for XCode
这个应该是可以不安装的,但是为了避免出现依赖问题,我还是安装了。
安装版本:11.5 (11E608c)。
获取 OpenJDK 源码
OpenJDK 是使用 Mercurial 进行代码管理的,Mercurial 很小众,那还要再安装 Mercurial,感觉没必要,而且听说拉源码的时候网络很容易断。这里直接下载下来:http://jdk.java.net/
我一开始选择了 8,源码下载下来后,查看一下说明:
坑爹的是看到了这个:
想想也是,8 其实已经算是一个老版本了,印象中编辑 JDK 之前需要准备一个 N-1 版本的可用的 Bootstrap JDK,我本机已经装了 JDK 11:
➜ ~ java11
➜ ~ java -version
java version "11.0.2" 2019-01-15 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.2+9-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.2+9-LTS, mixed mode)
那我换一个下载 12:
macOS
Apple is using a quite aggressive scheme of pushing OS updates, and coupling these updates with required updates of Xcode. Unfortunately, this makes it difficult for a project such as the JDK to keep pace with a continuously updated machine running macOS. See the section on Apple Xcode on some strategies to deal with this.
It is recommended that you use at least Mac OS X 10.13 (High Sierra). At the time of writing, the JDK has been successfully compiled on macOS 10.12 (Sierra).
The standard macOS environment contains the basic tooling needed to build, but for external libraries a package manager is recommended. The JDK uses homebrew in the examples, but feel free to use whatever manager you want (or none).
Apple Xcode
The oldest supported version of Xcode is 8.
看着版本勉强应该可以契合,先试试。
准备环境
根据网上资料显示,需要安装这么几个:
brew install ccache //加速编译
brew install freetype //字体引擎,编译过程中会被依赖到
安装过程中更新 Homebrew 花了很长时间。
Configure 检查
首先需要配置编译参数,building.html 也有参数说明:
Configure Arguments for Tailoring the Build
--enable-debug
- Set the debug level tofastdebug
(this is a shorthand for--with-debug-level=fastdebug
)--with-debug-level=
- Set the debug level, which can berelease
,fastdebug
,slowdebug
oroptimized
. Default isrelease
.optimized
is variant ofrelease
with additional Hotspot debug code.--with-native-debug-symbols=
- Specify if and how native debug symbols should be built. Available methods arenone
,internal
,external
,zipped
. Default behavior depends on platform. See Native Debug Symbols for more details.--with-version-string=
- Specify the version string this build will be identified with.--with-version-=
- A group of options, where `` can be any ofpre
,opt
,build
,major
,minor
,security
orpatch
. Use these options to modify just the corresponding part of the version string from the default, or the value provided by--with-version-string
.--with-jvm-variants=[,...]
- Build the specified variant (or variants) of Hotspot. Valid variants are:server
,client
,minimal
,core
,zero
,custom
. Note that not all variants are possible to combine in a single build.--with-jvm-features=[,...]
- Use the specified JVM features when building Hotspot. The list of features will be enabled on top of the default list. For thecustom
JVM variant, this default list is empty. A complete list of available JVM features can be found usingbash configure --help
.--with-target-bits=
- Create a target binary suitable for running on a `` platform. Use this to create 32-bit output on a 64-bit build platform, instead of doing a full cross-compile. (This is known as a reduced build.)On Linux, BSD and AIX, it is possible to override where Java by default searches for runtime/JNI libraries. This can be useful in situations where there is a special shared directory for system JNI libraries. This setting can in turn be overriden at runtime by setting the
java.library.path
property.
--with-jni-libpath=
- Use the specified path as a default when searching for runtime libraries.
为了便于以后再回过头看,我这里完成记录命令执行过程:
➜ 2.10.1 cd ~/Desktop/temp/openjdk12
➜ openjdk12 ls
openjdk 2 openjdk-12+32_src.zip
➜ openjdk12 cd openjdk\ 2
➜ openjdk 2 ll
total 80
-rw-r--r--@ 1 dongguabai staff 2.1K 2 14 2019 ADDITIONAL_LICENSE_INFO
-rw-r--r--@ 1 dongguabai staff 1.5K 2 14 2019 ASSEMBLY_EXCEPTION
-rw-r--r--@ 1 dongguabai staff 19K 2 14 2019 LICENSE
-rw-r--r--@ 1 dongguabai staff 2.7K 2 14 2019 Makefile
-rw-r--r--@ 1 dongguabai staff 341B 2 14 2019 README
drwxr-xr-x@ 9 dongguabai staff 288B 5 27 13:40 bin
-rw-r--r--@ 1 dongguabai staff 1.6K 2 14 2019 configure
drwxr-xr-x@ 7 dongguabai staff 224B 5 27 13:40 doc
drwxr-xr-x@ 68 dongguabai staff 2.1K 5 27 13:40 make
drwxr-xr-x@ 78 dongguabai staff 2.4K 5 27 13:41 src
drwxr-xr-x@ 16 dongguabai staff 512B 5 27 13:41 test
➜ openjdk 2 ./configure --with-target-bits=64 --with-freetype=/usr/local/Cellar/freetype/2.10.1 --enable-ccache --with-jvm-variants=server,client --with-boot-jdk-jvmargs="-Xlint:deprecation -Xlint:unchecked" --disable-warnings-as-errors --with-debug-level=slowdebug 2>&1 | tee configure_mac_x64.log
zsh: permission denied: ./configure
➜ openjdk 2 sudo ./configure --with-target-bits=64 --with-freetype=/usr/local/Cellar/freetype/2.10.1 --enable-ccache --with-jvm-variants=server,client --with-boot-jdk-jvmargs="-Xlint:deprecation -Xlint:unchecked" --disable-warnings-as-errors --with-debug-level=slowdebug 2>&1 | tee configure_mac_x64.log
Password:
sudo: ./configure: command not found
➜ openjdk 2 chmod u+x configure
➜ openjdk 2 sudo ./configure --with-target-bits=64 --with-freetype=/usr/local/Cellar/freetype/2.10.1 --enable-ccache --with-jvm-variants=server,client --with-boot-jdk-jvmargs="-Xlint:deprecation -Xlint:unchecked" --disable-warnings-as-errors --with-debug-level=slowdebug 2>&1 | tee configure_mac_x64.log
/Users/dongguabai/Desktop/temp/openjdk12/openjdk: /Users/dongguabai/Desktop/temp/openjdk12/openjdk: No such file or directory
➜ openjdk 2 pwd
/Users/dongguabai/Desktop/temp/openjdk12/openjdk 2
➜ openjdk 2 cd ..
➜ openjdk12 mv openjdk\ 2 openjdk
➜ openjdk12 ll
total 361664
drwxr-xr-x@ 20 dongguabai staff 640B 5 27 13:49 openjdk
-rw-r--r--@ 1 dongguabai staff 173M 5 27 13:25 openjdk-12+32_src.zip
➜ openjdk12 cd openjdk
➜ openjdk ls
ADDITIONAL_LICENSE_INFO Makefile configure make
ASSEMBLY_EXCEPTION README configure_mac_x64.log src
LICENSE bin doc test
➜ openjdk sudo ./configure --with-target-bits=64 --with-freetype=/usr/local/Cellar/freetype/2.10.1 --enable-ccache --with-jvm-variants=server,client --with-boot-jdk-jvmargs="-Xlint:deprecation -Xlint:unchecked" --disable-warnings-as-errors --with-debug-level=slowdebug 2>&1 | tee configure_mac_x64.log
Runnable configure script is not present
Generating runnable configure script at /Users/dongguabai/Desktop/temp/openjdk12/openjdk/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 'brew install autoconf'.
Error: Cannot find autoconf
发现报错了,缺少 autoconf,还是那句话,要认真读文档啊:
Build Tools Requirements
Autoconf
The JDK requires Autoconf on all platforms. At least version 2.69 is required.
- To install on an apt-based Linux, try running
sudo apt-get install autoconf
.- To install on an rpm-based Linux, try running
sudo yum install autoconf
.- To install on macOS, try running
brew install autoconf
.- To install on Windows, try running
/setup-x86_64 -q -P autoconf
.If
configure
has problems locating your installation of autoconf, you can specify it using theAUTOCONF
environment variable, like this:AUTOCONF=<path to autoconf> configure ...
安装 autoconf 后再走一遍:
➜ openjdk brew install autoconf
Updating Homebrew...
==> Downloading https://homebrew.bintray.com/bottles/autoconf-2.69.catalina.bottle.4.tar.gz
==> Downloading from https://akamai.bintray.com/ca/ca510b350e941fb9395522a03f9d2fb5df276085d806ceead763acb95889a368?__gda__=exp=1590559880~hmac
######################################################################## 100.0%
==> Pouring autoconf-2.69.catalina.bottle.4.tar.gz
🍺 /usr/local/Cellar/autoconf/2.69: 67 files, 3.0MB
➜ openjdk sudo ./configure --with-target-bits=64 --with-freetype=/usr/local/Cellar/freetype/2.10.1 --enable-ccache --with-jvm-variants=server,client --with-boot-jdk-jvmargs="-Xlint:deprecation -Xlint:unchecked" --disable-warnings-as-errors --with-debug-level=slowdebug 2>&1 | tee configure_mac_x64.log
Password:
Runnable configure script is not present
Generating runnable configure script at /Users/dongguabai/Desktop/temp/openjdk12/openjdk/build/.configure-support/generated-configure.sh
Using autoconf at /usr/local/bin/autoconf [autoconf (GNU Autoconf) 2.69]
configure: Configuration created at Wed May 27 13:59:47 CST 2020.
checking for basename... /usr/bin/basename
checking for bash... /bin/bash
checking for cat... /bin/cat
checking for chmod... /bin/chmod
checking for cmp... /usr/bin/cmp
checking for comm... /usr/bin/comm
checking for cp... /bin/cp
checking for cut... /usr/bin/cut
checking for date... /bin/date
checking for gdiff... no
checking for diff... /usr/bin/diff
checking for dirname... /usr/bin/dirname
checking for echo... /bin/echo
checking for expr... /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... /bin/ln
checking for ls... /bin/ls
checking for gmkdir... no
checking for mkdir... /bin/mkdir
checking for mktemp... /usr/bin/mktemp
checking for mv... /bin/mv
checking for nawk... no
checking for gawk... no
checking for awk... /usr/bin/awk
checking for printf... /usr/bin/printf
checking for greadlink... no
checking for readlink... /usr/bin/readlink
checking for rm... /bin/rm
checking for rmdir... /bin/rmdir
checking for sh... /bin/sh
checking for sort... /usr/bin/sort
checking for tail... /usr/bin/tail
checking for gtar... no
checking for tar... /usr/bin/tar
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... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
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... /bin/df
checking for cpio... /usr/bin/cpio
checking for nice... /usr/bin/nice
checking for pandoc... no
checking build system type... x86_64-apple-darwin19.5.0
checking host system type... x86_64-apple-darwin19.5.0
checking target system type... x86_64-apple-darwin19.5.0
checking openjdk-build os-cpu... macosx-x86_64
checking openjdk-target os-cpu... macosx-x86_64
configure: --with-target-bits are set to build platform address size; argument has no meaning
checking compilation type... native
checking for top-level directory... /Users/dongguabai/Desktop/temp/openjdk12/openjdk
checking if custom source is suppressed (openjdk-only)... no
checking which debug level to use... slowdebug
checking which variants of the JVM to build... server client
checking for sdk name...
configure: error: No xcodebuild tool and no system framework headers found, use --with-sysroot or --with-sdk-name to provide a path to a valid SDK
/Users/dongguabai/Desktop/temp/openjdk12/openjdk/build/.configure-support/generated-configure.sh: line 82: 5: Bad file descriptor
configure exiting with result code 1
又出现了异常,与 xcodebuild 有关,网上有博客说这个异常可以忽略,执行以下命令可以解决:
➜ openjdk sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
再次重新执行:
➜ openjdk sudo ./configure --with-target-bits=64 --with-freetype=/usr/local/Cellar/freetype/2.10.1 --enable-ccache --with-jvm-variants=server,client --with-boot-jdk-jvmargs="-Xlint:deprecation -Xlint:unchecked" --disable-warnings-as-errors --with-debug-level=slowdebug 2>&1 | tee configure_mac_x64.log
configure: Configuration created at Wed May 27 14:04:44 CST 2020.
checking for basename... /usr/bin/basename
checking for bash... /bin/bash
checking for cat... /bin/cat
checking for chmod... /bin/chmod
checking for cmp... /usr/bin/cmp
checking for comm... /usr/bin/comm
checking for cp... /bin/cp
checking for cut... /usr/bin/cut
checking for date... /bin/date
checking for gdiff... no
checking for diff... /usr/bin/diff
checking for dirname... /usr/bin/dirname
checking for echo... /bin/echo
checking for expr... /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... /bin/ln
checking for ls... /bin/ls
checking for gmkdir... no
checking for mkdir... /bin/mkdir
checking for mktemp... /usr/bin/mktemp
checking for mv... /bin/mv
checking for nawk... no
checking for gawk... no
checking for awk... /usr/bin/awk
checking for printf... /usr/bin/printf
checking for greadlink... no
checking for readlink... /usr/bin/readlink
checking for rm... /bin/rm
checking for rmdir... /bin/rmdir
checking for sh... /bin/sh
checking for sort... /usr/bin/sort
checking for tail... /usr/bin/tail
checking for gtar... no
checking for tar... /usr/bin/tar
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... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
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... /bin/df
checking for cpio... /usr/bin/cpio
checking for nice... /usr/bin/nice
checking for pandoc... no
checking build system type... x86_64-apple-darwin19.5.0
checking host system type... x86_64-apple-darwin19.5.0
checking target system type... x86_64-apple-darwin19.5.0
checking openjdk-build os-cpu... macosx-x86_64
checking openjdk-target os-cpu... macosx-x86_64
configure: --with-target-bits are set to build platform address size; argument has no meaning
checking compilation type... native
checking for top-level directory... /Users/dongguabai/Desktop/temp/openjdk12/openjdk
checking if custom source is suppressed (openjdk-only)... no
checking which debug level to use... slowdebug
checking which variants of the JVM to build... server client
checking for xcodebuild... /usr/bin/xcodebuild
checking for sdk name...
checking for sysroot... /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk
checking for toolchain path...
checking for extra path...
checking where to store configuration... in default location
checking what configuration name to use... macosx-x86_64-serverANDclient-slowdebug
checking for apt-get... no
checking for yum... no
checking for brew... brew
checking for gmake... no
checking for make... /usr/bin/make
configure: Testing potential make at /usr/bin/make, found using make in PATH
configure: Using GNU make at /usr/bin/make (version: GNU Make 3.81)
checking if make --output-sync is supported... no
checking if find supports -delete... yes
checking what type of tar was found... bsd
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... no
checking for greadelf... no
checking for readelf... no
checking for dot... no
checking for hg... no
checking for git... /usr/local/bin/git
checking for stat... /usr/bin/stat
checking for time... /usr/bin/time
checking for flock... no
checking for dtrace... /usr/sbin/dtrace
checking for gpatch... no
checking for patch... /usr/bin/patch
checking for dsymutil... /usr/bin/dsymutil
checking for mig... /usr/bin/mig
checking for xattr... /usr/bin/xattr
checking for codesign... /usr/bin/codesign
checking if openjdk_codesign certificate is present... no
checking for SetFile... /usr/bin/SetFile
checking bash version... 3.2.57
checking if bash supports pipefail... yes
checking if bash supports errexit (-e)... yes
checking for pkg-config... no
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.openjdk
Unable to find any JVMs matching version "(null)".
No Java runtime present, try --request to install.
configure: Found potential Boot JDK using /usr/libexec/java_home
configure: Potential Boot JDK found at did not contain bin/java; ignoring
Unable to find any JVMs matching version "1.9".
No Java runtime present, try --request to install.
configure: Found potential Boot JDK using /usr/libexec/java_home -v 1.9
configure: Potential Boot JDK found at did not contain bin/java; ignoring
Unable to find any JVMs matching version "1.8".
No Java runtime present, try --request to install.
configure: Found potential Boot JDK using /usr/libexec/java_home -v 1.8
configure: Potential Boot JDK found at did not contain bin/java; ignoring
Unable to find any JVMs matching version "1.7".
No Java runtime present, try --request to install.
configure: Found potential Boot JDK using /usr/libexec/java_home -v 1.7
configure: Potential Boot JDK found at did not contain bin/java; ignoring
checking for javac... /Users/dongguabai/develope/java11/JavaVirtualMachines/jdk-11.0.2.jdk/Contents/Home/bin/javac
checking for java... /Users/dongguabai/develope/java11/JavaVirtualMachines/jdk-11.0.2.jdk/Contents/Home/bin/java
configure: Found potential Boot JDK using java(c) in PATH
configure: The specified --with-boot-jdk-jvmargs is invalid for the tested java
configure: Error message: "Unrecognized option: -Xlint:deprecation".
configure: Please fix arguments, or point to an explicit boot JDK which accept these arguments
configure: error: Cannot continue
/Users/dongguabai/Desktop/temp/openjdk12/openjdk/build/.configure-support/generated-configure.sh: line 82: 5: Bad file descriptor
configure exiting with result code 1
又出现了异常。这个异常好理解,说我的 with-boot-jdk-jvmargs 指定的参数不被引导 JDK 支持。那就去掉这些参数,重新执行:
➜ openjdk sudo ./configure --with-target-bits=64 --with-freetype=/usr/local/Cellar/freetype/2.10.1 --enable-ccache --with-jvm-variants=server,client --disable-warnings-as-errors --with-debug-level=slowdebug 2>&1 | tee configure_mac_x64.log
configure: Configuration created at Wed May 27 14:18:20 CST 2020.
checking for basename... /usr/bin/basename
checking for bash... /bin/bash
checking for cat... /bin/cat
checking for chmod... /bin/chmod
checking for cmp... /usr/bin/cmp
checking for comm... /usr/bin/comm
checking for cp... /bin/cp
checking for cut... /usr/bin/cut
checking for date... /bin/date
checking for gdiff... no
checking for diff... /usr/bin/diff
checking for dirname... /usr/bin/dirname
checking for echo... /bin/echo
checking for expr... /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... /bin/ln
checking for ls... /bin/ls
checking for gmkdir... no
checking for mkdir... /bin/mkdir
checking for mktemp... /usr/bin/mktemp
checking for mv... /bin/mv
checking for nawk... no
checking for gawk... no
checking for awk... /usr/bin/awk
checking for printf... /usr/bin/printf
checking for greadlink... no
checking for readlink... /usr/bin/readlink
checking for rm... /bin/rm
checking for rmdir... /bin/rmdir
checking for sh... /bin/sh
checking for sort... /usr/bin/sort
checking for tail... /usr/bin/tail
checking for gtar... no
checking for tar... /usr/bin/tar
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... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
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... /bin/df
checking for cpio... /usr/bin/cpio
checking for nice... /usr/bin/nice
checking for pandoc... no
checking build system type... x86_64-apple-darwin19.5.0
checking host system type... x86_64-apple-darwin19.5.0
checking target system type... x86_64-apple-darwin19.5.0
checking openjdk-build os-cpu... macosx-x86_64
checking openjdk-target os-cpu... macosx-x86_64
configure: --with-target-bits are set to build platform address size; argument has no meaning
checking compilation type... native
checking for top-level directory... /Users/dongguabai/Desktop/temp/openjdk12/openjdk
checking if custom source is suppressed (openjdk-only)... no
checking which debug level to use... slowdebug
checking which variants of the JVM to build... server client
checking for xcodebuild... /usr/bin/xcodebuild
checking for sdk name...
checking for sysroot... /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk
checking for toolchain path...
checking for extra path...
checking where to store configuration... in default location
checking what configuration name to use... macosx-x86_64-serverANDclient-slowdebug
checking for apt-get... no
checking for yum... no
checking for brew... brew
checking for gmake... no
checking for make... /usr/bin/make
configure: Testing potential make at /usr/bin/make, found using make in PATH
configure: Using GNU make at /usr/bin/make (version: GNU Make 3.81)
checking if make --output-sync is supported... no
checking if find supports -delete... yes
checking what type of tar was found... bsd
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... no
checking for greadelf... no
checking for readelf... no
checking for dot... no
checking for hg... no
checking for git... /usr/local/bin/git
checking for stat... /usr/bin/stat
checking for time... /usr/bin/time
checking for flock... no
checking for dtrace... /usr/sbin/dtrace
checking for gpatch... no
checking for patch... /usr/bin/patch
checking for dsymutil... /usr/bin/dsymutil
checking for mig... /usr/bin/mig
checking for xattr... /usr/bin/xattr
checking for codesign... /usr/bin/codesign
checking if openjdk_codesign certificate is present... no
checking for SetFile... /usr/bin/SetFile
checking bash version... 3.2.57
checking if bash supports pipefail... yes
checking if bash supports errexit (-e)... yes
checking for pkg-config... no
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.openjdk
Unable to find any JVMs matching version "(null)".
No Java runtime present, try --request to install.
configure: Found potential Boot JDK using /usr/libexec/java_home
configure: Potential Boot JDK found at did not contain bin/java; ignoring
Unable to find any JVMs matching version "1.9".
No Java runtime present, try --request to install.
configure: Found potential Boot JDK using /usr/libexec/java_home -v 1.9
configure: Potential Boot JDK found at did not contain bin/java; ignoring
Unable to find any JVMs matching version "1.8".
No Java runtime present, try --request to install.
configure: Found potential Boot JDK using /usr/libexec/java_home -v 1.8
configure: Potential Boot JDK found at did not contain bin/java; ignoring
Unable to find any JVMs matching version "1.7".
No Java runtime present, try --request to install.
configure: Found potential Boot JDK using /usr/libexec/java_home -v 1.7
configure: Potential Boot JDK found at did not contain bin/java; ignoring
checking for javac... /Users/dongguabai/develope/java11/JavaVirtualMachines/jdk-11.0.2.jdk/Contents/Home/bin/javac
checking for java... /Users/dongguabai/develope/java11/JavaVirtualMachines/jdk-11.0.2.jdk/Contents/Home/bin/java
configure: Found potential Boot JDK using java(c) in PATH
checking for Boot JDK... /Users/dongguabai/develope/java11/JavaVirtualMachines/jdk-11.0.2.jdk/Contents/Home
checking Boot JDK version... java version "11.0.2" 2019-01-15 LTS Java(TM) SE Runtime Environment 18.9 (build 11.0.2+9-LTS) Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.2+9-LTS, mixed mode)
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: Xcode major version: 11
configure: Using default toolchain clang (clang/LLVM)
checking for clang... /usr/bin/clang
checking resolved symbolic links for CC... no symlink
configure: Using clang C compiler version 11.0.3 [Apple clang version 11.0.3 (clang-1103.0.32.62) Target: x86_64-apple-darwin19.5.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin]
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 /usr/bin/clang accepts -g... yes
checking for /usr/bin/clang option to accept ISO C89... none needed
checking for clang++... /usr/bin/clang++
checking resolved symbolic links for CXX... no symlink
configure: Using clang C++ compiler version 11.0.3 [Apple clang version 11.0.3 (clang-1103.0.32.62) Target: x86_64-apple-darwin19.5.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin]
checking whether we are using the GNU C++ compiler... yes
checking whether /usr/bin/clang++ accepts -g... yes
checking how to run the C preprocessor... /usr/bin/clang -E
checking how to run the C++ preprocessor... /usr/bin/clang++ -E
configure: Using clang linker version 556.6 [@(#)PROGRAM:ld PROJECT:ld64-556.6]
checking for ar... ar
configure: Rewriting AR to "/usr/bin/ar"
checking for lipo... /usr/bin/lipo
checking for otool... /usr/bin/otool
checking for install_name_tool... /usr/bin/install_name_tool
checking for strip... strip
configure: Rewriting STRIP to "/usr/bin/strip"
checking for nm... nm
configure: Rewriting NM to "/usr/bin/nm"
checking for gobjdump... no
checking for objdump... objdump
configure: Rewriting OBJDUMP to "/usr/bin/objdump"
checking for c++filt... c++filt
configure: Rewriting CXXFILT to "/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 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... no (explicitly set)
checking for library containing clock_gettime... none required
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... /usr/sbin/dtrace
checking sys/sdt.h usability... yes
checking sys/sdt.h presence... yes
checking for sys/sdt.h... yes
checking if dtrace should be built... yes, dependencies present
checking if Hotspot gtest unit tests should be built... 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
configure: error: 'valid values for --with-freetype are 'system' and 'bundled'
/Users/dongguabai/Desktop/temp/openjdk12/openjdk/build/.configure-support/generated-configure.sh: line 82: 5: Bad file descriptor
configure exiting with result code 1
显示与 with-freetype 有关,根据 building.html 的说明:
FreeType
FreeType2 from The FreeType Project is not required on any platform. The exception is on Unix-based platforms when configuring such that the build artifacts will reference a system installed library, rather than bundling the JDK’s own copy.
- To install on an apt-based Linux, try running
sudo apt-get install libfreetype6-dev
.- To install on an rpm-based Linux, try running
sudo yum install freetype-devel
.- To install on Solaris, try running
pkg install system/library/freetype-2
.Use
--with-freetype-include=
and--with-freetype-lib=
ifconfigure
does not automatically locate the platform FreeType files.
既然是这样的话,那我干脆就不指定 freetype,如果找不到我再指定,修改参数后再操作一次:
➜ openjdk sudo ./configure --with-target-bits=64 --enable-ccache --with-jvm-variants=server,client --disable-warnings-as-errors --with-debug-level=slowdebug 2>&1 | tee configure_mac_x64.log
configure: Configuration created at Wed May 27 14:29:02 CST 2020.
checking for basename... /usr/bin/basename
checking for bash... /bin/bash
checking for cat... /bin/cat
checking for chmod... /bin/chmod
checking for cmp... /usr/bin/cmp
checking for comm... /usr/bin/comm
checking for cp... /bin/cp
checking for cut... /usr/bin/cut
checking for date... /bin/date
checking for gdiff... no
checking for diff... /usr/bin/diff
checking for dirname... /usr/bin/dirname
checking for echo... /bin/echo
checking for expr... /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... /bin/ln
checking for ls... /bin/ls
checking for gmkdir... no
checking for mkdir... /bin/mkdir
checking for mktemp... /usr/bin/mktemp
checking for mv... /bin/mv
checking for nawk... no
checking for gawk... no
checking for awk... /usr/bin/awk
checking for printf... /usr/bin/printf
checking for greadlink... no
checking for readlink... /usr/bin/readlink
checking for rm... /bin/rm
checking for rmdir... /bin/rmdir
checking for sh... /bin/sh
checking for sort... /usr/bin/sort
checking for tail... /usr/bin/tail
checking for gtar... no
checking for tar... /usr/bin/tar
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... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
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... /bin/df
checking for cpio... /usr/bin/cpio
checking for nice... /usr/bin/nice
checking for pandoc... no
checking build system type... x86_64-apple-darwin19.5.0
checking host system type... x86_64-apple-darwin19.5.0
checking target system type... x86_64-apple-darwin19.5.0
checking openjdk-build os-cpu... macosx-x86_64
checking openjdk-target os-cpu... macosx-x86_64
configure: --with-target-bits are set to build platform address size; argument has no meaning
checking compilation type... native
checking for top-level directory... /Users/dongguabai/Desktop/temp/openjdk12/openjdk
checking if custom source is suppressed (openjdk-only)... no
checking which debug level to use... slowdebug
checking which variants of the JVM to build... server client
checking for xcodebuild... /usr/bin/xcodebuild
checking for sdk name...
checking for sysroot... /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk
checking for toolchain path...
checking for extra path...
checking where to store configuration... in default location
checking what configuration name to use... macosx-x86_64-serverANDclient-slowdebug
checking for apt-get... no
checking for yum... no
checking for brew... brew
checking for gmake... no
checking for make... /usr/bin/make
configure: Testing potential make at /usr/bin/make, found using make in PATH
configure: Using GNU make at /usr/bin/make (version: GNU Make 3.81)
checking if make --output-sync is supported... no
checking if find supports -delete... yes
checking what type of tar was found... bsd
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... no
checking for greadelf... no
checking for readelf... no
checking for dot... no
checking for hg... no
checking for git... /usr/local/bin/git
checking for stat... /usr/bin/stat
checking for time... /usr/bin/time
checking for flock... no
checking for dtrace... /usr/sbin/dtrace
checking for gpatch... no
checking for patch... /usr/bin/patch
checking for dsymutil... /usr/bin/dsymutil
checking for mig... /usr/bin/mig
checking for xattr... /usr/bin/xattr
checking for codesign... /usr/bin/codesign
checking if openjdk_codesign certificate is present... no
checking for SetFile... /usr/bin/SetFile
checking bash version... 3.2.57
checking if bash supports pipefail... yes
checking if bash supports errexit (-e)... yes
checking for pkg-config... no
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.openjdk
Unable to find any JVMs matching version "(null)".
No Java runtime present, try --request to install.
configure: Found potential Boot JDK using /usr/libexec/java_home
configure: Potential Boot JDK found at did not contain bin/java; ignoring
Unable to find any JVMs matching version "1.9".
No Java runtime present, try --request to install.
configure: Found potential Boot JDK using /usr/libexec/java_home -v 1.9
configure: Potential Boot JDK found at did not contain bin/java; ignoring
Unable to find any JVMs matching version "1.8".
No Java runtime present, try --request to install.
configure: Found potential Boot JDK using /usr/libexec/java_home -v 1.8
configure: Potential Boot JDK found at did not contain bin/java; ignoring
Unable to find any JVMs matching version "1.7".
No Java runtime present, try --request to install.
configure: Found potential Boot JDK using /usr/libexec/java_home -v 1.7
configure: Potential Boot JDK found at did not contain bin/java; ignoring
checking for javac... /Users/dongguabai/develope/java11/JavaVirtualMachines/jdk-11.0.2.jdk/Contents/Home/bin/javac
checking for java... /Users/dongguabai/develope/java11/JavaVirtualMachines/jdk-11.0.2.jdk/Contents/Home/bin/java
configure: Found potential Boot JDK using java(c) in PATH
checking for Boot JDK... /Users/dongguabai/develope/java11/JavaVirtualMachines/jdk-11.0.2.jdk/Contents/Home
checking Boot JDK version... java version "11.0.2" 2019-01-15 LTS Java(TM) SE Runtime Environment 18.9 (build 11.0.2+9-LTS) Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.2+9-LTS, mixed mode)
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: Xcode major version: 11
configure: Using default toolchain clang (clang/LLVM)
checking for clang... /usr/bin/clang
checking resolved symbolic links for CC... no symlink
configure: Using clang C compiler version 11.0.3 [Apple clang version 11.0.3 (clang-1103.0.32.62) Target: x86_64-apple-darwin19.5.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin]
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 /usr/bin/clang accepts -g... yes
checking for /usr/bin/clang option to accept ISO C89... none needed
checking for clang++... /usr/bin/clang++
checking resolved symbolic links for CXX... no symlink
configure: Using clang C++ compiler version 11.0.3 [Apple clang version 11.0.3 (clang-1103.0.32.62) Target: x86_64-apple-darwin19.5.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin]
checking whether we are using the GNU C++ compiler... yes
checking whether /usr/bin/clang++ accepts -g... yes
checking how to run the C preprocessor... /usr/bin/clang -E
checking how to run the C++ preprocessor... /usr/bin/clang++ -E
configure: Using clang linker version 556.6 [@(#)PROGRAM:ld PROJECT:ld64-556.6]
checking for ar... ar
configure: Rewriting AR to "/usr/bin/ar"
checking for lipo... /usr/bin/lipo
checking for otool... /usr/bin/otool
checking for install_name_tool... /usr/bin/install_name_tool
checking for strip... strip
configure: Rewriting STRIP to "/usr/bin/strip"
checking for nm... nm
configure: Rewriting NM to "/usr/bin/nm"
checking for gobjdump... no
checking for objdump... objdump
configure: Rewriting OBJDUMP to "/usr/bin/objdump"
checking for c++filt... c++filt
configure: Rewriting CXXFILT to "/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 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... no (explicitly set)
checking for library containing clock_gettime... none required
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... /usr/sbin/dtrace
checking sys/sdt.h usability... yes
checking sys/sdt.h presence... yes
checking for sys/sdt.h... yes
checking if dtrace should be built... yes, dependencies present
checking if Hotspot gtest unit tests should be built... 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
Using freetype: bundled
checking for which libjpeg to use... bundled
checking for which giflib to use... bundled
checking for PNG... 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... no, platform not supported
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... 8
checking for memory size... 8192 MB
checking for appropriate number of jobs to run in parallel... 8
checking flags for boot jdk java command ... -Duser.language=en -Duser.country=US -XX:+UnlockDiagnosticVMOptions -XX:-VerifySharedSpaces -XX:SharedArchiveFile=/Users/dongguabai/Desktop/temp/openjdk12/openjdk/build/macosx-x86_64-serverANDclient-slowdebug/configure-support/classes.jsa -Xshare:auto
checking flags for boot jdk java command for big workloads... -Xms64M -Xmx1600M -XX:ThreadStackSize=1536
checking flags for bootcycle boot jdk java command for big workloads... -Xms64M -Xmx1600M -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 is ccache enabled... yes
checking for ccache... /usr/local/bin/ccache
checking if C-compiler supports ccache precompiled headers... yes
checking if build directory is on local disk... yes
checking JVM features for JVM variant 'server'... "aot cds cmsgc compiler1 compiler2 dtrace epsilongc g1gc graal jfr jni-check jvmci jvmti management nmt parallelgc serialgc services shenandoahgc vm-structs"
checking JVM features for JVM variant 'client'... "cds cmsgc compiler1 dtrace epsilongc g1gc jfr jni-check jvmti management nmt parallelgc serialgc services shenandoahgc vm-structs"
configure: creating /Users/dongguabai/Desktop/temp/openjdk12/openjdk/build/macosx-x86_64-serverANDclient-slowdebug/configure-support/config.status
config.status: creating /Users/dongguabai/Desktop/temp/openjdk12/openjdk/build/macosx-x86_64-serverANDclient-slowdebug/spec.gmk
config.status: creating /Users/dongguabai/Desktop/temp/openjdk12/openjdk/build/macosx-x86_64-serverANDclient-slowdebug/bootcycle-spec.gmk
config.status: creating /Users/dongguabai/Desktop/temp/openjdk12/openjdk/build/macosx-x86_64-serverANDclient-slowdebug/buildjdk-spec.gmk
config.status: creating /Users/dongguabai/Desktop/temp/openjdk12/openjdk/build/macosx-x86_64-serverANDclient-slowdebug/compare.sh
config.status: creating /Users/dongguabai/Desktop/temp/openjdk12/openjdk/build/macosx-x86_64-serverANDclient-slowdebug/Makefile
====================================================
A new configuration has been successfully created in
/Users/dongguabai/Desktop/temp/openjdk12/openjdk/build/macosx-x86_64-serverANDclient-slowdebug
using configure arguments '--with-target-bits=64 --enable-ccache --with-jvm-variants=server,client --disable-warnings-as-errors --with-debug-level=slowdebug'.
Configuration summary:
* Debug level: slowdebug
* HS debug level: debug
* JVM variants: server client
* JVM features: server: 'aot cds cmsgc compiler1 compiler2 dtrace epsilongc g1gc graal jfr jni-check jvmci jvmti management nmt parallelgc serialgc services shenandoahgc vm-structs' client: 'cds cmsgc compiler1 dtrace epsilongc g1gc jfr jni-check jvmti management nmt parallelgc serialgc services shenandoahgc vm-structs'
* OpenJDK target: OS: macosx, CPU architecture: x86, address length: 64
* Version string: 12-internal+0-adhoc.root.openjdk (12-internal)
Tools summary:
* Boot JDK: java version "11.0.2" 2019-01-15 LTS Java(TM) SE Runtime Environment 18.9 (build 11.0.2+9-LTS) Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.2+9-LTS, mixed mode) (at /Users/dongguabai/develope/java11/JavaVirtualMachines/jdk-11.0.2.jdk/Contents/Home)
* Toolchain: clang (clang/LLVM from Xcode 11.5)
* C Compiler: Version 11.0.3 (at /usr/bin/clang)
* C++ Compiler: Version 11.0.3 (at /usr/bin/clang++)
Build performance summary:
* Cores to use: 8
* Memory limit: 8192 MB
* ccache status: Active (3.7.9)
NOTE: You have requested to build more than one version of the JVM, which
will result in longer build times.
很顺利。
Make
➜ openjdk ls
-Xlint:deprecation Makefile configure make_mac_x64.log
ADDITIONAL_LICENSE_INFO README configure_mac_x64.log src
ASSEMBLY_EXCEPTION bin doc test
LICENSE build make ???disable-warnings-as-errors
➜ openjdk sudo make
Password:
Building target 'default (exploded-image)' in configuration 'macosx-x86_64-serverANDclient-slowdebug'
Compiling 8 files for BUILD_TOOLS_LANGTOOLS
Parsing 2 properties into enum-like class for jdk.compiler
Compiling 13 properties into resource bundles for jdk.javadoc
Compiling 12 properties into resource bundles for jdk.jdeps
Compiling 7 properties into resource bundles for jdk.jshell
Compiling 19 properties into resource bundles for jdk.compiler
Creating hotspot/variant-server/tools/adlc/adlc from 13 file(s)
Compiling 2 files for BUILD_JVMTI_TOOLS
Compiling 2 files for BUILD_JVMTI_TOOLS
Compiling 1 files for BUILD_JFR_TOOLS
Compiling 1 files for BUILD_JFR_TOOLS
Compiling 117 files for BUILD_java.compiler.interim
Compiling 396 files for BUILD_jdk.compiler.interim
Creating support/modules_libs/java.base/client/libjvm.dylib from 810 file(s)
Creating hotspot/variant-client/libjvm/gtest/libjvm.dylib from 103 file(s)
Creating hotspot/variant-client/libjvm/gtest/gtestLauncher from 1 file(s)
Creating support/modules_libs/java.base/server/libjvm.dylib from 921 file(s)
Creating hotspot/variant-server/libjvm/gtest/libjvm.dylib from 104 file(s)
Creating hotspot/variant-server/libjvm/gtest/gtestLauncher from 1 file(s)
Compiling 304 files for BUILD_jdk.javadoc.interim
Compiling 162 files for BUILD_TOOLS_JDK
Compiling 3 files for BUILD_VM_COMPILER_MATCH_PROCESSOR
Compiling 5 files for BUILD_VM_COMPILER_NODEINFO_PROCESSOR
Compiling 2 files for COMPILE_DEPEND
Compiling 188 files for BUILD_jdk.rmic.interim
Compiling 3 files for BUILD_VM_COMPILER_OPTIONS_PROCESSOR
Compiling 14 files for BUILD_VM_COMPILER_REPLACEMENTS_PROCESSOR
Compiling 3 files for BUILD_VM_COMPILER_SERVICEPROVIDER_PROCESSOR
?: ???????????????? API?
?: ??????, ??? -Xlint:deprecation ?????
?: ?????????????????????
?: ??????, ??? -Xlint:unchecked ?????
Creating buildtools/jdk.vm.compiler.match.processor.jar
?: ???????????????? API?
?: ??????, ??? -Xlint:deprecation ?????
Creating buildtools/jdk.vm.compiler.nodeinfo.processor.jar
Creating buildtools/jdk.vm.compiler.options.processor.jar
Creating buildtools/jdk.vm.compiler.replacements.verifier.jar
Compiling 2 files for BUILD_BREAKITERATOR_BASE
Compiling 2 files for BUILD_BREAKITERATOR_LD
Creating buildtools/jdk.vm.compiler.serviceprovider.processor.jar
Compiling 11 properties into resource bundles for java.logging
Compiling 11 properties into resource bundles for java.base
Compiling 6 properties into resource bundles for java.base
Compiling 11 properties into resource bundles for jdk.jartool
Compiling 11 properties into resource bundles for jdk.management.agent
Compiling 4 properties into resource bundles for jdk.jlink
Compiling 3 properties into resource bundles for jdk.jdi
Compiling 3 properties into resource bundles for jdk.jlink
Compiling 1 properties into resource bundles for jdk.jlink
Compiling 224 properties into resource bundles for jdk.localedata
Compiling 90 properties into resource bundles for java.desktop
Compiling 3002 files for java.base
Compiling 117 files for java.compiler
Compiling 18 files for java.datatransfer
Compiling 10 files for java.instrument
Compiling 35 files for java.logging
Compiling 330 files for java.management
Compiling 140 files for java.net.http
Compiling 15 files for java.scripting
no symbols
no symbols
no symbols
Compiling 5 files for java.transaction.xa
Compiling 22 files for java.smartcardio
Compiling 193 files for jdk.internal.vm.ci
Compiling 9 files for jdk.unsupported
no symbols
Compiling 60 files for jdk.internal.jvmstat
Compiling 146 files for jdk.charsets
Compiling 1831 files for java.xml
no symbols
no symbols
Compiling 400 files for jdk.compiler
Compiling 22 files for jdk.crypto.ec
Compiling 68 files for jdk.dynalink
Compiling 3 files for jdk.internal.ed
Compiling 44 files for jdk.httpserver
Compiling 51 files for jdk.internal.opt
Compiling 33 files for jdk.jartool
Compiling 1 files for jdk.jdwp.agent
Compiling 175 files for jdk.jfr
Compiling 1703 files for jdk.localedata
Compiling 9 files for jdk.net
Compiling 97 files for jdk.internal.le
Compiling 1 files for jdk.pack
Compiling 25 files for jdk.sctp
Compiling 94 files for jdk.xml.dom
Compiling 15 files for jdk.zipfs
Compiling 18 files for java.prefs
Compiling 30 files for java.security.sasl
Compiling 129 files for java.rmi
Compiling 77 files for java.sql
Compiling 24 files for jdk.management
Compiling 15 files for jdk.attach
Compiling 275 files for java.xml.crypto
Compiling 70 files for jdk.crypto.cryptoki
Compiling 593 files for jdk.scripting.nashorn
Compiling 38 files for jdk.jcmd
Compiling 133 files for jdk.jdeps
Compiling 138 files for BUILD_NASGEN
Compiling 251 files for jdk.jdi
Compiling 11 files for jdk.jstatd
Compiling 14 files for jdk.management.jfr
?: ?????????????????????? API?
?: ??????, ??? -Xlint:removal ?????
Running nasgen
Compiling 197 files for java.naming
Warning: generation and use of skeletons and static stubs for JRMP
is deprecated. Skeletons are unnecessary, and static stubs have
been superseded by dynamically generated stubs. Users are
encouraged to migrate away from using rmic to generate skeletons and static
stubs. See the documentation for java.rmi.server.UnicastRemoteObject.
Compiling 75 files for jdk.jlink
Compiling 16 files for jdk.naming.dns
Compiling 7 files for jdk.naming.rmi
Compiling 11 files for jdk.scripting.nashorn.shell
Compiling 305 files for jdk.javadoc
?: ?????????????????????? API?
?: ??????, ??? -Xlint:removal ?????
Compiling 94 files for jdk.jshell
Compiling 14 files for java.management.rmi
Compiling 217 files for java.security.jgss
Compiling 56 files for java.sql.rowset
Compiling 31 files for jdk.management.agent
Warning: generation and use of skeletons and static stubs for JRMP
is deprecated. Skeletons are unnecessary, and static stubs have
been superseded by dynamically generated stubs. Users are
encouraged to migrate away from using rmic to generate skeletons and static
stubs. See the documentation for java.rmi.server.UnicastRemoteObject.
Compiling 188 files for jdk.rmic
Compiling 30 files for jdk.security.auth
Compiling 16 files for jdk.security.jgss
?: ???????????????? API?
?: ??????, ??? -Xlint:deprecation ?????
Warning: generation and use of skeletons and static stubs for JRMP
is deprecated. Skeletons are unnecessary, and static stubs have
been superseded by dynamically generated stubs. Users are
encouraged to migrate away from using rmic to generate skeletons and static
stubs. See the documentation for java.rmi.server.UnicastRemoteObject.
../../test/hotspot/gtest/classfile/test_symbolTable.cpp:62:6: warning: explicitly assigning value of variable of type 'TempNewSymbol' to itself [-Wself-assign-overloaded]
s1 = s1; // self assignment
~~ ^ ~~
1 warning generated.
Compiling 1574 files for jdk.internal.vm.compiler
Compiling 108 files for jdk.aot
Compiling 67 files for COMPILE_CREATE_SYMBOLS
Compiling 5 files for jdk.internal.vm.compiler.management
Creating ct.sym classes
Creating support/symbols/ct.sym
Compiling 2735 files for java.desktop
Compiling 1 files for java.se
Compiling 18 files for jdk.accessibility
Compiling 3 files for jdk.editpad
Compiling 5 files for jdk.jsobject
Compiling 8 files for jdk.unsupported.desktop
Compiling 64 files for jdk.jconsole
Compiling 1000 files for jdk.hotspot.agent
?: ???????????????? API?
?: ??????, ??? -Xlint:deprecation ?????
?: ?????????????????????
?: ??????, ??? -Xlint:unchecked ?????
no symbols
no symbols
no symbols
no symbols
no symbols
no symbols
no symbols
no symbols
no symbols
no symbols
no symbols
no symbols
no symbols
no symbols
no symbols
no symbols
no symbols
no symbols
no symbols
no symbols
no symbols
no symbols
no symbols
no symbols
no symbols
no symbols
no symbols
no symbols
../../test/hotspot/gtest/classfile/test_symbolTable.cpp:62:6: warning: explicitly assigning value of variable of type 'TempNewSymbol' to itself [-Wself-assign-overloaded]
s1 = s1; // self assignment
~~ ^ ~~
1 warning generated.
Creating support/modules_libs/java.base/libverify.dylib from 2 file(s)
Creating support/modules_libs/java.base/libjava.dylib from 60 file(s)
Creating support/native/java.base/libfdlibm.a from 57 file(s)
Creating support/modules_libs/java.base/libzip.dylib from 5 file(s)
Creating support/modules_libs/java.base/libjimage.dylib from 6 file(s)
Creating support/modules_libs/java.base/libjli.dylib from 8 file(s)
Creating support/modules_libs/java.base/libnet.dylib from 22 file(s)
Creating support/modules_libs/java.base/libnio.dylib from 23 file(s)
Creating support/modules_libs/java.base/libosxsecurity.dylib from 1 file(s)
Creating support/modules_libs/java.base/libjsig.dylib from 1 file(s)
Creating support/modules_libs/java.rmi/librmi.dylib from 1 file(s)
Creating support/modules_libs/java.prefs/libprefs.dylib from 1 file(s)
Creating support/modules_libs/java.management/libmanagement.dylib from 9 file(s)
Creating support/modules_libs/java.instrument/libinstrument.dylib from 12 file(s)
Creating support/modules_libs/java.desktop/libmlib_image.dylib from 50 file(s)
Creating support/modules_libs/java.desktop/libawt.dylib from 71 file(s)
Creating support/modules_libs/java.desktop/liblcms.dylib from 27 file(s)
Creating support/modules_libs/java.desktop/libjavajpeg.dylib from 46 file(s)
Creating support/modules_libs/java.desktop/libfreetype.dylib from 113 file(s)
Creating support/modules_libs/java.desktop/libfontmanager.dylib from 44 file(s)
Creating support/modules_libs/java.desktop/libawt_lwawt.dylib from 71 file(s)
Creating support/modules_libs/java.desktop/libosxapp.dylib from 5 file(s)
Creating support/modules_libs/java.desktop/libjawt.dylib from 1 file(s)
Creating support/modules_libs/java.desktop/libsplashscreen.dylib from 66 file(s)
Creating support/modules_libs/java.desktop/libosxui.dylib from 7 file(s)
Creating support/modules_libs/java.desktop/libjsound.dylib from 17 file(s)
Creating support/modules_libs/java.desktop/libosx.dylib from 1 file(s)
Creating support/modules_cmds/java.scripting/jrunscript from 1 file(s)
Creating support/native/java.base/java_objs/java from 1 file(s)
Creating support/modules_libs/java.security.jgss/libj2gss.dylib from 3 file(s)
Creating support/modules_libs/java.security.jgss/libosxkrb5.dylib from 2 file(s)
Creating support/modules_cmds/java.rmi/rmid from 1 file(s)
Creating support/modules_cmds/java.base/keytool from 1 file(s)
Creating support/modules_libs/java.base/jspawnhelper from 1 file(s)
Creating support/modules_cmds/java.rmi/rmiregistry from 1 file(s)
Creating support/modules_libs/java.smartcardio/libj2pcsc.dylib from 2 file(s)
Creating support/modules_cmds/jdk.aot/jaotc from 1 file(s)
Creating support/modules_libs/jdk.attach/libattach.dylib from 1 file(s)
Creating support/modules_libs/jdk.crypto.cryptoki/libj2pkcs11.dylib from 14 file(s)
Creating support/modules_cmds/jdk.compiler/javac from 1 file(s)
Creating support/modules_libs/jdk.crypto.ec/libsunec.dylib from 28 file(s)
Creating support/modules_cmds/jdk.compiler/serialver from 1 file(s)
Creating support/modules_libs/jdk.hotspot.agent/libsaproc.dylib from 7 file(s)
Creating support/modules_cmds/jdk.hotspot.agent/jhsdb from 1 file(s)
Creating support/modules_cmds/jdk.javadoc/javadoc from 1 file(s)
Creating support/modules_cmds/jdk.jartool/jar from 1 file(s)
Creating support/modules_cmds/jdk.jartool/jarsigner from 1 file(s)
Creating support/modules_cmds/jdk.jconsole/jconsole from 1 file(s)
Creating support/modules_cmds/jdk.jdeps/javap from 1 file(s)
Creating support/modules_cmds/jdk.jdeps/jdeps from 1 file(s)
Creating support/modules_cmds/jdk.jdeps/jdeprscan from 1 file(s)
Creating support/modules_cmds/jdk.jdi/jdb from 1 file(s)
Creating support/modules_libs/jdk.jdwp.agent/libdt_socket.dylib from 2 file(s)
Creating support/modules_libs/jdk.jdwp.agent/libjdwp.dylib from 42 file(s)
Creating support/modules_cmds/jdk.jfr/jfr from 1 file(s)
Creating support/modules_cmds/jdk.jcmd/jinfo from 1 file(s)
Creating support/modules_cmds/jdk.jcmd/jmap from 1 file(s)
Creating support/modules_cmds/jdk.jcmd/jps from 1 file(s)
Creating support/modules_cmds/jdk.jcmd/jstack from 1 file(s)
Creating support/modules_cmds/jdk.jcmd/jstat from 1 file(s)
Creating support/modules_cmds/jdk.jcmd/jcmd from 1 file(s)
Creating support/modules_cmds/jdk.jlink/jimage from 1 file(s)
Creating support/modules_cmds/jdk.jlink/jlink from 1 file(s)
Creating support/modules_cmds/jdk.jlink/jmod from 1 file(s)
Creating support/modules_cmds/jdk.jshell/jshell from 1 file(s)
Creating support/modules_libs/jdk.management/libmanagement_ext.dylib from 8 file(s)
Creating support/modules_cmds/jdk.jstatd/jstatd from 1 file(s)
Creating support/modules_libs/jdk.management.agent/libmanagement_agent.dylib from 1 file(s)
Creating support/modules_libs/jdk.net/libextnet.dylib from 1 file(s)
Creating support/modules_libs/jdk.pack/libunpack.dylib from 7 file(s)
Creating support/modules_cmds/jdk.rmic/rmic from 1 file(s)
Creating support/modules_cmds/jdk.scripting.nashorn.shell/jjs from 1 file(s)
Creating support/modules_cmds/jdk.pack/pack200 from 1 file(s)
Creating support/modules_cmds/jdk.pack/unpack200 from 7 file(s)
Creating support/modules_libs/jdk.security.auth/libjaas.dylib from 1 file(s)
Compiling 4 files for BUILD_JIGSAW_TOOLS
Stopping sjavac server
Finished building target 'default (exploded-image)' in configuration 'macosx-x86_64-serverANDclient-slowdebug'
至此,JDK 编译成功!
➜ bin pwd
/Users/dongguabai/Desktop/temp/openjdk12/openjdk/build/macosx-x86_64-serverANDclient-slowdebug/jdk/bin
➜ bin ./java -version
openjdk version "12-internal" 2019-03-19
OpenJDK Runtime Environment (slowdebug build 12-internal+0-adhoc.root.openjdk)
OpenJDK 64-Bit Server VM (slowdebug build 12-internal+0-adhoc.root.openjdk, mixed mode)
在自己编译的 JDK 上运行 HelloWorld
在 IDEA 上配置 JDK:
可以看到我们自己编译的 JDK 可以成功的使用了。
References
- https://zhuanlan.zhihu.com/p/54134602
- https://blog.csdn.net/asahinokawa/article/details/82226093
欢迎关注公众号
更多推荐
所有评论(0)