在centos7上编译openjdk12

参照《深入理解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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

qq_23204557

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值