zoukankan      html  css  js  c++  java
  • centos7编译openjdk记录

    网上很多文章关于编译jdk,尤其是openjdk8的文章,但是套路基本差不多,有需要的话可以先搜索一大筐大体了解一下!
    下面说下本人进行的操作,整体参考:https://zhoupinheng.iteye.com/blog/2428274
    以上链接仅做参考,因为是不能顺利执行下去的,至少我是!

    先说一下我的环境:
    Linux version 3.10.0-957.1.3.el7.x86_64 (mockbuild@kbuilder.bsys.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC) ) #1 SMP Thu Nov 29 14:49:43 UTC 2018

    构建编译
    根据上面链接:hg clone http://hg.openjdk.java.net/jdk10/jdk10 src 在这句的时候是下不全源码的,并且进入src目录下执行 bash ./get_source.sh可以下载源码,但是我没有下下来,一直是在报错!不出意外都是这样的!所以,为了节省时间可以直接去github上面去下载!如下地址即可:https://github.com/unofficial-openjdk/openjdk

    执行这句进行构建的时候,bash ./configure --with-target-bits=64 --disable-warnings-as-errors 报出问题:

    configure: Could not find a valid Boot JDK. You might be able to fix this by running 'sudo yum install java-1.8.0-openjdk-devel'.
    configure: This might be fixed by explicitly setting --with-boot-jdk
    configure: error: Cannot continue
    configure exiting with result code 1
    

    表示没有引导JDK,然后下载jdk-8u192-linux-x64.tar.gz ,执行bash ./configure --with-target-bits=64 --with-boot-jdk=/home/kevin/Java/jdk1.8.0_192 --disable-warnings-as-errors,结果执行继续报错 :

    configure: Found potential Boot JDK using configure arguments
    configure: Potential Boot JDK found at /home/kevin/Java/jdk1.8.0_192 is incorrect JDK version (java version "1.8.0_192"); ignoring
    configure: (Your Boot JDK version must be one of: 11 12 13)
    configure: error: The path given by --with-boot-jdk does not contain a valid Boot JDK
    configure exiting with result code 1
    

    好麻,先下载个JDK11再说!https://www.oracle.com/technetwork/java/javase/downloads/jdk11-downloads-5066655.html
    继续替换引导JDK的路径和版本:bash ./configure --with-target-bits=64 --with-boot-jdk=/home/kevin/Java/jdk-11.0.1 --disable-warnings-as-errors
    继续报错:

    configure: error: Could not find all X11 headers (shape.h Xrender.h Xrander.h XTest.h Intrinsic.h). You might be able to fix this by running 'sudo yum install libXtst-devel libXt-devel libXrender-devel libXrandr-devel libXi-devel'.
    configure exiting with result code 1
    

    这些只是需要根据提示进行升级之类的就可以了,最后执行成功如下:

    ====================================================
    A new configuration has been successfully created in
    /opt/openjdk10/openjdk/build/linux-x86_64-server-release
    using configure arguments '--with-target-bits=64 --with-boot-jdk=/home/kevin/Java/jdk-11.0.1 --disable-warnings-as-errors'.
    
    Configuration summary:
    * Debug level:    release
    * HS debug level: product
    * JVM variants:   server
    * JVM features:   server: 'aot cds cmsgc compiler1 compiler2 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: 13-internal+0-adhoc.kevin.openjdk (13-internal)
    
    Tools summary:
    * Boot JDK:       java version "11.0.1" 2018-10-16 LTS Java(TM) SE Runtime Environment 18.9 (build 11.0.1+13-LTS) Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.1+13-LTS, mixed mode)  (at /home/kevin/Java/jdk-11.0.1)
    * Toolchain:      gcc (GNU Compiler Collection)
    * C Compiler:     Version 4.8.5 (at /usr/bin/gcc)
    * C++ Compiler:   Version 4.8.5 (at /usr/bin/g++)
    
    Build performance summary:
    * Cores to use:   1
    * Memory limit:   2827 MB
    

    最后执行make all,最后进入漫长的编译等待。当出现如下所示,表示成功:

    Finished building target 'all' in configuration 'linux-x86_64-server-release'
    

    使用Clion调试Hotspot
    感谢该问作者,写得相当不错!尤其是目前这方面的资料还是挺少的,https://www.jianshu.com/p/ee7e9176632c

  • 相关阅读:
    IOS:接口返回包含转义字符去掉转义字符
    properties和yml进行对比
    IDEA安装插件时搜索不到,一直在转圈刷新,无法安装
    VMware 15 虚拟机黑屏问题
    扩容根分区
    CentOS 6 各种启动文件损坏及修复
    RabbitMQ面试题
    FTP,SFTP服务器登录权限和根目录的设置
    Tee命令的几个使用实例
    ssh-copy-id 后无法免密登录
  • 原文地址:https://www.cnblogs.com/Kevin-1992/p/12608354.html
Copyright © 2011-2022 走看看