環境:
os: MAC OS X 10.10.1 yosemite
target build OPENJDK:jdk8
Xcode:6.1
LLVM Version:

Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn)

Target: x86_64-apple-darwin14.0.0

Thread model: posix

步驟:
1 國內hg拉取代碼不靠譜,到這里打包下載,118M  
http://download.java.net/openjdk/jdk8/

安裝X11,系統默認好像是沒有這個東西,需要下載安裝XQuartz,然后link下 sudo ln -s /usr/X11/include/X11 /usr/include/X11

sudo ln -s /usr/bin/llvm-g++ /Applications/Xcode.app/Contents/Developer/usr/bin/llvm-g++  
sudo ln -s /usr/bin/llvm-gcc /Applications/Xcode.app/Contents/Developer/usr/bin/llvm-gcc
4 安裝
Xcode的Command line tools、freetype
./configure --enable-debug --with-target-bits=64
6 cd jdk8;
unset JAVA_HOME
unset CLASSPATH 
make CC=clang COMPILER_WARNINGS_FATAL=false LFLAGS='-Xlinker -lstdc++' USE_CLANG=true LP64=1 LANG=C ALT_BOOTDIR=/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home ARCH_DATA_MODEL=64 HOTSPOT_BUILD_JOBS=8 ALT_FREETYPE_HEADERS_PATH=/Users/mungo/Downloads/work/homebrew-master/Cellar/freetype/2.5.5/include ALT_FREETYPE_LIB_PATH=/Users/mungo/Downloads/work/homebrew-master/Cellar/freetype/2.5.5/lib
7 驗證結果:

./build/macosx-x86_64-normal-server-fastdebug/jdk/bin/java -version

openjdk version "1.8.0-internal-fastdebug"

OpenJDK Runtime Environment (build 1.8.0-internal-fastdebug-mungo_2015_01_29_16_11-b00)

OpenJDK 64-Bit Server VM (build 25.0-b70-fastdebug, mixed mode)


出現的問題:

clang: error: unknown argument: '-fcheck-new' [-Wunused-command-line-argument-hard-error-in-future]  

         于是直接打開YourOpenJDK/hotspot/make/bsd/makefiles/gcc.make,把這行(line 193)給注釋掉
2 relocInfo.hpp錯誤。 將接口的默認值去掉,把默認值放到的方法參數里即可。hotspot/src/share/vm/code/relocInfo.hpp 
+ inline friend relocInfo prefix_relocInfo(int datalen);

+inline 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);
 }

參考文章:
http://hllvm.group.iteye.com/group/topic/39814
http://yueyemaitian.iteye.com/blog/2038304

另:openjdk 7 hotspot我可以編譯成功,但是最后打包的時候,出現 執行cp 錯誤.沒找到原因