Skip to main content

jdk编译

· 2 min read

第一步

拉取代码

git clone https://github.com/openjdk/jdk.git  

第二步

本地版本:

我本地的jdk版本是17

java -version
openjdk version "17.0.4" 2022-07-19

jdk 只能由上一个版本自举,所以必须要切到下一个大版本 ,我本地是jdk17 ,所以要切到jdk 18

## 切换到jdk18
git checkout jdk-18+37

## 生成makefile

./configure --with-debug-level=slowdebug --with-extra-cflags="-Wno-nonnull -Wno-maybe-uninitialized -Wno-free-nonheap-object"
## 2个线程同时编译

make JOBS=2 CONF=linux-x86_64-server-slowdebug

相关错误

onfigure: error: Could not find all X11 headers (shape.h Xrender.h Xrandr.h XTest.h Intrinsic.h). You might be able to fix this by running 'sudo apt-get install libx11-dev libxext-dev libxrender-dev libxrandr-dev libxtst-dev libxt-dev'.
configure exiting with result code 1

解决方案:

sudo apt-get install libx11-dev libxext-dev libxrender-dev libxrandr-dev libxtst-dev libxt-dev
configure: error: Could not find cups! You might be able to fix this by running 'sudo apt-get install libcups2-dev'. 
configure exiting with result code 1

解决方案:

sudo apt-get install libcups2-dev

相关阅读