Saturday, December 18, 2021

Building latest OpenJDK on Windows (Dec 2021)

Prerequisites:

Windows 64 bit. I'm using Windows 10, but anything Vista+ should work.

Install Cygwin

Download setup script https://cygwin.com/setup-x86_64.exe

Run the script with additional packages selected:

setup-x86_64.exe -P git -P diffutils -P binutils -P make -P m4 -P cpio -P gawk -P file -P zip -P unzip -P procps-ng -P autoconf -P automake -P ssh -P wget

Install Visual Studio 2019

Community version is free for OpenSource development, and is sufficient to build OpenJDK.

Download installer here:

https://docs.microsoft.com/en-us/visualstudio/releases/2019/release-notes

Install C++ development tools. Default installation location worked fine for me.

Clone the repository

Use Cygwin's git. Repository can be found here:

https://github.com/openjdk/jdk

 

The remaining steps are the same between Windows and Linux:

Download boot JDK

Binaries can be found here:

http://jdk.java.net/

Download and unpack the latest JDK. Save the full (cygwin) path, you will need it later.

Download JTREG (optional)

Required for running tests, not needed for building.

Binaries can be found here:

https://ci.adoptopenjdk.net/view/Dependencies/job/dependency_pipeline/lastSuccessfulBuild/artifact/jtreg/

Download and unpack latest version (jtregtip.tar.gz). Save the full (cygwin) path.

Download GoogleTest (optional)

Required for running a subset of tests, not needed for building.

git clone -b release-1.8.1 https://github.com/google/googletest

Save the full (cygwin) path.

Download JMH (optional)

Required for running microbenchmarks, not needed for building or regression testing.

Starting from the directory where you cloned the JDK, run in Cygwin shell:

sh make/devkit/createJMHBundle.sh

After this JMH will be available under build/jmh/jars

Build

From the cloned JDK directory, run in cygwin shell:

bash configure --with-boot-jdk=/path/to/boot/jdk --with-jtreg=/path/to/jtreg --with-gtest=/path/to/googletest --with-jmh=build/jmh/jars

If configure succeeds, run make to build the JDK.

 

Later after changing branches or updating the code, make may ask you to run configure again. In this case usually the following is sufficient:

make reconfigure clean images

Sources / additional information:

https://stuefe.de/posts/build-openjdk-on-windows/

https://github.com/openjdk/jdk/blob/master/doc/building.md

https://github.com/openjdk/jdk/blob/master/doc/testing.md

No comments:

Post a Comment