OpenJDK8源码编译-废弃

1. 目标

编译OpenJDK源码,并能用GDB打断点调试,最好能在CLion中调试

参考:http://hg.openjdk.java.net/jdk8/jdk8/raw-file/tip/README-builds.html 官方README

编译目标JDK版本: OpenJDK8

2. 源码下载

# 这一步只下载了一个骨架,hg有个森林的概念,相当于下了一个森林的目录
hg clone http://hg.openjdk.java.net/jdk8/jdk8 YourOpenJDK 
cd YourOpenJDK 
bash ./get_source.sh

# 这一步才是真正下载组成整个森林的各个树仓库
cd YourOpenJDK 
bash ./make/scripts/hgforest.sh status

不出意外,在执行bash ./get_source.sh时你会遇到这个问题:

⋊> ~/s/openjdk8-source-code bash get_source.sh                                                                                                                                                    17:25:39
# Repositories:  jdk

                  jdk:   hg clone http://hg.openjdk.java.net/jdk8/jdk8/jdk jdk
                  jdk:   requesting all changes
                  jdk:   adding changesets
                  jdk:   adding manifests
                  jdk:   adding file changes
                  jdk:   transaction abort!
                  jdk:   rollback completed
                  jdk:   abort: stream ended unexpectedly (got 638305 bytes, expected 689947)
WARNING: /tmp/forest.23994/jdk.pid.rc exited abnormally.

我也不知是hg这个软件设计有问题还是openjdk的仓库服务器太差,总之在clone过程中多次遇到stream ended unexpectedly的问题,并且需要从头开始!

不过在我N次重试下最终还是clone下来了,点击下载[from 百度网盘] (clone时间:2017-10-14)

目录结构

Repository

Contains

. (root)

通用配置及makefile逻辑

hotspot

HotSpot源码及make文件

langtools

source code for the OpenJDK javac and language tools

jdk

source code and make files for building the OpenJDK runtime libraries and misc files

jaxp

source code for the OpenJDK JAXP functionality

jaxws

source code for the OpenJDK JAX-WS functionality

corba

source code for the OpenJDK Corba functionality

nashorn

source code for the OpenJDK JavaScript implementation

3. 系统要求

构建OpenJDK需要安装一些必备软件,不同系统会有不同要求,同时还有些是所有系统都要求的,先说所有系统都要求的

  • make版本大于等于3.81,"make -version"

  • 安装一个Bootstrap JDK。Bootstrap JDK必须是之前JDK的主要发行版,比如这里我们构建JDK8,那就需要用JDK7作为Bootstrap JDK,将JDK7的bin目录加到PATH环境变量,如果configure脚本没有自动检测到该JDK,那么可以通过--with-boot-jdk来手动指定

  • 确保GNU make, Bootstrap JDK 以及编译器都配置到了PATH环境变量

然后是各个系统的特殊要求

Linux

Solaris

Windows

Mac OS X

Install all the software development packages needed including alsafreetypecups, andxrender
See specific system packages.

Install all the software development packages needed including Studio Compilersfreetypecups, and xrender
See specific system packages.

Install XCode 4.5.2 and also install the "Command line tools" found under the preferences pane "Downloads"

我们主要看看Mac OS X的:XCode必须是4.5.2并且要安装好命令行工具(我的XCode8,所以需要降级)

猜你喜欢

转载自blog.csdn.net/xiaocszn/article/details/81709073