ubuntu编译jdk遇到的一些问题及解决方法

编译jdk11:

1. C and C++ compiler have different version numbers

解决:

Ubuntu 22.04 64位编译OpenJDK12_no scm configuration present and no .src-rev-CSDN博客

2. 

No rule to make target 'langtools_tools_classes/_the.BUILD_TOOLS_LANGTOOLS.vardeps', needed by 'langtools_tools_classes/_the.BUILD_TOOLS_LANGTOOLS_batch'.  Stop.

解决:

Ubuntu 22.04 64位编译OpenJDK12_no scm configuration present and no .src-rev-CSDN博客

vim make/common/MakeBase.gmk;

找到片段:
666 DependOnVariableHelper = \
667     $(strip \
668         $(eval -include $(call DependOnVariableFileName, $1, $2)) \
669         $(if $(call equals, $(strip $($1)), $(strip $($1_old))),,\
670           $(call MakeDir, $(dir $(call DependOnVariableFileName, $1, $2))) \
671           $(if $(findstring $(LOG_LEVEL), trace), \
672               $(info NewVariable $1: >$(strip $($1))<) \
673               $(info OldVariable $1: >$(strip $($1_old))<)) \
674           $(call WriteFile, $1_old:=$(call DoubleDollar,$($1)), \
675               $(call DependOnVariableFileName, $1, $2))) \
676         $(call DependOnVariableFileName, $1, $2) \
677     )

修改为:

DependOnVariableHelper = \
    $(strip \
        $(eval $1_filename := $(call DependOnVariableFileName, $1, $2)) \
        $(if $(wildcard $($1_filename)), $(eval include $($1_filename))) \
        $(if $(call equals, $(strip $($1)), $(strip $($1_old))),,\
          $(call MakeDir, $(dir $($1_filename))) \
          $(if $(findstring $(LOG_LEVEL), trace), \
              $(info NewVariable $1: >$(strip $($1))<) \
              $(info OldVariable $1: >$(strip $($1_old))<)) \
          $(call WriteFile, $1_old:=$(call DoubleDollar,$(call EscapeHash,$($1))), \
              $($1_filename))) \
        $($1_filename) \
    )

3. time is more than 10 years from present: 1388527200000

解决:

1. grep makeSpecialCaseEntry -nr;

2. vim jdk/make/src/classes/build/tools/generatecurrencydata/GenerateCurrencyData.java;

258     private static int makeSpecialCaseEntry(String currencyInfo) throws Exception {
259         Integer oldEntry = specialCaseMap.get(currencyInfo);
260         if (oldEntry != null) {
261             return oldEntry.intValue();
262         }
263         if (specialCaseCount == maxSpecialCases) {
264             throw new RuntimeException("too many special cases");
265         }
266         if (currencyInfo.length() == 3) {
267             checkCurrencyCode(currencyInfo);
268             specialCaseCutOverTimes[specialCaseCount] = Long.MAX_VALUE;
269             specialCaseOldCurrencies[specialCaseCount] = currencyInfo;
270             specialCaseOldCurrenciesDefaultFractionDigits[specialCaseCount] = getDefaultFractionDigits(currencyInfo);
271             specialCaseOldCurrenciesNumericCode[specialCaseCount] = getNumericCode(currencyInfo);
272             specialCaseNewCurrencies[specialCaseCount] = null;
273             specialCaseNewCurrenciesDefaultFractionDigits[specialCaseCount] = 0;
274             specialCaseNewCurrenciesNumericCode[specialCaseCount] = 0;
275         } else {
276             int length = currencyInfo.length();
277             if (currencyInfo.charAt(3) != ';' ||
278                     currencyInfo.charAt(length - 4) != ';') {
279                 throw new RuntimeException("invalid currency info: " + currencyInfo);
280             }
281             String oldCurrency = currencyInfo.substring(0, 3);
282             String newCurrency = currencyInfo.substring(length - 3, length);
283             checkCurrencyCode(oldCurrency);
284             checkCurrencyCode(newCurrency);
285             String timeString = currencyInfo.substring(4, length - 4);
286             long time = format.parse(timeString).getTime();
287             if (Math.abs(time - System.currentTimeMillis()) > ((long) 10) * 365 * 24 * 60 * 60 * 1000) {
288                 throw new RuntimeException("time is more than 10 years from present: " + time);
289             }
290             specialCaseCutOverTimes[specialCaseCount] = time;
291             specialCaseOldCurrencies[specialCaseCount] = oldCurrency;
292             specialCaseOldCurrenciesDefaultFractionDigits[specialCaseCount] = getDefaultFractionDigits(oldCurrency);
293             specialCaseOldCurrenciesNumericCode[specialCaseCount] = getNumericCode(oldCurrency);
294             specialCaseNewCurrencies[specialCaseCount] = newCurrency;
295             specialCaseNewCurrenciesDefaultFractionDigits[specialCaseCount] = getDefaultFractionDigits(newCurrency);
296             specialCaseNewCurrenciesNumericCode[specialCaseCount] = getNumericCode(newCurrency);
297         }
298         specialCaseMap.put(currencyInfo, new Integer(specialCaseCount));
299         return specialCaseCount++;
300     }

287行的10改成100

编译jdk8:

1. *** This OS is not supported: Linux 6.5.0-44-generic #44~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC UTC 2 x86_64 x86_64 x86_64 GNU/Linux

解决:

ubuntu20上编译openjdk8_ubuntu20 编译hotspot-CSDN博客

其中,如果光加4%不够,继续加5%

vim hotspot/make/linux/Makefile;

219 SUPPORTED_OS_VERSION = 2.4% 2.5% 2.6% 3% 4% 5% 6%

2. error: ‘int readdir_r(DIR*, dirent*, dirent**)’ is deprecated (declared at /usr/include/dirent.h:183) [-Werror=deprecated-declarations]

解决:

2021-10-05_go 'readdir' is deprecated-CSDN博客

bash ./configure  --with-boot-jdk=$PATH_BOOT_JDK --with-extra-cflags="-Wno-error=deprecated-declarations"

3. Exception in thread "main" java.lang.UnsupportedClassVersionError: com/sun/tools/javac/Main : Unsupported major.minor version 52.0

解决:

Unsupported major.minor version 52.0解决办法-CSDN博客

4. jdk/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c:38:24: fatal error: sys/sysctl.h: No such file or directory

解决:

fatal error: sys/sysctl.h: 没有那个文件或目录 #include <sys/sysctl.h> (JVM)Linux下编译openjdk-8报错-CSDN博客

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值