0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

JDKビルド備忘録[Ubuntu 22.04]

Last updated at Posted at 2023-10-03

おねがい

この記事を参考にしてビルドに失敗した方は後学のためにコメントをいただけますと幸いです。
質問にもお答えできる限りお答えしますので是非コメントを残してください。

環境

OS : Ubuntu 22.04.3 LTS

ビルド対象JDK

  • openjdk jdk17(Public archive)

手順

1. 資材ダウンロード

$ mkdir ~/work
$ cd ~/work
$ git clone git@github.com:openjdk/jdk17.git

2. ビルド用JDK配備

※すでにjavaコマンドが使えるなら不要

$ cd /usr/local/lib
$ sudo wget https://github.com/adoptium/temurin16-binaries/releases/download/jdk-16.0.2%2B7/OpenJDK16U-jdk_x64_linux_hotspot_16.0.2_7.tar.gz
$ sudo tar xf OpenJDK16U-jdk_x64_linux_hotspot_16.0.2_7.tar.gz
$ sudo rm OpenJDK16U-jdk_x64_linux_hotspot_16.0.2_7.tar.gz
$ vim ~/.bashrc
#########################
# 以下を追記
export JAVA_HOME=/usr/local/lib/jdk-16.0.2+7
export PATH=$JAVA_HOME/bin:$PATH
#########################
$ source ~/.bashrc
$ java --version
openjdk 16.0.2 2021-07-20
OpenJDK Runtime Environment Temurin-16.0.2+7 (build 16.0.2+7)
OpenJDK 64-Bit Server VM Temurin-16.0.2+7 (build 16.0.2+7, mixed mode, sharing)

3. 必要パッケージのインストール

※環境によって過不足が発生する可能性あり

$ sudo apt -y install build-essential autoconf make zip unzip file
$ sudo apt -y install libfreetype6-dev libcups2-dev libx11-dev libxext-dev libxrender-dev libxrandr-dev libasound2-dev libffi-dev libxt-dev libxtst-dev libfontconfig-dev

4. configureの適応

$ cd ~/work/jdk17
$ bash configure

5. ビルド実行

$ make images

6. 成果物確認

$ ./build/*/images/jdk/bin/java -version
openjdk version "17-internal" 2021-09-14
OpenJDK Runtime Environment (build 17-internal+0-adhoc.tabatad.jdk17)
OpenJDK 64-Bit Server VM (build 17-internal+0-adhoc.tabatad.jdk17, mixed mode, sharing)

苦労した点

  • 不足しているパッケージがわからず、bash configureを実行して不足がでれば追加する手法を取らざるを得なかった。

参考

  • OpenJDK jdk17 building.md

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?