ubuntu编译openJDK源码

先看官方教程

0、先安装版本控制工具mercurial
sudo apt-get install mercurial
1、获取openJDK源码 (也可以直接到官网下载源码,不过推荐还是直接到仓库获取)
cd YourOpenJDK
//获取源码
bash ./get_source.sh
2、
cd YourOpenJDK
bash ./make/scripts/hgforest.sh status
3、//进行配置
bash ./configure
报错提示:
configure: Could not find a valid Boot JDK. You might be able to fix this by running ‘sudo apt-get install openjdk-7-jdk’.
configure: This might be fixed by explicitely setting –with-boot-jdk
configure: error: Cannot continue
configure exiting with result code 1
旧版ubuntu没有安装SDK,按照说明安装即可,我安装了JDK8
sudo apt-get install openjdk-8-jdk
继续bash ./configure
又报错,按照提示安装缺失的组件即可
Build performance tip: ccache gives a tremendous speedup for C++ recompilations.
You do not have ccache installed. Try installing it.
You might be able to fix this by running ‘sudo apt-get install ccache‘.
全部安装通过之后,输入make all进行编译, i74720QM+32G 初次编译大概15分钟左右
最后VM虚拟机中的Ubuntu14.04成功编译了
./java -version
openjdk version “1.8.0-internal”
OpenJDK Runtime Environment (build 1.8.0-internal-forgot_2017_06_03_01_14-b00)
OpenJDK 64-Bit Server VM (build 25.0-b70, mixed mode)
而Ubuntu16.04卡在这步骤,暂时无解
## Starting jdk
make[1]: BuildJdk.gmk: No such file or directory
make[1]: *** No rule to make target ‘BuildJdk.gmk’. Stop.
/home/forgot/Documents/openjdk/jdk8u//make/Main.gmk:115: recipe for target ‘jdk-only’ failed
make: *** [jdk-only] Error 2
make时遇到问题:
ERROR: echo “*** This OS is not supported:” ‘uname -a’; exit 1;
在make参数后面添加 :
 DISABLE_HOTSPOT_OS_VERSION_CHECK=OK
make DISABLE_HOTSPOT_OS_VERSION_CHECK=OK
https://aur.tuna.tsinghua.edu.cn/pkgbase/java8-openjdk/?comments=all

发表评论