Loading

OPENJDK 源码编译

一、整体编译

我的环境:

Ubuntu 16.04 LTS 

apache-ant-1.8.0-bin.zip

环境变量:

export LANG=C
export ALT_BOOTDIR=/home/wangx/warehouse/jdk1.7.0_80
export ALLOW_DOWNLOADS=true
export HOTSPOT_BUILD_JOBS=6
export ALT_PARALLEL_COMPILE_JOBS=6
export SKIP_COMPARE_IMAGES=true
export USE_PRECOMPILED_HEADER=true
export BUILD_LANGTOOLS=true
#export BUILD_JAXP=false
#export BUILD_JAXWS=false
#export BUILD_CORBA=false
export BUILD_HOTSPOT=true
export BUILD_JDK=true
#export SKIP_DEBUG_BUILD=false
#export SKIP_FASTDEBUG_BUILD=true
#export DEBUG_NAME=debug
BUILD_DEPLOY=false
BUILD_INSTALL=false
export ALT_OUTPUTDIR=/home/wangx/warehouse/openjdk7src
unset JAVA_HOME
unset CLASSPATH

 获取jdk8u源代码

sudo hg clone http://hg.openjdk.java.net/jdk8u/jdk8u-dev
bash ./get_source.sh

准备编译

sudo bash configure --with-boot-jdk=/home/wangx/warehouse/jdk1.7.0_80

开始编译,由于我已经编译过了,所以下面的回显显得很简单

wangx@wangx-VirtualBox:~/warehouse/jdk8u-dev$ sudo make
Building OpenJDK for target 'default' in configuration 'linux-x86_64-normal-server-release'

## Starting langtools
## Finished langtools (build time 00:00:00)

## Starting hotspot
## Finished hotspot (build time 00:00:00)

## Starting corba
## Finished corba (build time 00:00:00)

## Starting jaxp
## Finished jaxp (build time 00:00:01)

## Starting jaxws
## Finished jaxws (build time 00:00:00)

## Starting jdk
## Finished jdk (build time 00:00:01)

----- Build times -------
Start 2017-08-30 00:28:27
End   2017-08-30 00:28:29
00:00:00 corba
00:00:00 hotspot
00:00:01 jaxp
00:00:00 jaxws
00:00:01 jdk
00:00:00 langtools
00:00:02 TOTAL
-------------------------
Finished building OpenJDK for target 'default'

我编译后生成的结果位于:/home/wangx/warehouse/jdk8u-dev/build/linux-x86_64-normal-server-releas/

 

二、只编译HOTSPOT虚拟机

cd hotspot/make/
make 2>&1 | tee ./hotspot_debug.log

sys/cdefs.h no such file or directory  则sudo apt-get install g++-multilib

bits/c++config.h: No such file or directory  则sudo apt-get install gcc-4.7-multilib g++-4.7-multilib

编译输出目录为

/home/wangx/jdkresearch/jdksource/jdk8u-dev/hotspot/build/linux/linux_i486_compiler2/product

 

三、在eclipse中调试hotspot

1.下载eclipse CDT  也就是eclipse 支持 C/C++的版本

2.new->Makefile Project with Existing Code

3

4.项目配置,右键properties

 5.Project->Build Project

posted @ 2017-08-27 14:23  注销111  阅读(635)  评论(0编辑  收藏  举报