linux编译jdk7时,遇到的坑

一、如何安装

跟着这个老哥做,它写得很清晰。地址

二、遇到的坑

2.1 Unsupported major.minor version 52.0

原因:

ant-1.10.3需要jdk1.8的支持

解决办法:

吧ant改为ant-1.7.1就行了(应该还有些版本也行)。
参考

2.2 Checksum onbuild/jaxp/drop/bundles/jaxp145_01.zip is d41d8cd98f00b204e9800998ecf8427e, not 32394c780c8fb5e29775f623525993c0,

原因:

发生这个问题时,我查看了所谓的jaxp145_01.zip,说的是zip可它根本就没下载,而且是一个纯文本的文件。
我查了下,出现这个原因要嘛文件被损坏了,要么文件被人篡改了。

解决办法:

  1. 于是在/etc/profile下将下载改为了false:
    export ALLOW_DOWNLOADS=false
  2. 且设置了drop下来的包的路径(你自己设,实现把所需要的包下下来)
    export ALT_DROPS_DIR=/home/fengli/Downloads/MyOpenJdk7/drops
  3. 我将需要的包下载来放在了/home/fengli/Downloads/MyOpenJdk7/drops目录下。也就是这四个文件:
    在这里插入图片描述
    我是参考这个网站搞的,参考

2.3 echo “*** This OS is not supported:” uname -a; exit 1;

解决方法:

sudo vim openjdk/hotspot/make/linux/Makefile
注释掉以下三行
#ifeq ( ( D I S A B L E H O T S P O T O S V E R S I O N C H E C K ) (DISABLE_HOTSPOT_OS_VERSION_CHECK) (EMPTY_IF_NOT_SUPPORTED),)
#$(QUIETLY) >&2 echo “*** This OS is not supported:” uname -a; exit 1;
#endif

参考

2.4 C++11 requires a space between literal and string macro [-Werror=literal-suffix]

https://github.com/konstantinmiller/dashp2p/issues/3

2.5 error: “__LEAF” redefined [-Werror]

https://www.jianshu.com/p/32dc1a850e23

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

http://www.cnblogs.com/iou123lg/p/9696039.html

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

http://mail.openjdk.java.net/pipermail/build-dev/2016-May/017170.html

2.8 error: cannot convert ‘bool’ to ‘methodOop {aka methodOopDesc*}’ in return if (cpool->cache() == NULL) return false; // nothing to load yet

2.9 /usr/bin/ld: cannot find -lstdc++;/usr/bin/ld: cannot find -ljvm

使用
这个问题在那个README里面提到了,我查了一下,make时,用这个命令:

make STATIC_CXX=false

还不行的话,可以这样试一下:
ld -lstdc++ -verbose
看是什么原因,没有.so连接,就加连接。

find /usr -name “lstdc++*”
查看有那些满足条件的文件。
http://blog.sina.com.cn/s/blog_401aa0540101axrr.html

2.10 Failed to write core dump. Core dumps have been disabled. To enable core dumping, try “ulimit -c unlimited” before starting Java again

解决方法:

在命令行输入 :ulimit -c unlimited

三、参考文献

基本步骤
https://www.jianshu.com/p/32dc1a850e23

Unsupported major.minor version 52.0
https://groups.google.com/forum/#!topic/app-inventor-open-source-dev/qo1gX1SnR6U

ant下载地址
https://archive.apache.org/dist/ant/binaries/

猜你喜欢

转载自blog.csdn.net/wobushixiaobailian/article/details/83794764