ubuntu20.4 openjdk7编译报错

2022/1/9 7:04:01

本文主要是介绍ubuntu20.4 openjdk7编译报错,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

This OS is not supported:" `uname -a`; exit 1;

>&2 echo "*** This OS is not supported:" `uname -a`; exit 1;
*** This OS is not supported: Linux dawn-Virtual-Machine 5.11.0-43-generic #47~20.04.2-Ubuntu SMP Mon Dec 13 11:06:56 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
make[6]: *** [/home/dawn/workstation/openjdk/hotspot/make/linux/Makefile:240: check_os_version] Error 1
make[6]: Leaving directory '/home/dawn/bin/openjdk7-debug/hotspot/outputdir'
make[5]: *** [/home/dawn/workstation/openjdk/hotspot/make/linux/Makefile:261: linux_amd64_compiler2/debug] Error 2
make[5]: Leaving directory '/home/dawn/bin/openjdk7-debug/hotspot/outputdir'
make[4]: *** [Makefile:192: generic_build2] Error 2
make[4]: Leaving directory '/home/dawn/workstation/openjdk/hotspot/make'
make[3]: *** [Makefile:151: jvmg] Error 2
make[3]: Leaving directory '/home/dawn/workstation/openjdk/hotspot/make'
make[2]: *** [make/hotspot-rules.gmk:114: hotspot-build] Error 2
make[2]: Leaving directory '/home/dawn/workstation/openjdk'
make[1]: *** [Makefile:262: generic_debug_build] Error 2
make[1]: Leaving directory '/home/dawn/workstation/openjdk'
make: *** [Makefile:272: build_debug_image] Error 2

找到报错位置,出现此错误是官方不希望在老的系统上编译,但是由于检测机制问题,导致误报,官方提供了解决办法设置DISABLE_HOTSPOT_OS_VERSION_CHECK=ok

export DISABLE_HOTSPOT_OS_VERSION_CHECK=ok

 Error: time is more than 10 years from present:

Error: time is more than 10 years from present: 1136059200000
java.lang.RuntimeException: time is more than 10 years from present: 1136059200000
        at build.tools.generatecurrencydata.GenerateCurrencyData.makeSpecialCaseEntry(GenerateCurrencyData.java:285)
        at build.tools.generatecurrencydata.GenerateCurrencyData.buildMainAndSpecialCaseTables(GenerateCurrencyData.java:225)
        at build.tools.generatecurrencydata.GenerateCurrencyData.main(GenerateCurrencyData.java:154)
make[5]: *** [Makefile:343: /home/dawn/bin/openjdk7//../openjdk7-debug/lib/currency.data] Error 1
make[5]: Leaving directory '/home/dawn/workstation/openjdk/jdk/make/java/java'
make[4]: *** [Makefile:67: all] Error 1
make[4]: Leaving directory '/home/dawn/workstation/openjdk/jdk/make/java'
make[3]: *** [Makefile:253: all] Error 1
make[3]: Leaving directory '/home/dawn/workstation/openjdk/jdk/make'
make[2]: *** [make/jdk-rules.gmk:89: jdk-build] Error 2
make[2]: Leaving directory '/home/dawn/workstation/openjdk'
make[1]: *** [Makefile:262: generic_debug_build] Error 2
make[1]: Leaving directory '/home/dawn/workstation/openjdk'
make: *** [Makefile:272: build_debug_image] Error 2

简单粗暴,grep "time is more than 10 years from present",找到报错的代码,直接把10年改成20年,20年不够就100年

Freetype Failed: headers are too old 、Failed: too old library

Required version of freetype: 2.3.0
Detected freetype headers: 2.10.1
Failed: headers are too old.
Detected freetype library: 2.10.1
Failed: too old library.

显然是误报,2.10怎么会比2.3旧呢,打开jdk/make/tools/freetypecheck/freetypecheck.c,发现是直接检测的字符串,而不是数字,3比1大,所以它认为旧了,解决办法很简单,直接在freetypecheck.c main函数第一行return 0,跳过检测,或者也可以去改makefile

 warning: invalid suffix on literal; C++11 requires a space between literal and string macro

error: 'int readdir_r(DIR*, dirent*, dirent**)' is deprecated [-Werror=deprecated-declarations]

以上两个错(应该还有其它也是这个原因)误都是因为启用了编译选项--Werro,视警告为错误;出现任何警告即放弃编译.解决方案为关闭--Werro选项,在./hotspot/make/linux/makefiles/gcc.make,找到WARNINGS_ARE_ERRORS = -Werro,将其删除或改为WARNINGS_ARE_ERRORS = -Wno-all

error: unable to find string literal operator ‘operator""tag’ with ‘const char [58]’, ‘long unsigned int’ arguments

hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp做如下修改

hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp	2016-05-10 22:04:53.681530187 +0200
@@ -4640,16 +4640,16 @@ CMTask::CMTask(uint worker_id,
 // For per-region info
 #define G1PPRL_TYPE_FORMAT            "   %-4s"
 #define G1PPRL_TYPE_H_FORMAT          "   %4s"
-#define G1PPRL_BYTE_FORMAT            "  "SIZE_FORMAT_W(9)
+#define G1PPRL_BYTE_FORMAT            "  " SIZE_FORMAT_W(9)
 #define G1PPRL_BYTE_H_FORMAT          "  %9s"
 #define G1PPRL_DOUBLE_FORMAT          "  %14.1f"
 #define G1PPRL_DOUBLE_H_FORMAT        "  %14s"
 
 // For summary info
-#define G1PPRL_SUM_ADDR_FORMAT(tag)    "  "tag":"G1PPRL_ADDR_BASE_FORMAT
-#define G1PPRL_SUM_BYTE_FORMAT(tag)    "  "tag": "SIZE_FORMAT
-#define G1PPRL_SUM_MB_FORMAT(tag)      "  "tag": %1.2f MB"
-#define G1PPRL_SUM_MB_PERC_FORMAT(tag) G1PPRL_SUM_MB_FORMAT(tag)" / %1.2f %%"
+#define G1PPRL_SUM_ADDR_FORMAT(tag)    "  " tag ":" G1PPRL_ADDR_BASE_FORMAT
+#define G1PPRL_SUM_BYTE_FORMAT(tag)    "  " tag ": " SIZE_FORMAT
+#define G1PPRL_SUM_MB_FORMAT(tag)      "  " tag ": %1.2f MB"
+#define G1PPRL_SUM_MB_PERC_FORMAT(tag) G1PPRL_SUM_MB_FORMAT(tag) " / %1.2f %%"
 
 G1PrintRegionLivenessInfoClosure::
 G1PrintRegionLivenessInfoClosure(outputStream* out, const char* phase_name)

 详见[PATCH RFC 3/5] fix build errors with gcc6 (java.net)

Unsupported major.minor version 52.0

默认安装的ant是openjdk8或11对于的ant版本,所以需要装合适的ant版本,ant下载地址 1选一个1.7的,下载并解压,见解压后的bin路径添加到环境变量PATH中

make: the '-j' option requires a positive integer argument

在报错的地方加了打印没发现命令有问题,最后没办法只好关闭多线程编译,

unset HOTSPOT_BUILD_JOBS

不得不说,问题真多,不如直接下一个openJDK7下载



这篇关于ubuntu20.4 openjdk7编译报错的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程