在centos7上編譯openjdk12
阿新 • • 發佈:2021-02-07
技術標籤:jvm
參照《深入理解Java虛擬機器第三版》1.6節與https://github.com/AdoptOpenJDK/openjdk-jdk12u/blob/master/doc/building.md,步驟如下:
獲取openjdk12的原始碼,書中給出的地址實在是太慢了,我在github上找了個映象,點選下載,獲得zip壓縮包,解壓縮。
sudo yum install java-11-openjdk*
chmod +x configure
sudo ./configure --enable-debug --with-jvm-variants=server
注意此步可能因缺少依賴而報失敗,根據提示安裝即可,我先後進行下列安裝後此步成功了:
sudo yum install autoconf
sudo yum install libXtst-devel libXt-devel libXrender-devel libXrandr-devel libXi-devel
sudo yum install cups-devel
sudo yum install alsa-lib-devel
我得到的成功提示:
====================================================
A new configuration has been successfully created in
/root/openjdk12/ build/linux-x86_64-server-fastdebug
using configure arguments '--enable-debug --with-jvm-variants=server'.
Configuration summary:
* Debug level: fastdebug
* HS debug level: fastdebug
* JVM variants: server
* 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 zgc'
* OpenJDK target: OS: linux, CPU architecture: x86, address length: 64
* Version string: 12.0.2-internal+0-adhoc.root.openjdk12 (12.0.2-internal)
Tools summary:
* Boot JDK: openjdk version "11.0.10" 2021-01-19 LTS OpenJDK Runtime Environment 18.9 (build 11.0.10+9-LTS) OpenJDK 64-Bit Server VM 18.9 (build 11.0.10+9-LTS, mixed mode, sharing) (at /usr/lib/jvm/java-11-openjdk-11.0.10.0.9-0.el7_9.x86_64)
* Toolchain: gcc (GNU Compiler Collection)
* C Compiler: Version 4.8.5 (at /bin/gcc)
* C++ Compiler: Version 4.8.5 (at /bin/g++)
Build performance summary:
* Cores to use: 1
* Memory limit: 1819 MB
然後make images
,要執行一段時間
Verify the newly built JDK: ./build/*/images/jdk/bin/java -version
Run basic tests: make run-test-tier1