如何引导构建jdk?

pinkon5k  于 2021-06-30  发布在  Java
关注(0)|答案(1)|浏览(759)

我正试图建立 jdk-11+8 为了读取生成的 java.nio.ByteBuffer 对于linux。
我根据文档安装了所有依赖项,然后成功地运行 configure .
但是,当我跑的时候 make ,我得到了一个关于丢失java包的奇怪错误,这看起来像是一个引导问题。

git clone https://github.com/openjdk/jdk.git 
pushd jdk
bash configure
...
The existing configuration has been successfully updated in
/home/ubuntu/Code/jdk/build/linux-x86_64-normal-server-release
using default settings.

Configuration summary:

* Debug level:    release
* HS debug level: product
* JDK variant:    normal
* JVM variants:   server
* OpenJDK target: OS: linux, CPU architecture: x86, address length: 64
* Version string: 11-internal+0-adhoc.ubuntu.jdk (11-internal)

Tools summary:

* Boot JDK:       openjdk version "11.0.9.1" 2020-11-04 OpenJDK Runtime Environment (build 11.0.9.1+1-Ubuntu-0ubuntu1.18.04) OpenJDK 64-Bit Server VM (build 11.0.9.1+1-Ubuntu-0ubuntu1.18.04, mixed mode, sharing)  (at /usr/lib/jvm/java-11-openjdk-amd64)
* Toolchain:      gcc (GNU Compiler Collection)
* C Compiler:     Version 8.4.0 (at /usr/bin/gcc)
* C++ Compiler:   Version 8.4.0 (at /usr/bin/g++)

Build performance summary:

* Cores to use:   4
* Memory limit:   15854 MB

make clean
make

Building target 'default (exploded-image)' in configuration 'linux-x86_64-normal-server-release'
Warning: No mercurial configuration present and no .src-rev
Compiling 117 files for BUILD_java.compiler.interim
/home/ubuntu/Code/jdk/src/java.compiler/share/classes/javax/annotation/processing/Messager.java:28: error: package javax.annotation does not exist
import javax.annotation.*;
^
1 error
CompileInterimLangtools.gmk:86: recipe for target '/home/ubuntu/Code/jdk/build/linux-x86_64-normal-server-release/buildtools/interim_langtools_modules/java.compiler.interim/_the.BUILD_java.compiler.interim_batch' failed
make[3]:***[/home/ubuntu/Code/jdk/build/linux-x86_64-normal-server-release/buildtools/interim_langtools_modules/java.compiler.interim/_the.BUILD_java.compiler.interim_batch] Error 1
make/Main.gmk:76: recipe for target 'interim-langtools' failed
make[2]:***[interim-langtools] Error 2
make[2]:***Waiting for unfinished jobs....

我错过了什么?
更多系统详细信息:

ubuntu@box:~$ uname -a
Linux box 4.15.0-1057-aws #59-Ubuntu SMP Wed Dec 4 10:02:00 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
ubuntu@box:~$ cat /etc/issue
Ubuntu 18.04.4 LTS \n \l

再深入一点,我还发现了以下错误,可能相关,也可能无关:

ubuntu@ip-172-31-40-153:~/Code/jdk$ make -n gensrc > /tmp/X
make[3]:***No rule to make target '/home/ubuntu/Code/jdk/build/linux-x86_64-normal-server-release/buildtools/jdk_tools_classes/_the.BUILD_TOOLS_JDK_batch', needed by '/home/ubuntu/Code/jdk/build/linux-x86_64-normal-server-release/support/gensrc/java.logging/_the.COMPILE_PROPERTIES.marker'.  Stop.
make[2]:***[java.logging-gensrc-src] Error 2
make[2]:***Waiting for unfinished jobs....
make[3]:***No rule to make target '/home/ubuntu/Code/jdk/build/linux-x86_64-normal-server-release/buildtools/jdk_tools_classes/_the.BUILD_TOOLS_JDK_batch', needed by '/home/ubuntu/Code/jdk/build/linux-x86_64-normal-server-release/support/gensrc/jdk.charsets/sun/nio/cs/ext/_the.charsetmapping-extcs'.  Stop.
make[2]:***[jdk.charsets-gensrc-src] Error 2
make[3]:***No rule to make target '/home/ubuntu/Code/jdk/build/linux-x86_64-normal-server-release/buildtools/jdk_tools_classes/_the.BUILD_TOOLS_JDK_batch', needed by '/home/ubuntu/Code/jdk/build/linux-x86_64-normal-server-release/support/gensrc/java.base/sun/util/cldr/CLDRBaseLocaleDataMetaInfo.java'.  Stop.
make[2]:***[java.base-gensrc-src] Error 2
vmake[1]:***[main] Error 2
make:***[gensrc] Error 2
pexxcrt2

pexxcrt21#

结果发现,我使用JDK11作为引导jdk,但由于 javax.annotations 包已从jdk 11中删除。
手动降级到jdk 10并指向 configure 最后,我解决了这个问题。

wget https://download.java.net/java/GA/jdk10/10.0.2/19aef61b38124481863b1413dce1855f/13/openjdk-10.0.2_linux-x64_bin.tar.gz
tar xf openjdk-10.0.2_linux-x64_bin.tar.gz

bash configure --with-boot-jdk=/home/ubuntu/Code/jdk10/jdk-10.0.2
make

jdk 10 我不得不从档案中提取链接。

相关问题