java:openjdk 10 编译

记录一下openjdk10的编译

1.首先去下载JDK10源码

hg clone http://hg.openjdk.java.net/jdk10/jdk10
下载失败的话,可以下载这个
https://github.com/hzio/OpenJDK10

2.下载后的目录

wenfeng@ubuntu:~/work/OpenJDK10$ ls
ASSEMBLY_EXCEPTION  configure  make      src
bin                 doc        Makefile  test
build               LICENSE    README

4.执行cofigure脚本

bash configure --with-debug-level=slowdebug --enable-dtrace --with-jvm-variants=server --with-target-bits=64 --enable-ccache --with-num-cores=8 --with-memory-size=8000  --disable-warnings-as-errors --with-boot-jdk=/opt/jdk1.8.0_181/

bash configure --with-debug-level=slowdebug --enable-dtrace --with-jvm-variants=server --with-target-bits=64  --with-memory-size=3000  --disable-warnings-as-errors --enable-native-debug-symbols=internal

这个过程会检测电脑的环境是否完整,缺少什么安装什么即可
我的电脑需要安装

sudo apt-get install systemtap-sdt-dev libx11-dev libxext-dev libxrender-dev libxtst-dev libxt-dev libcups2-dev
libfreetype6-dev libasound2-dev

如果缺少gcc,可以执行sudo apt-get install build-essential
缺少make,可以执行sudo apt-get install make

4.configure成功

Configuration summary:
* Debug level:    slowdebug
* HS debug level: debug
* JDK variant:    normal
* JVM variants:   server
* OpenJDK target: OS: linux, CPU architecture: x86, address length: 64
* Version string: 10-internal+0-adhoc.wenfeng.OpenJDK10 (10-internal)

Tools summary:
* Boot JDK:       openjdk version "1.8.0_181" OpenJDK Runtime Environment (build 1.8.0_181-8u181-b13-0ubuntu0.18.04.1-b13) OpenJDK 64-Bit Server VM (build 25.181-b13, mixed mode)  (at /usr/lib/jvm/java-8-openjdk-amd64)
* Toolchain:      gcc (GNU Compiler Collection)
* C Compiler:     Version 7.3.0 (at /usr/bin/gcc)
* C++ Compiler:   Version 7.3.0 (at /usr/bin/g++)

Build performance summary:
* Cores to use:   1
* Memory limit:   3000 MB

5.执行make images,编译完成

Finished building target 'images' in configuration 'linux-x86_64-normal-server-slowdebug'

6.生成的目录

wenfeng@ubuntu:~/work/OpenJDK10/build$ du -h --max-depth=1
4.0G    ./linux-x86_64-normal-server-slowdebug

7.进入/linux-x86_64-normal-server-slowdebug/jdk/bin,进行gdb调试

gdb -args ./java -version
wenfeng@ubuntu:~/work/OpenJDK10/build/linux-x86_64-normal-server-slowdebug/jdk/bin$ gdb -args ./java -version
GNU gdb (Ubuntu 8.1-0ubuntu3) 8.1.0.20180409-git
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
.
Find the GDB manual and other documentation resources online at:
.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./java...done.
(gdb) b main
Breakpoint 1 at 0xc89: file /home/wenfeng/work/OpenJDK10/src/java.base/share/native/launcher/main.c, line 97.
(gdb) run
Starting program: /home/wenfeng/work/OpenJDK10/build/linux-x86_64-normal-server-slowdebug/jdk/bin/java -version
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Breakpoint 1, main (argc=2, argv=0x7fffffffdf98)
    at /home/wenfeng/work/OpenJDK10/src/java.base/share/native/launcher/main.c:97
97  {
(gdb) 

https://blog.csdn.net/ppp2006/article/details/52183472
https://www.linuxidc.com/Linux/2018-05/152248.htm

你可能感兴趣的:(java:openjdk 10 编译)