Compile openjdk12 on centos7

Refer to section 1.6 of "In-depth Understanding of Java Virtual Machine Third Edition" and https://github.com/AdoptOpenJDK/openjdk-jdk12u/blob/master/doc/building.md , the steps are as follows:

Get the source code of openjdk12. The address given in the book is too slow. I found a mirror on github , clicked to download, obtained the zip archive, and unzipped it.

sudo yum install java-11-openjdk*
chmod +x configure
sudo ./configure --enable-debug --with-jvm-variants=server

Note that this step may fail due to lack of dependencies. Just install it according to the prompts. After I have performed the following installations, this step succeeded:

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

Success tips I got:

====================================================
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

Then make images, it will run for a while

Verify the newly built JDK: ./build/*/images/jdk/bin/java -version

Run basic tests: make run-test-tier1

Guess you like

Origin blog.csdn.net/qq_23204557/article/details/113706651