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

转载于:https://www.cnblogs.com/huys03/p/7101227.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值