記錄編譯JDK11源碼時遇到的兩個問題
執(zhí)行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歷史好像已經(jīng)修復(fù),不過官方發(fā)布的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編譯正常

作者:abingtech
本文版權(quán)歸作者和博客園共有,歡迎轉(zhuǎn)載,但未經(jīng)作者同意必須保留此段聲明,且在文章頁面明顯位置給出,
原文鏈接
如有問題,可郵件abingtech@163.com咨詢.

浙公網(wǎng)安備 33010602011771號