Build OpenJDK9 on macOS Sierra
Posted 独木
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Build OpenJDK9 on macOS Sierra相关的知识,希望对你有一定的参考价值。
1. Get the source code:
hg clone http://hg.openjdk.java.net/jdk9/jdk9 jdk9 cd jdk9 sh 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 been used by macOS clang。
$ gcc --version Configured 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.1 Apple LLVM version 8.1.0 (clang-802.0.42) Target: x86_64-apple-darwin16.6.0 Thread model: posix InstalledDir: /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 has 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 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_TOOLS Stopping sjavac server Finished building target ‘default (exploded-image)‘ in configuration ‘macosx-x86_64-normal-server-fastdebug‘
The version info of new build java:
$ bin/java --version openjdk 9-internal OpenJDK 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的主要内容,如果未能解决你的问题,请参考以下文章
OpenGL Programming On macOS using glfw 0: Build a Simple OpenGL Program
高版本Openjdk缺少tools.jar项目编译不过解决办法
Please create pull requests instead of asking for help on Homebrew‘s GitHubError: macOS 10.13