Mac编译OpenJDK7(8)和Eclipse调试Hotspot

来源:互联网 发布:达内和尚观linux哪个好 编辑:程序博客网 时间:2024/06/05 04:52

一、前言

  1. Java是我主要的生产语言,但对JVM不是很了解,最近也在看《深入理解Java虚拟机 第二版》,所以想亲手编译OpenJDK调试HotSpot虚拟机
  2. 系统是15年的Mac OS X(10.11.5),而OpenJDK7却是13的,完全按照书本来,肯定是编译不过的,本文记录了在这个痛苦过程中遇到的坑,希望对其他人能有所帮助
  3. OpenJDK8使用configure && make的方式,比较容易就编译通过
  4. 感谢westion717chenjingbo裴银祥的分享,最后会列出相应的参考链接

二、下载

  1. openjdk-7u40-fcs-src-b43-26_aug_2013.zip
  2. openjdk-8-src-b132-03_mar_2014.zip
  3. OpenJDK7 Build README
  4. OpenJDK8 Build README
  5. Eclipse CPP NEON

三、 系统环境

KeyValueOS10.11.5 El CapitanApple LLVM version7.3.0 (clang-703.0.31)makeGNU Make 3.81Xcode7.3.1Ant1.9.7LLVM GCC(clang)4.2.1zip3.0unzip5.52freeType2.6.1

四、编译OpenJDK7

1. 环境依赖

KeyValueGNU make≧ 3.81Bootstrap JDK≧ JDK6 , < JDK7XCode≧ 4.1Ant≧ 1.7.1LLVM GCC≧ 4.2.1zip≧ 2.2unzip≧ 5.12freeType≧ 2.3

2. 环境变量(openjdk7.bash)

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
# 设定语言选项,必须设置export LANG=C# Mac平台,C编译器不再是GCC,是clangexport CC=clang# 跳过clang的一些严格的语法检查,不然会将N多的警告作为Errorexport COMPILER_WARNINGS_FATAL=false# 链接时使用的参数export LFLAGS='-Xlinker -lstdc++'# 是否使用clangexport USE_CLANG=true# 使用64位数据模型export LP64=1# 告诉编译平台是64位,不然会按32位来编译export ARCH_DATA_MODEL=64# 允许自动下载依赖export ALLOW_DOWNLOADS=true# 并行编译的线程数,编译时间长,为了不影响其他工作,我选择为2export HOTSPOT_BUILD_JOBS=2export ALT_PARALLEL_COMPILE_JOBS=2# 是否跳过与先前版本的比较export SKIP_COMPARE_IMAGES=true# 是否使用预编译头文件,加快编译速度export USE_PRECOMPILED_HEADER=true# 是否使用增量编译export INCREMENTAL_BUILD=true# 编译内容export BUILD_LANGTOOLS=trueexport BUILD_JAXP=trueexport BUILD_JAXWS=trueexport BUILD_CORBA=trueexport BUILD_HOTSPOT=trueexport BUILD_JDK=true# 编译版本export SKIP_DEBUG_BUILD=trueexport SKIP_FASTDEBUG_BUILD=falseexport DEBUG_NAME=debug# 避开javaws和浏览器Java插件之类的部分的buildexport BUILD_DEPLOY=falseexport BUILD_INSTALL=false# FreeTypeexport FREETYPE_LIB_PATH=/usr/X11R6/libexport FREETYPE_HEADERS_PATH=/usr/X11R6/includeexport ALT_FREETYPE_LIB_PATH=/usr/local/Cellar/freetype/2.6_1/libexport ALT_FREETYPE_HEADERS_PATH=/usr/local/Cellar/freetype/2.6_1/include# 目标编译版本信息export MILESTONE=internalexport BUILD_NUMBER=b25# 指定bootstrap jdk的路径。反引号的意思是执行这段shell代码后得到的结果作为该环境变量的值export ALT_BOOTDIR=`/usr/libexec/java_home -v 1.6`# 编译结果的输出路径export ALT_OUTPUTDIR=/Users/zhongmingmao/Documents/source_code/java/openjdk/openjdk7/openjdk/build# ANTexport ANT_HOME=/Users/zhongmingmao/Downloads/apache-ant-1.9.7# 取消环境变量的设置,减少警告unset JAVA_HOMEunset CLASSPATHunset LD_LIBRARY_PATH

3. 加载并检查环境变量

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
# 加载环境变量source ../../openjdk7.bash# 检查环境变量make sanity# 检查结果(仅仅显示关键信息)Build Machine Information:   build machine = MacBuild Directory Structure:   CWD = /Users/zhongmingmao/Documents/source_code/java/openjdk/openjdk7/openjdk   TOPDIR = .   LANGTOOLS_TOPDIR = ./langtools   JAXP_TOPDIR = ./jaxp   JAXWS_TOPDIR = ./jaxws   CORBA_TOPDIR = ./corba   HOTSPOT_TOPDIR = ./hotspot   JDK_TOPDIR = ./jdkBuild Directives:   BUILD_LANGTOOLS = true   BUILD_JAXP = true   BUILD_JAXWS = true   BUILD_CORBA = true   BUILD_HOTSPOT = true   BUILD_JDK    = trueHotspot Settings:      HOTSPOT_BUILD_JOBS  = 2      HOTSPOT_OUTPUTDIR   = /Users/zhongmingmao/Documents/source_code/java/openjdk/openjdk7/openjdk/build/hotspot/outputdir      HOTSPOT_EXPORT_PATH = /Users/zhongmingmao/Documents/source_code/java/openjdk/openjdk7/openjdk/build/hotspot/importBootstrap Settings:  BOOTDIR = /Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home    ALT_BOOTDIR = /Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home  BOOT_VER = 1.6.0 [requires at least 1.6]  OUTPUTDIR = /Users/zhongmingmao/Documents/source_code/java/openjdk/openjdk7/openjdk/build    ALT_OUTPUTDIR = /Users/zhongmingmao/Documents/source_code/java/openjdk/openjdk7/openjdk/build  ABS_OUTPUTDIR = /Users/zhongmingmao/Documents/source_code/java/openjdk/openjdk7/openjdk/buildBuild Tool Settings:  ANT_HOME = /Users/zhongmingmao/Downloads/apache-ant-1.9.7  COMPILER_PATH = /Applications/Xcode.app/Contents/Developer/usr/bin/  COMPILER_NAME = LLVM-GCC4  COMPILER_VERSION = LLVM-GCC4  CC_VER = 4.2.1 [requires at least 4.2.1]  ZIP_VER = 3.0 [requires at least 2.2]  UNZIP_VER = 5.52 [requires at least 5.12]  ANT_VER = 1.9.7 [requires at least 1.7.1]  TEMPDIR = /Users/zhongmingmao/Documents/source_code/java/openjdk/openjdk7/openjdk/build/tmpBuild Directives:  OPENJDK = true  COMPILE_APPROACH = parallel  PARALLEL_COMPILE_JOBS = 2    ALT_PARALLEL_COMPILE_JOBS = 2  COMPILER_WARNINGS_FATAL = false  INCREMENTAL_BUILD = trueBuild Platform Settings:  USER = zhongmingmao  PLATFORM = macosx  ARCH = x86_64  LIBARCH = x86_64  ARCH_FAMILY = x86_64  ARCH_DATA_MODEL = 64  ARCHPROP = x86_64  OS_VERSION = 15.5.0 [requires at least 11.2]  OS_VARIANT_NAME = MacOSX  OS_VARIANT_VERSION = 10.11.5  MB_OF_MEMORY = 8192GNU Make Settings:  MAKE = /Applications/Xcode.app/Contents/Developer/usr/bin/make  MAKE_VER = 3.81 [requires at least 3.81]  MAKECMDGOALS = sanity  SHELL = /bin/shTarget Build Versions:  JDK_VERSION = 1.7.0  MILESTONE = internal  RELEASE = 1.7.0-internal-debug  FULL_VERSION = 1.7.0-internal-debug-b25  BUILD_NUMBER = b25External File/Binary Locations:  LANGTOOLS_DIST =    ALT_LANGTOOLS_DIST = /Users/zhongmingmao/Documents/source_code/java/openjdk/openjdk7/openjdk/build/langtools/dist  CORBA_DIST =    ALT_CORBA_DIST = /Users/zhongmingmao/Documents/source_code/java/openjdk/openjdk7/openjdk/build/corba/dist  JAXP_DIST =    ALT_JAXP_DIST = /Users/zhongmingmao/Documents/source_code/java/openjdk/openjdk7/openjdk/build/jaxp/dist  JAXWS_DIST =    ALT_JAXWS_DIST = /Users/zhongmingmao/Documents/source_code/java/openjdk/openjdk7/openjdk/build/jaxws/dist  HOTSPOT_IMPORT_PATH = /Users/zhongmingmao/Documents/source_code/java/openjdk/openjdk7/openjdk/build/hotspot/import    ALT_HOTSPOT_IMPORT_PATH = /Users/zhongmingmao/Documents/source_code/java/openjdk/openjdk7/openjdk/build/hotspot/import  HOTSPOT_SERVER_PATH = /Users/zhongmingmao/Documents/source_code/java/openjdk/openjdk7/openjdk/build/hotspot/import/jre/lib/server  CACERTS_FILE = ./../src/share/lib/security/cacerts  CUPS_HEADERS_PATH = /usr/includeOpenJDK-specific settings:  FREETYPE_HEADERS_PATH = /usr/local/Cellar/freetype/2.6_1/include    ALT_FREETYPE_HEADERS_PATH = /usr/local/Cellar/freetype/2.6_1/include  FREETYPE_LIB_PATH = /usr/local/Cellar/freetype/2.6_1/lib    ALT_FREETYPE_LIB_PATH = /usr/local/Cellar/freetype/2.6_1/libPrevious JDK Settings:  PREVIOUS_JDK_VERSION = 1.6.0  PREVIOUS_RELEASE_IMAGE = /Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/HomeSanity check passed.

4. 编译Debug版本

1234567891011121314151617181920212223
# 编译命令make debug_build 2>&1 |tee $ALT_OUTPUTDIR/build.log# 编译结果#-- Build times ----------Target debug_buildStart 2016-07-13 00:21:16End   2016-07-13 00:30:2500:00:12 corba00:00:10 hotspot00:00:02 jaxp00:00:05 jaxws00:08:35 jdk00:00:03 langtools00:09:09 TOTAL-------------------------# 运行编译结果./build-debug/j2sdk-image/bin/java -versionopenjdk version "1.7.0-internal-debug"OpenJDK Runtime Environment (build 1.7.0-internal-debug-b25)OpenJDK 64-Bit Server VM (build 24.0-b56-jvmg, mixed mode)

5. 编译过程中遇到的坑(按出现顺序记录)

5.1 乱码问题
12345678
# 具体报错openjdk/build/../build-debug/corba/gensrc/org/omg/PortableServer/AdapterActivatorOperations.java:8: ´íÎó: ±àÂëasciiµÄ    ²»¿ÉÓ³Éä×Ö·û* 2016??7??12?? ?????? ????05??39??22?? CST# 解决办法find build-debug/corba/gensrc/org/ -name '*.java' | while read p; do native2ascii -encoding UTF-8 $p > tmpj; mv tmpj $p; doneexport _JAVA_OPTIONS=-Dfile.encoding=ASCII
5.2 clang不支持参数-fpch-deps
123456789101112131415161718192021222324
# 具体报错clang: error: unknown argument: '-fpch-deps'# 解决方法1. 首先查找对应的配置文件find . -type f ! -name "*.java" | xargs grep -r "\-fpch\-deps"1.1 匹配的查找结果如下(Mac来源于BSD,选择BSD./hotspot/make/bsd/makefiles/gcc.make:DEPFLAGS = -fpch-deps -MMD -MP -MF $(DEP_DIR)/$(@:%=%.d)./hotspot/make/linux/makefiles/gcc.make:DEPFLAGS = -fpch-deps -MMD -MP -MF $(DEP_DIR)/$(@:%=%.d)./hotspot/make/solaris/makefiles/gcc.make:DEPFLAGS = -fpch-deps -MMD -MP -MF $(DEP_DIR)/$(@:%=%.d)2 修改hotspot/make/bsd/makefiles/gcc.make2.1 注释216-218# Flags for generating make dependency flags.# ifneq ("${CC_VER_MAJOR}", "2")# DEPFLAGS = -fpch-deps -MMD -MP -MF $(DEP_DIR)/$(@:%=%.d)# endif2.2 218行下添加下面代码DEPFLAGS = -MMD -MP -MF $(DEP_DIR)/$(@:%=%.d)ifeq ($(USE_CLANG),)  ifneq ($(CC_VER_MAJOR), 2)    DEPFLAGS += -fpch-deps  endifendif
5.3 形参默认值问题
12345678910111213141516171819202122232425262728
# 具体报错openjdk/hotspot/src/share/vm/code/relocInfo.hpp:374:27: error: friend declaration specifying a default argument must      be a definitioninline friend relocInfo prefix_relocInfo(int datalen = 0);openjdk/hotspot/src/share/vm/code/relocInfo.hpp:469:18: error: friend declaration specifying a default argument must      be the only declarationinline relocInfo prefix_relocInfo(int datalen) {openjdk/hotspot/src/share/vm/code/relocInfo.hpp:470:21: error: 'fits_into_immediate' is a protected member of 'reloc     Info'assert(relocInfo::fits_into_immediate(datalen), "datalen in limits");openjdk/hotspot/src/share/vm/code/relocInfo.hpp:471:59: error: 'RAW_BITS' is a protected member of 'relocInfo'return relocInfo(relocInfo::data_prefix_tag, relocInfo::RAW_BITS, relocInfo::datalen_tag | datalen);openjdk/hotspot/src/share/vm/code/relocInfo.hpp:471:10: error: calling a protected constructor of class 'relocInfo'return relocInfo(relocInfo::data_prefix_tag, relocInfo::RAW_BITS, relocInfo::datalen_tag | datalen);# 解决办法# 修改relocInfo.hpp(路径:hotspot/src/share/vm/code/relocInfo.hpp)修改374inline friend relocInfo prefix_relocInfo(int datalen);修改469inline relocInfo prefix_relocInfo(int datalen = 0) {   assert(relocInfo::fits_into_immediate(datalen), "datalen in limits");   return relocInfo(relocInfo::data_prefix_tag, relocInfo::RAW_BITS, relocInfo::datalen_tag | datalen);}
5.4 十年问题
12345678910111213141516171819
# 具体报错Error: time is more than 10 years from present: 1136059200000java.lang.RuntimeException: time is more than 10 years from present: 1136059200000  at build.tools.generatecurrencydata.GenerateCurrencyData.makeSpecialCaseEntry(GenerateCurrencyData.java:285)  at build.tools.generatecurrencydata.GenerateCurrencyData.buildMainAndSpecialCaseTables(GenerateCurrencyData.java:225)  at build.tools.generatecurrencydata.GenerateCurrencyData.main(GenerateCurrencyData.java:154)# 解决办法# 修改CurrencyData.properties(路径:jdk/src/share/classes/java/util/CurrencyData.properties)修改108AZ=AZM;2009-12-31-20-00-00;AZN修改381MZ=MZM;2009-06-30-22-00-00;MZN修改443RO=ROL;2009-06-30-21-00-00;RON修改535TR=TRL;2009-12-31-22-00-00;TRY修改561VE=VEB;2009-01-01-04-00-00;VEF
5.5 非空函数不返回值的问题一
1234567891011121314151617
# 具体报错../../../src/solaris/native/java/net/net_util_md.c:117:9: error: non-void function 'getDefaultScopeID' should return a value [-Wreturn-type]        CHECK_NULL(c);        ^../../../src/share/native/java/net/net_util.h:45:40: note: expanded from macro 'CHECK_NULL'#define CHECK_NULL(x) if ((x) == NULL) return;                                       ^../../../src/solaris/native/java/net/net_util_md.c:119:9: error: non-void function 'getDefaultScopeID' should return a value [-Wreturn-type]        CHECK_NULL(c);        ^../../../src/share/native/java/net/net_util.h:45:40: note: expanded from macro 'CHECK_NULL'#define CHECK_NULL(x) if ((x) == NULL) return;# 解决办法# 修改net_util_md.c(路径:jdk/src/solaris/native/java/net/net_util_md.c)修改117119CHECK_NULL_RETURN(c , 0);
5.6 权限问题
12345
# 具体报错Permission denied - ./src/core/PrimitiveCoder.hs (Errno::EACCES)# 解决办法chmod 755 jdk/src/macosx/native/jobjc/src/core/PrimitiveCoder.hs
5.7 clang不支持GC的问题
1234567891011121314
# 具体报错clang: error: garbage collection is no longer supported# 解决办法1. 首先查找相应的配置文件find . -type f ! -name "*.log" | xargs grep -r "GCC_ENABLE_OBJC_GC"1.1 匹配的查找结果如下nary file ./build-debug/JObjC.dst/dgph matches./jdk/src/macosx/native/jobjc/JObjC.xcodeproj/project.pbxproj:                                GCC_ENABLE_OBJC_GC = supported;./jdk/src/macosx/native/jobjc/JObjC.xcodeproj/project.pbxproj:                                GCC_ENABLE_OBJC_GC = supported;2. 修改project.pbxproj(路径:./jdk/src/macosx/native/jobjc/JObjC.xcodeproj/project.pbxproj修改705713GCC_ENABLE_OBJC_GC = "";
5.8 返回值大于返回类型精度的问题
12345678910111213141516
# 具体报错openjdk/build-debug/JObjC.build/src/jobjc/com/apple/jobjc/appkit/AppKitFramework.java:355: ?????     public final float NSEventDurationForever(){ return 1.797693134862316E+308f; }# 解决办法1. 修改bridgesupport.gmk(路径:jdk/src/macosx/native/jobjc/bridgesupport.gmk修改54all:2. 修改AppKitFull.bridgesupport(路径:build-debug/stable_bridge_metadata/AppKitFull.bridgesupport修改1485<enum name='NSEventDurationForever' value='3.40282E+38'/>3. 修改AppKitFramework.java(路径:build-debug/JObjC.build/src/jobjc/com/apple/jobjc/appkit/AppKitFramework.java修改355public final double NSEventDurationForever(){ return 3.40282E+38d; }
5.9 非空函数不返回值的问题二
12345678
# 具体报错openjdk/jdk/src/macosx/native/sun/awt/AWTEvent.m:385:24: error: non-void function 'NsGetDeadKeyChar' should return a value [-Wreturn-type]    if (uchr == nil) { return; }# 解决办法# 修改AWTEvent.m(路径:jdk/src/macosx/native/sun/awt/AWTEvent.m)修改385if (uchr == nil) { return 0; }

五、Eclipse调试Hotspot

1. 导入项目

12345
# 操作file -> new -> Makefile Project with Existing Code# 备注hotspot目录 : OpenJDK源代码根目录下

图片失效

1. 修改项目属性

12
# 操作项目右键 -> properites -> C/C++ Build
1.1 Builder Settings
1234
# 备注Build command : make -f Makefile ALT_BOOTDIR=/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home ARCH_DATA_MODEL=64 LANG=C COMPILER_WARNINGS_FATAL=false LFLAGS='-Xlinker -lstdc++' USE_CLANG=true LP64=1 CC=clang HOTSPOT_BUILD_JOBS=2 SHOW_ALL_WARNINGS=falseBuild directory : ${workspace_loc:/hotspot}/make

图片失效

1.2 Behavior
12
# 备注Build(Incremental build) : jvmg

图片失效

2. 构建项目前准备

12345678910
# 目的防止进度条出现"Remote System Explorer Operation",导致Eclipse卡顿# 操作一Eclipse -> Preferences -> General -> Startup and Shutdown.- Uncheck RSE UI.# 操作二Eclipse -> Preferences -> Remote Systems.- Uncheck Re-open Remote Systems view to previous state.

3. 构建项目

123456789101112
# 操作Project -> Build Project -> 漫长地等待# 构建结果(只显示最后的内容).....echo "Doing vm.make build:"Doing vm.make build:All done.cd bsd_amd64_compiler2/jvmg && ./test_gammaJAVA_HOME must point to a 64-bit OpenJDK.19:49:47 Build Finished (took 11s.789ms)

4. 调试HotSpot

4.1 配置全局GDB路径
12345
# 操作Eclipse -> Preferences -> C/C++ -> Debug -> GDB# 备注GDB debugger : /usr/local/bin/gdb

图片失效

4.2 Debug配置
4.2.1 新建C/C++ Application
12345
# 操作Debug Configurations -> new -> C/C++ Application# 启动程序C/C++ Application : /Users/zhongmingmao/Documents/source_code/java/openjdk/openjdk7/openjdk_copy/hotspot/build/bsd/bsd_amd64_compiler2/jvmg/gamma

图片失效

4.2.2 配置Arguments
1
Program arguments : Hello # 自己编译的class文件

图片失效

4.2.3 配置Environment(新增三个环境变量)
12345678910111213141516
# 1. 加上自己的class路径,否则会ClassNotFoundCLASSPATH : .:/Users/zhongmingmao/Documents/source_code/java/openjdk/my_class# 2. 配置JAVA_HOME,即编译OpenJDK7时产生的目录,否则会报下面错误  JAVA_HOME must point to a valid JDK/JRE to run gamma  Error: could not find libjava.dylib  Error: could not find Java 2 Runtime Environment.JAVA_HOME : /Users/zhongmingmao/Documents/source_code/java/openjdk/openjdk7/openjdk_copy/build-debug/j2sdk-image# 3. 配置LD_LIBRARY_PATH,即Eclipse编译HotSpot产生的目录,当然也可以使用编译OpenJDK7时产生的目录,否则会报下面的错误  dyld: Library not loaded: @rpath/libjvm.dylib    Referenced from: /Users/zhongmingmao/Documents/source_code/java/openjdk/openjdk7/openjdk_copy/hotspot/build/bsd/bsd_amd64_compiler2/jvmg/gamma    Reason: image not foundLD_LIBRARY_PATH : /Users/zhongmingmao/Documents/source_code/java/openjdk/openjdk7/openjdk_copy/hotspot/build/bsd/bsd_amd64_compiler2/jvmg

图片失效

4.2.4 配置Debugger
1
GDB debugger : /usr/local/bin/gdb

图片失效

4.3 Debug视图

图片失效

六、编译OpenJDK8

1. 与OpenJDK7的区别

  • The build is now a configure && make style build
  • Ant is no longer used when building the OpenJDK
  • Any GNU make 3.81 or newer should work
  • Use of ALT_* environment variables for configuring the build is no longer supported

2. 环境依赖

KeyValueGNU make≧ 3.81Bootstrap JDK≧ JDK7U7 , < JDK8XCode≧ 4.5.2

3. 修改部分代码和配置

1234567891011121314
# 1. 修改generated-configure.sh(路径:common/autoconf/generated-configure.sh)注释20061// as_fn_error $? "GCC compiler is required. Try setting --with-tools-dir." "$LINENO" 5注释21640// as_fn_error $? "GCC compiler is required. Try setting --with-tools-dir." "$LINENO" 5# 2. 修改relocInfo.hpp(路径:hotspot/src/share/vm/code/relocInfo.hpp)修改376inline friend relocInfo prefix_relocInfo(int datalen);修改472inline relocInfo prefix_relocInfo(int datalen = 0) {   assert(relocInfo::fits_into_immediate(datalen), "datalen in limits");   return relocInfo(relocInfo::data_prefix_tag, relocInfo::RAW_BITS, relocInfo::datalen_tag | datalen);}

4. configure

12345678910111213141516171819202122
# 用法sh ./configure --help=short# 实际命令参数sh configure --with-debug-level=slowdebug --with-boot-jdk=`/usr/libexec/java_home -v 1.7` --with-target-bits=64 --with-jvm-variants=server --with-jdk-variant=normal --with-milestone=internal --with-update-version=b25 --with-build-number=b25 --with-num-cores=2 --with-jobs=4 CC=clang CXX=clang++# 输出(仅显示关键信息)Configuration summary:* Debug level:    slowdebug* JDK variant:    normal* JVM variants:   server* OpenJDK target: OS: macosx, CPU architecture: x86, address length: 64Tools summary:* Boot JDK:       java version "1.7.0_79" Java(TM) SE Runtime Environment (build 1.7.0_79-b15) Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)  (at /Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home)* C Compiler:     Apple LLVM version (clang-703.0.31) version 7.3.0 (clang-703.0.31) (at /usr/bin/clang)* C++ Compiler:   Apple LLVM version (clang-703.0.31) version 7.3.0 (clang-703.0.31) (at /usr/bin/clang++)Build performance summary:* Cores to use:   4* Memory limit:   8192 MB* ccache status:  installed, but disabled (version older than 3.1.4)

5. make

123456789101112131415161718
# 用法make help# 实际命令参数make COMPILER_WARNINGS_FATAL=false LFLAGS='-Xlinker -lstdc++' CC=clang USE_CLANG=true LP64=1# 输出(仅显示关键信息)----- Build times -------Start 2016-07-10 16:05:19End   2016-07-10 16:12:4100:00:44 corba00:01:32 hotspot00:00:23 jaxp00:00:36 jaxws00:04:06 jdk00:00:00 langtools00:07:22 TOTAL-------------------------

6. java -version

1234567
# 命令build/macosx-x86_64-normal-server-slowdebug/jdk/bin/java -version# 输出openjdk version "1.8.0_b25-internal-debug"OpenJDK Runtime Environment (build 1.8.0_b25-internal-debug-b25)OpenJDK 64-Bit Server VM (build 25.0-b70-debug, mixed mode)

七、参考资料

  1. 自己动手编译JDK并单步调试hotspot(Mac)
  2. 在eclipse中调试hotspot
  3. mac上eclipse用gdb调试
0 0