Ubuntu18 编译OpenJDK12 JVM

目录

Ubuntu18 编译OpenJDK12 JVM

环境

Ubuntu18.04

VM15.1.0

步骤

  • 安装依赖

    不同的版本OS上面可能需要安装不同的依赖,这个要根据自己OS来一个个安装。

sudo apt-get install -y zip libfreetype6-dev libcups2-dev libx11-dev libxext-dev libxrender-dev libxrandr-dev libxtst-dev libxt-dev libffi-dev libasound2-dev autoconf
  • 安装JDK11
  sudo apt-get install openjdk-11-jdk
  • 下载openjdk12 的源码

链接:https://pan.baidu.com/s/1hZkiRiBvBDzl6IBdumMRjw

提取码:m1uj

  • 把下载的源码放进机器的路径下,路径自己选

  • 在源码路径下

    core 和memory size 可以根据机器的配置调节,配置越高,编译越快

  bash configure --with-num-cores=4 --with-memory-size=8192 --disable-warnings-as-errors

Ubuntu18 编译OpenJDK12 JVM

  • Make images

    Ubuntu18 编译OpenJDK12 JVM

  • 使用生成的JDK

    sudo vim ~/.bashrc
    source ~/.bashrc
     
    export JAVA_HOME=/opt/jdk12/build/linux-x86_64-server-release/jdk
    export JRE_HOME=${JAVA_HOME}/jre
    export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
    export PATH=${JAVA_HOME}/bin:$PATH
    
    
  • 查看版本

    Ubuntu18 编译OpenJDK12 JVM

  • 试运行

Ubuntu18 编译OpenJDK12 JVM

  • build log 这个可以不用看了

    Building target 'images' in configuration 'linux-x86_64-server-release'
    Compiling 8 files for BUILD_TOOLS_LANGTOOLS
    Warning: No SCM configuration present and no .src-rev
    Creating hotspot/variant-server/tools/adlc/adlc from 13 file(s)
    Compiling 2 files for BUILD_JVMTI_TOOLS
    Compiling 1 files for BUILD_JFR_TOOLS
    Parsing 2 properties into enum-like class for jdk.compiler
    Compiling 19 properties into resource bundles for jdk.compiler
    Compiling 13 properties into resource bundles for jdk.javadoc
    Compiling 12 properties into resource bundles for jdk.jdeps
    Compiling 7 properties into resource bundles for jdk.jshell
    Compiling 117 files for BUILD_java.compiler.interim
    Compiling 396 files for BUILD_jdk.compiler.interim
    Creating support/modules_libs/java.base/server/libjvm.so from 987 file(s)
    Creating hotspot/variant-server/libjvm/gtest/libjvm.so from 114 file(s)
    Creating hotspot/variant-server/libjvm/gtest/gtestLauncher from 1 file(s)
    Compiling 304 files for BUILD_jdk.javadoc.interim
    Compiling 162 files for BUILD_TOOLS_JDK
    Compiling 2 files for COMPILE_DEPEND
    Compiling 3 files for BUILD_VM_COMPILER_MATCH_PROCESSOR
    Compiling 5 files for BUILD_VM_COMPILER_NODEINFO_PROCESSOR
    Compiling 188 files for BUILD_jdk.rmic.interim
    Compiling 3 files for BUILD_VM_COMPILER_OPTIONS_PROCESSOR
    Compiling 14 files for BUILD_VM_COMPILER_REPLACEMENTS_PROCESSOR
    Compiling 3 files for BUILD_VM_COMPILER_SERVICEPROVIDER_PROCESSOR
    Note: Some input files use or override a deprecated API.
    Note: Recompile with -Xlint:deprecation for details.
    Note: Some input files use unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
    Creating buildtools/jdk.vm.compiler.match.processor.jar
    Note: Some input files use or override a deprecated API.
    Note: Recompile with -Xlint:deprecation for details.
    Compiling 31 files for BUILD_JRTFS
    Creating buildtools/jdk.vm.compiler.nodeinfo.processor.jar
    Creating buildtools/jdk.vm.compiler.options.processor.jar
    Creating buildtools/jdk.vm.compiler.replacements.verifier.jar
    Creating support/modules_libs/java.base/jrt-fs.jar
    Creating buildtools/jdk.vm.compiler.serviceprovider.processor.jar
    Compiling 2 files for BUILD_BREAKITERATOR_BASE
    Compiling 2 files for BUILD_BREAKITERATOR_LD
    Compiling 11 properties into resource bundles for java.logging
    Compiling 11 properties into resource bundles for java.base
    Compiling 6 properties into resource bundles for java.base
    Compiling 11 properties into resource bundles for jdk.jartool
    Compiling 11 properties into resource bundles for jdk.management.agent
    Compiling 3 properties into resource bundles for jdk.jdi
    Compiling 4 properties into resource bundles for jdk.jlink
    Compiling 3 properties into resource bundles for jdk.jlink
    Compiling 1 properties into resource bundles for jdk.jlink
    Compiling 224 properties into resource bundles for jdk.localedata
    Compiling 3027 files for java.base
    Compiling 89 properties into resource bundles for java.desktop
    Compiling 117 files for java.compiler
    Compiling 18 files for java.datatransfer
    Compiling 1831 files for java.xml
    Compiling 10 files for java.instrument
    Compiling 35 files for java.logging
    Compiling 330 files for java.management
    Compiling 30 files for java.security.sasl
    Compiling 129 files for java.rmi
    Compiling 140 files for java.net.http
    Compiling 15 files for java.scripting
    Compiling 5 files for java.transaction.xa
    Compiling 275 files for java.xml.crypto
    Compiling 22 files for java.smartcardio
    Compiling 193 files for jdk.internal.vm.ci
    Compiling 24 files for jdk.management
    Compiling 9 files for jdk.unsupported
    Compiling 119 files for jdk.charsets
    Compiling 61 files for jdk.internal.jvmstat
    Compiling 400 files for jdk.compiler
    Compiling 22 files for jdk.crypto.ec
    Compiling 68 files for jdk.dynalink
    Compiling 3 files for jdk.internal.ed
    Compiling 44 files for jdk.httpserver
    Compiling 97 files for jdk.internal.le
    Compiling 51 files for jdk.internal.opt
    Compiling 33 files for jdk.jartool
    Compiling 1 files for jdk.jdwp.agent
    Compiling 175 files for jdk.jfr
    Compiling 11 files for jdk.jstatd
    Compiling 1703 files for jdk.localedata
    Compiling 9 files for jdk.net
    Compiling 1 files for jdk.pack
    Compiling 33 files for jdk.sctp
    Compiling 593 files for jdk.scripting.nashorn
    Compiling 94 files for jdk.xml.dom
    Compiling 15 files for jdk.zipfs
    Warning: generation and use of skeletons and static stubs for JRMP
    is deprecated. Skeletons are unnecessary, and static stubs have
    been superseded by dynamically generated stubs. Users are
    encouraged to migrate away from using rmic to generate skeletons and static
    stubs. See the documentation for java.rmi.server.UnicastRemoteObject.
    Compiling 15 files for java.prefs
    Compiling 197 files for java.naming
    Note: Some input files use or override a deprecated API that is marked for removal.
    Note: Recompile with -Xlint:removal for details.
    Compiling 138 files for BUILD_NASGEN
    Compiling 77 files for java.sql
    Running nasgen
    Compiling 15 files for jdk.attach
    Compiling 70 files for jdk.crypto.cryptoki
    Compiling 305 files for jdk.javadoc
    Compiling 38 files for jdk.jcmd
    Compiling 133 files for jdk.jdeps
    Compiling 251 files for jdk.jdi
    Compiling 75 files for jdk.jlink
    Compiling 94 files for jdk.jshell
    Compiling 14 files for jdk.management.jfr
    Compiling 16 files for jdk.naming.dns
    Compiling 7 files for jdk.naming.rmi
    Compiling 188 files for jdk.rmic
    Compiling 11 files for jdk.scripting.nashorn.shell
    Note: Some input files use or override a deprecated API that is marked for removal.
    Note: Recompile with -Xlint:removal for details.
    Warning: generation and use of skeletons and static stubs for JRMP
    is deprecated. Skeletons are unnecessary, and static stubs have
    been superseded by dynamically generated stubs. Users are
    encouraged to migrate away from using rmic to generate skeletons and static
    stubs. See the documentation for java.rmi.server.UnicastRemoteObject.
    Note: Some input files use or override a deprecated API.
    Note: Recompile with -Xlint:deprecation for details.
    Compiling 14 files for java.management.rmi
    Compiling 217 files for java.security.jgss
    Compiling 56 files for java.sql.rowset
    Compiling 2784 files for java.desktop
    Compiling 31 files for jdk.management.agent
    Compiling 30 files for jdk.security.auth
    Compiling 16 files for jdk.security.jgss
    Warning: generation and use of skeletons and static stubs for JRMP
    is deprecated. Skeletons are unnecessary, and static stubs have
    been superseded by dynamically generated stubs. Users are
    encouraged to migrate away from using rmic to generate skeletons and static
    stubs. See the documentation for java.rmi.server.UnicastRemoteObject.
    Compiling 1574 files for jdk.internal.vm.compiler
    Compiling 108 files for jdk.aot
    Compiling 5 files for jdk.internal.vm.compiler.management
    Compiling 67 files for COMPILE_CREATE_SYMBOLS
    Creating ct.sym classes
    Updating support/src.zip
    Compiling 1 files for java.se
    Compiling 18 files for jdk.accessibility
    Compiling 3 files for jdk.editpad
    Creating support/symbols/ct.sym
    Compiling 1000 files for jdk.hotspot.agent
    Compiling 64 files for jdk.jconsole
    Compiling 5 files for jdk.jsobject
    Compiling 8 files for jdk.unsupported.desktop
    Note: Some input files use or override a deprecated API.
    Note: Recompile with -Xlint:deprecation for details.
    Note: Some input files use unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
    Creating support/modules_libs/java.base/libverify.so from 2 file(s)
    Creating support/modules_libs/java.base/libjava.so from 58 file(s)
    Creating support/native/java.base/libfdlibm.a from 57 file(s)
    Creating support/modules_libs/java.base/libzip.so from 5 file(s)
    Creating support/modules_libs/java.base/libjimage.so from 6 file(s)
    Creating support/modules_libs/java.base/libjli.so from 8 file(s)
    Creating support/modules_libs/java.base/libnet.so from 21 file(s)
    Creating support/modules_libs/java.base/libnio.so from 22 file(s)
    Creating support/modules_libs/java.base/libjsig.so from 1 file(s)
    Creating support/modules_libs/java.instrument/libinstrument.so from 12 file(s)
    Creating support/modules_cmds/jdk.jlink/jimage from 1 file(s)
    Creating support/modules_cmds/jdk.jlink/jlink from 1 file(s)
    Creating support/modules_cmds/jdk.jlink/jmod from 1 file(s)
    Creating support/native/java.base/java_objs/java from 1 file(s)
    Creating support/modules_cmds/java.base/keytool from 1 file(s)
    Creating support/modules_libs/java.base/jexec from 1 file(s)
    Creating support/modules_libs/java.base/jspawnhelper from 1 file(s)
    Creating support/modules_libs/java.desktop/libmlib_image.so from 50 file(s)
    Creating support/modules_libs/java.desktop/libawt.so from 73 file(s)
    Creating support/modules_libs/java.desktop/libawt_xawt.so from 52 file(s)
    Creating support/modules_libs/java.desktop/liblcms.so from 27 file(s)
    Creating support/modules_libs/java.desktop/libjavajpeg.so from 46 file(s)
    Creating support/modules_libs/java.desktop/libawt_headless.so from 26 file(s)
    Creating support/modules_libs/java.desktop/libfontmanager.so from 45 file(s)
    Creating support/modules_libs/java.desktop/libjawt.so from 1 file(s)
    Creating support/modules_libs/java.desktop/libsplashscreen.so from 67 file(s)
    Creating support/modules_libs/java.desktop/libjsound.so from 18 file(s)
    Creating support/modules_libs/java.management/libmanagement.so from 9 file(s)
    Creating support/modules_libs/java.prefs/libprefs.so from 1 file(s)
    Creating support/modules_libs/java.rmi/librmi.so from 1 file(s)
    Creating support/modules_cmds/java.rmi/rmid from 1 file(s)
    Creating support/modules_cmds/java.rmi/rmiregistry from 1 file(s)
    Creating support/modules_cmds/java.scripting/jrunscript from 1 file(s)
    Creating support/modules_libs/java.security.jgss/libj2gss.so from 3 file(s)
    Creating support/modules_libs/java.smartcardio/libj2pcsc.so from 2 file(s)
    Creating support/modules_cmds/jdk.aot/jaotc from 1 file(s)
    Creating support/modules_libs/jdk.attach/libattach.so from 1 file(s)
    Creating support/modules_cmds/jdk.compiler/javac from 1 file(s)
    Creating support/modules_cmds/jdk.compiler/serialver from 1 file(s)
    Creating support/modules_libs/jdk.crypto.cryptoki/libj2pkcs11.so from 14 file(s)
    Creating support/modules_libs/jdk.crypto.ec/libsunec.so from 28 file(s)
    Creating support/modules_libs/jdk.hotspot.agent/libsaproc.so from 7 file(s)
    Creating support/modules_cmds/jdk.hotspot.agent/jhsdb from 1 file(s)
    Creating support/modules_cmds/jdk.jartool/jar from 1 file(s)
    Creating support/modules_cmds/jdk.jartool/jarsigner from 1 file(s)
    Creating support/modules_cmds/jdk.javadoc/javadoc from 1 file(s)
    Creating support/modules_cmds/jdk.jcmd/jinfo from 1 file(s)
    Creating support/modules_cmds/jdk.jcmd/jmap from 1 file(s)
    Creating support/modules_cmds/jdk.jcmd/jps from 1 file(s)
    Creating support/modules_cmds/jdk.jcmd/jstack from 1 file(s)
    Creating support/modules_cmds/jdk.jcmd/jstat from 1 file(s)
    Creating support/modules_cmds/jdk.jcmd/jcmd from 1 file(s)
    Creating support/modules_cmds/jdk.jconsole/jconsole from 1 file(s)
    Creating support/modules_cmds/jdk.jdeps/javap from 1 file(s)
    Creating support/modules_cmds/jdk.jdeps/jdeps from 1 file(s)
    Creating support/modules_cmds/jdk.jdeps/jdeprscan from 1 file(s)
    Creating support/modules_cmds/jdk.jdi/jdb from 1 file(s)
    Creating support/modules_libs/jdk.jdwp.agent/libdt_socket.so from 2 file(s)
    Creating support/modules_libs/jdk.jdwp.agent/libjdwp.so from 42 file(s)
    Creating support/modules_cmds/jdk.jfr/jfr from 1 file(s)
    Creating support/modules_cmds/jdk.jshell/jshell from 1 file(s)
    Creating support/modules_cmds/jdk.jstatd/jstatd from 1 file(s)
    Creating support/modules_libs/jdk.management/libmanagement_ext.so from 8 file(s)
    Creating support/modules_libs/jdk.management.agent/libmanagement_agent.so from 1 file(s)
    Creating support/modules_libs/jdk.net/libextnet.so from 1 file(s)
    Creating support/modules_libs/jdk.pack/libunpack.so from 7 file(s)
    Creating support/modules_cmds/jdk.pack/pack200 from 1 file(s)
    Creating support/modules_cmds/jdk.pack/unpack200 from 7 file(s)
    Creating support/modules_cmds/jdk.rmic/rmic from 1 file(s)
    Creating support/modules_cmds/jdk.scripting.nashorn.shell/jjs from 1 file(s)
    Creating support/modules_libs/jdk.sctp/libsctp.so from 3 file(s)
    Creating support/modules_libs/jdk.security.auth/libjaas.so from 1 file(s)
    Updating images/sec-bin.zip
    Compiling 4 files for BUILD_JIGSAW_TOOLS
    Creating support/interim-jmods/java.logging.jmod
    Creating images/jmods/java.compiler.jmod
    Creating images/jmods/java.datatransfer.jmod
    Creating support/interim-jmods/java.base.jmod
    Creating images/jmods/java.instrument.jmod
    Creating images/jmods/java.desktop.jmod
    Creating images/jmods/java.logging.jmod
    Creating images/jmods/java.management.jmod
    Creating images/jmods/java.management.rmi.jmod
    Creating images/jmods/java.naming.jmod
    Creating images/jmods/java.net.http.jmod
    Creating images/jmods/java.prefs.jmod
    Creating images/jmods/java.rmi.jmod
    Creating images/jmods/java.scripting.jmod
    Creating images/jmods/java.se.jmod
    Creating images/jmods/java.security.jgss.jmod
    Creating images/jmods/java.security.sasl.jmod
    Creating images/jmods/java.smartcardio.jmod
    Creating images/jmods/java.sql.jmod
    Creating images/jmods/java.sql.rowset.jmod
    Creating images/jmods/java.transaction.xa.jmod
    Creating images/jmods/java.xml.jmod
    Creating images/jmods/java.xml.crypto.jmod
    Creating images/jmods/jdk.accessibility.jmod
    Creating images/jmods/jdk.aot.jmod
    Creating images/jmods/jdk.attach.jmod
    Creating images/jmods/jdk.charsets.jmod
    Creating images/jmods/jdk.compiler.jmod
    Creating images/jmods/jdk.crypto.cryptoki.jmod
    Creating images/jmods/jdk.crypto.ec.jmod
    Creating images/jmods/jdk.dynalink.jmod
    Creating images/jmods/jdk.editpad.jmod
    Creating images/jmods/jdk.hotspot.agent.jmod
    Creating images/jmods/jdk.httpserver.jmod
    Creating images/jmods/jdk.internal.ed.jmod
    Creating images/jmods/jdk.internal.jvmstat.jmod
    Creating images/jmods/jdk.internal.le.jmod
    Creating images/jmods/jdk.internal.opt.jmod
    Creating images/jmods/jdk.internal.vm.ci.jmod
    Creating images/jmods/jdk.internal.vm.compiler.jmod
    Creating images/jmods/jdk.internal.vm.compiler.management.jmod
    Creating images/jmods/jdk.jartool.jmod
    Creating images/jmods/jdk.javadoc.jmod
    Creating images/jmods/jdk.jcmd.jmod
    Creating images/jmods/jdk.jconsole.jmod
    Creating images/jmods/jdk.jdeps.jmod
    Creating images/jmods/jdk.jdi.jmod
    Creating images/jmods/jdk.jdwp.agent.jmod
    Creating images/jmods/jdk.jfr.jmod
    Creating images/jmods/jdk.jshell.jmod
    Creating images/jmods/jdk.jsobject.jmod
    Creating images/jmods/jdk.jstatd.jmod
    Creating images/jmods/jdk.localedata.jmod
    Creating images/jmods/jdk.management.jmod
    Creating images/jmods/jdk.management.agent.jmod
    Creating images/jmods/jdk.management.jfr.jmod
    Creating images/jmods/jdk.naming.dns.jmod
    Creating images/jmods/jdk.naming.rmi.jmod
    Creating images/jmods/jdk.net.jmod
    Creating images/jmods/jdk.pack.jmod
    Creating images/jmods/jdk.rmic.jmod
    Creating images/jmods/jdk.scripting.nashorn.jmod
    Creating images/jmods/jdk.scripting.nashorn.shell.jmod
    Creating images/jmods/jdk.sctp.jmod
    Creating images/jmods/jdk.security.auth.jmod
    Creating images/jmods/jdk.security.jgss.jmod
    Creating images/jmods/jdk.unsupported.jmod
    Creating images/jmods/jdk.unsupported.desktop.jmod
    Creating images/jmods/jdk.xml.dom.jmod
    Creating images/jmods/jdk.zipfs.jmod
    Creating interim jimage
    Compiling 3 files for BUILD_DEMO_CodePointIM
    Updating support/demos/image/jfc/CodePointIM/src.zip
    Compiling 3 files for BUILD_DEMO_FileChooserDemo
    Updating support/demos/image/jfc/FileChooserDemo/src.zip
    Note: /opt/jdk12/src/demo/share/jfc/FileChooserDemo/FileChooserDemo.java uses or overrides a deprecated API.
    Note: Recompile with -Xlint:deprecation for details.
    Note: /opt/jdk12/src/demo/share/jfc/FileChooserDemo/FileChooserDemo.java uses unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
    Compiling 30 files for BUILD_DEMO_SwingSet2
    Updating support/demos/image/jfc/SwingSet2/src.zip
    Compiling 4 files for BUILD_DEMO_Font2DTest
    Updating support/demos/image/jfc/Font2DTest/src.zip
    Compiling 1 files for CLASSLIST_JAR
    Creating support/classlist.jar
    Note: Some input files use or override a deprecated API.
    Note: Recompile with -Xlint:deprecation for details.
    Note: Some input files use unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
    Compiling 64 files for BUILD_DEMO_J2Ddemo
    Updating support/demos/image/jfc/J2Ddemo/src.zip
    Compiling 15 files for BUILD_DEMO_Metalworks
    Updating support/demos/image/jfc/Metalworks/src.zip
    Note: Some input files use or override a deprecated API.
    Note: Recompile with -Xlint:deprecation for details.
    Note: Some input files use unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
    Creating images/jmods/jdk.jlink.jmod
    Compiling 2 files for BUILD_DEMO_Notepad
    Note: /opt/jdk12/src/demo/share/jfc/Metalworks/MetalworksPrefs.java uses unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
    Updating support/demos/image/jfc/Notepad/src.zip
    Note: Some input files use or override a deprecated API.
    Note: Recompile with -Xlint:deprecation for details.
    Compiling 5 files for BUILD_DEMO_Stylepad
    Note: Some input files use unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
    Updating support/demos/image/jfc/Stylepad/src.zip
    Compiling 5 files for BUILD_DEMO_SampleTree
    Updating support/demos/image/jfc/SampleTree/src.zip
    Creating images/jmods/java.base.jmod
    Compiling 8 files for BUILD_DEMO_TableExample
    Updating support/demos/image/jfc/TableExample/src.zip
    Note: /opt/jdk12/src/demo/share/jfc/Stylepad/Stylepad.java uses unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
    Compiling 1 files for BUILD_DEMO_TransparentRuler
    Updating support/demos/image/jfc/TransparentRuler/src.zip
    Note: Some input files use or override a deprecated API.
    Note: Recompile with -Xlint:deprecation for details.
    Note: /opt/jdk12/src/demo/share/jfc/TableExample/TableExample4.java uses unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
    Creating support/demos/image/jfc/CodePointIM/CodePointIM.jar
    Creating support/demos/image/jfc/FileChooserDemo/FileChooserDemo.jar
    Creating support/demos/image/jfc/SwingSet2/SwingSet2.jar
    Creating support/demos/image/jfc/Font2DTest/Font2DTest.jar
    Creating support/demos/image/jfc/J2Ddemo/J2Ddemo.jar
    Creating support/demos/image/jfc/Metalworks/Metalworks.jar
    Creating support/demos/image/jfc/Notepad/Notepad.jar
    Creating support/demos/image/jfc/SampleTree/SampleTree.jar
    Creating support/demos/image/jfc/Stylepad/Stylepad.jar
    Creating support/demos/image/jfc/TableExample/TableExample.jar
    Creating support/demos/image/jfc/TransparentRuler/TransparentRuler.jar
    Creating jdk image
    Creating CDS archive for jdk image
    ----- Build times -------
    Start 2020-06-24 12:15:45
    End   2020-06-24 12:28:50
    
    00:13:05 TOTAL
    -------------------------
    Finished building target 'images' in configuration 'linux-x86_64-server-release'
    
    
上一篇:Dutree – Linux上的命令行磁盘使用情况分析工具


下一篇:unity 常用宏定义