OpenJDK 编译问题

1. 操作系统建议 Ubuntu 16

直接使用 VMware 安装 Ubuntu 16 编译

ubuntu1604 使用 Clion 调试 openjdk8 - 知乎

configure

bash configure --with-target-bits=64 --with-boot-jdk=/home/jcb/jdk1.7.0_80 --with-debug-level=slowdebug --enable-debug-symbols ZIP_DEBUGINFO_FILES=0 --with-extra-cxxflags="-Wno-error" --with-extra-cflags="-Wno-error"

2. 各种依赖的问题

Could not find X11 libraries

configure: error: Could not find X11 libraries. You might be able to fix this by running 'sudo apt-get install libX11-dev libxext-dev libxrender-dev libxtst-dev libxt-dev'.

这里可能需要将 libX11-dev 修改为 libx11-dev【小写】

configure: error: Could not find alsa! You might be able to fix this by running 'sudo apt-get install libasound2-dev'. 

sudo apt-get install libx11-dev libxext-dev libxrender-dev libxtst-dev libxt-dev -y
sudo apt-get install libcups2-dev -y
sudo apt-get install libfreetype6-dev -y
sudo apt-get install libasound2-dev -y
sudo apt-get install ccache -y

freetype 问题

linux - Compile JDK8 error.''Could not find freetype'' - Stack Overflow

./configure --with-freetype-include=/usr/include/freetype2 --with-freetype-lib=/usr/lib/x86_64-linux-gnu

/usr/bin/make: invalid option

/usr/bin/make: invalid option -- '8'
/usr/bin/make: invalid option -- '/'
/usr/bin/make: invalid option -- 'a'
/usr/bin/make: invalid option -- '/'
/usr/bin/make: invalid option -- 'c'
Usage: make [options] [target] ...
...省略部分信息...
This program built for x86_64-pc-linux-gnu
Report bugs to <bug-make@gnu.org>
/home/john/openjdk-8-build/jdk8/hotspot/make/linux/makefiles/top.make:91: recipe for target 'ad_stuff' failed
make[5]: *** [ad_stuff] Error 2
/home/john/openjdk-8-build/jdk8/hotspot/make/linux/Makefile:289: recipe for target 'debug' failed
make[4]: *** [debug] Error 2
Makefile:216: recipe for target 'generic_build2' failed
make[3]: *** [generic_build2] Error 2
Makefile:167: recipe for target 'debug' failed
make[2]: *** [debug] Error 2
HotspotWrapper.gmk:44: recipe for target '/home/john/openjdk-8-build/jdk8/build/linux-x86_64-normal-server-slowdebug/hotspot/_hotspot.timestamp' failed
make[1]: *** [/home/john/openjdk-8-build/jdk8/build/linux-x86_64-normal-server-slowdebug/hotspot/_hotspot.timestamp] Error 2
/home/john/openjdk-8-build/jdk8//make/Main.gmk:108: recipe for target 'hotspot-only' failed
make: *** [hotspot-only] Error 2

解决办法:

方法一:更换 make 为 4.0 版本以下(未测试)方法二:修改 hotspot/make/linux/makefiles/adjust-mflags.sh

约第 67 行增加一个 I,修改

image

问题原因:

make 版本的问题,4.0 以后 make-I 和-j 选项混乱,具体看参考资料

参考资料:

https://stackoverflow.com/questions/21246042/scrambled-arguments-when-building-openjdk
https://www.mail-archive.com/build-dev@openjdk.java.net/msg10780.html

  • Java

    Java 是一种可以撰写跨平台应用软件的面向对象的程序设计语言,是由 Sun Microsystems 公司于 1995 年 5 月推出的。Java 技术具有卓越的通用性、高效性、平台移植性和安全性。

    3206 引用 • 8217 回帖

相关帖子

欢迎来到这里!

我们正在构建一个小众社区,大家在这里相互信任,以平等 • 自由 • 奔放的价值观进行分享交流。最终,希望大家能够找到与自己志同道合的伙伴,共同成长。

注册 关于
请输入回帖内容 ...