記錄編譯JDK11源碼時遇到的兩個問題


執行make all報錯信息:

  1. 錯誤一
/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編譯正常

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM