记录编译JDK11源码时遇到的两个问题
执行make all报错信息:
- 错误一
/src/hotspot/share/runtime/arguments.cpp:1461:35: error: result of comparison against a string literal is unspecified (use an explicit string comparison function instead) [-Werror,-Wstring-compare] if (old_java_vendor_url_bug != DEFAULT_VENDOR_URL_BUG) { ^ ~~~~~~~~~~~~~~~~~~~~~~ 1 error generated.
解决方案:
这个是jdk11的一个bug【https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=244803】,看bug历史好像已经修复,不过官方发布的openjdk-11+28_src.zip【http://jdk.java.net/java-se-ri/11】还是存在bug,只能按照bug描述,修改源码之后再进行编译。
2.错误二
src/java.desktop/macosx/native/libawt_lwawt/awt/CSystemColors.m:134:9: error: converting the result of '?:' with integer constants to a boolean always evaluates to 'true' [-Werror,-Wtautological-constant-compare] if (colorIndex < (useAppleColor) ? sun_lwawt_macosx_LWCToolkit_NUM_APPLE_COLORS : java_awt_SystemColor_NUM_COLORS) { ^ 1 error generated.
同理,参考github【https://github.com/openjdk/jdk/commit/4622a18a】修改源码。
重新make all编译正常