mac環(huán)境構(gòu)建openjdk10
先把openjdk代碼拉取下來,估計幾個小時吧”荚颍或者下載赢笨,也很慢未蝌。
github:https://github.com/dmlloyd/openjdk
baiduyun:https://pan.baidu.com/s/1skVhHlN
如果沒有安裝xcode command line tools驮吱,還需要執(zhí)行以下命令
xcode-select --install
還需要安裝freetype,執(zhí)行
brew install freetype
最后確認一下萧吠,有沒有安裝jdk左冬,為啥編譯jdk還需要先安裝jdk,可以看看編譯原理
openjdk git:(jdk10/master) ? java -version
java version "9.0.1"
Java(TM) SE Runtime Environment (build 9.0.1+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.1+11, mixed mode)
下面開始jdk編譯配置:
bash configure --with-jvm-variants=server --with-target-bits=64 --enable-debug --disable-warnings-as-errors
需要其他配置可以執(zhí)行以下命令查看纸型,不需要就過
bash configure -h
或者也可以查看doc目錄里的building.html或building.md
配置成功大抵是下面這樣
Configuration summary:
* Debug level: fastdebug
* HS debug level: fastdebug
* JDK variant: normal
* JVM variants: server
* OpenJDK target: OS: macosx, CPU architecture: x86, address length: 64
* Version string: 10-internal+0-adhoc.xxx.openjdk (10-internal)
Tools summary:
* Boot JDK: java version "9.0.1" Java(TM) SE Runtime Environment (build 9.0.1+11) Java HotSpot(TM) 64-Bit Server VM (build 9.0.1+11, mixed mode) (at /Library/Java/JavaVirtualMachines/jdk-9.0.1.jdk/Contents/Home)
* Toolchain: clang (clang/LLVM)
* C Compiler: Version 9.0.0 (at /usr/bin/clang)
* C++ Compiler: Version 9.0.0 (at /usr/bin/clang++)
下面開始構(gòu)建:
make
構(gòu)建日志:
Building target 'default (exploded-image)' in configuration 'macosx-x86_64-normal-server-fastdebug'
Compiling 8 files for BUILD_TOOLS_LANGTOOLS
Creating support/modules_libs/java.base/libjsig.dylib from 1 file(s)
Creating hotspot/variant-server/tools/adlc/adlc from 13 file(s)
Compiling 2 files for BUILD_JVMTI_TOOLS
Warning: No mercurial configuration present and no .src-rev
Parsing 1 properties into enum-like class for jdk.compiler
Compiling 13 properties into resource bundles for jdk.javadoc
Compiling 12 properties into resource bundles for jdk.jdeps
Compiling 20 properties into resource bundles for jdk.compiler
Compiling 7 properties into resource bundles for jdk.jshell
Compiling 117 files for BUILD_INTERIM_java.compiler
Compiling 397 files for BUILD_INTERIM_jdk.compiler
...
clang: warning: libstdc++ is deprecated; move to libc++ with a minimum deployment target of OS X 10.9 [-Wdeprecated]
clang: warning: libstdc++ is deprecated; move to libc++ with a minimum deployment target of OS X 10.9 [-Wdeprecated]
Compiling 4 files for BUILD_JIGSAW_TOOLS
Stopping sjavac server
Finished building target 'default (exploded-image)' in configuration 'macosx-x86_64-normal-server-fastdebug'
構(gòu)建成功拇砰,在MacBook Pro 10.13上編譯大概需要十幾分鐘左右
驗證一下:
cd build/macosx-x86_64-normal-server-fastdebug/jdk/bin
bin git:(jdk10/master) ? ./java -version
openjdk version "10-internal"
OpenJDK Runtime Environment (fastdebug build 10-internal+0-adhoc.xxx.openjdk)
OpenJDK 64-Bit Server VM (fastdebug build 10-internal+0-adhoc.xxx.openjdk, mixed mode)
本來要構(gòu)建jdk9,結(jié)果失敗了狰腌,但是jdk10成功了除破,那就先這樣了。
下次再來好好研究9的構(gòu)建琼腔。