Mac編譯OpenJDK7(8)和Eclipse除錯Hotspot
阿新 • • 發佈:2019-02-07
一、前言
- Java是我主要的生產語言,但對JVM不是很瞭解,最近也在看《深入理解Java虛擬機器 第二版》,所以想親手編譯OpenJDK和除錯HotSpot虛擬機器
- 系統是15年的Mac OS X(10.11.5),而OpenJDK7卻是13的,完全按照書本來,肯定是編譯不過的,本文記錄了在這個痛苦過程中遇到的坑,希望對其他人能有所幫助
- OpenJDK8使用configure && make的方式,比較容易就編譯通過
- 感謝westion717,chenjingbo,裴銀祥的分享,最後會列出相應的參考連結
二、下載
三、 系統環境
Key | Value |
---|---|
OS | 10.11.5 El Capitan |
Apple LLVM version | 7.3.0 (clang-703.0.31) |
make | GNU Make 3.81 |
Xcode | 7.3.1 |
Ant | 1.9.7 |
LLVM GCC(clang) | 4.2.1 |
zip | 3.0 |
unzip | 5.52 |
freeType | 2.6.1 |
四、編譯OpenJDK7
1. 環境依賴
Key | Value |
---|---|
GNU make | ≧ 3.81 |
Bootstrap JDK | ≧ JDK6 , < JDK7 |
XCode | ≧ 4.1 |
Ant | ≧ 1.7.1 |
LLVM GCC | ≧ 4.2.1 |
zip | ≧ 2.2 |
unzip | ≧ 5.12 |
freeType | ≧ 2.3 |
2. 環境變數(openjdk7.bash)
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 | # 設定語言選項,必須設定 |
3. 載入並檢查環境變數
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 | # 載入環境變數source../../openjdk7.bash # 檢查環境變數 make sanity # 檢查結果(僅僅顯示關鍵資訊)BuildMachineInformation: build machine =MacBuildDirectoryStructure: 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 =./jdk BuildDirectives: BUILD_LANGTOOLS =true BUILD_JAXP =true BUILD_JAXWS =true BUILD_CORBA =true BUILD_HOTSPOT =true BUILD_JDK =true HotspotSettings: 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/import BootstrapSettings: 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/build BuildToolSettings: 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/tmp BuildDirectives: OPENJDK =true COMPILE_APPROACH = parallel PARALLEL_COMPILE_JOBS =2 ALT_PARALLEL_COMPILE_JOBS =2 COMPILER_WARNINGS_FATAL =false INCREMENTAL_BUILD =true BuildPlatformSettings: 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 =8192 GNU MakeSettings: MAKE =/Applications/Xcode.app/Contents/Developer/usr/bin/make MAKE_VER =3.81[requires at least |