1. Get The source code:
HG clone Http://hg.openjdk.java.net/jdk9/jdk9 JDK9CD Jdk9sh get_source.sh
It may fail due to GFW. One alternative solution is fetching the code on an abroad VPS.
2. Build OpenJDK9
The GCC command has a been used by MacOS clang.
$ gcc--versionconfigured with:--prefix=/applications/xcode.app/contents/developer/usr--with-gxx-include-dir=/ Applications/xcode.app/contents/developer/platforms/macosx.platform/developer/sdks/macosx10.12.sdk/usr/include /c++/4.2.1apple LLVM version 8.1.0 (clang-802.0.42) target:x86_64-apple-darwin16.6.0thread Model:posixinstalleddir:/ Applications/xcode.app/contents/developer/toolchains/xcodedefault.xctoolchain/usr/bin
The Configure command:
./configure--with-freetype=/usr/local/cellar/freetype/2.8--enable-debug--with-target-bits=64-- Disable-warnings-as-errors
--with-freetype=/usr/local/cellar/freetype/2.8
Though FreeType is installed via
Brew Intall FreeType
But script configure cannot find it by default. The FreeType prefix have to be specified explicitly.
--disable-warnings-as-errors
To skip compiling error in [1]:
Instantiation of variable ' treechunk<metachunk, freelist<metachunk> >::_min_tree_chunk_size ' required Here, but the no definition is available [-wundefined-var-template] return _min_tree_chunk_size; ^
It ' s kind of exciting to see the following messages after so much struggling.
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_toolsstoppin G Sjavac serverfinished Building target ' default (exploded-image) ' in configuration ' macosx-x86_64- Normal-server-fastdebug '
The version info of new build Java:
$ bin/java--versionopenjdk 9-internalopenjdk Runtime Environment (Fastdebug build 9-internal+0-adhoc. HU.JDK9) OpenJDK 64-bit Server VM (fastdebug build 9-internal+0-adhoc. HU.JDK9, Mixed mode)
Reference:
[1] Http://mail.openjdk.java.net/pipermail/build-dev/2017-May.txt
Build OpenJDK9 on MacOS Sierra