JDK 19+21 early-access build is reproducible

John Neffenger john at status6.com
Sun May 8 16:47:28 UTC 2022

On 5/8/22 7:42 AM, Bernhard M. Wiedemann wrote:
> however building JDK is still hard, so

I admit I've been doing it for a long time, but I find OpenJDK, after 
about version 9, to be one of the easiest open-source projects to build.

You might be picking up any old Java version on your system to use in 
the build. Instead, set the JAVA_HOME environment variable explicitly to 
the Boot JDK, described below.

An explanation of the build procedure is found here:

Building the JDK

Pay particular attention to the main heading called "Reproducible 
Builds." It suggests starting with a build script as follows:

export SOURCE_DATE_EPOCH=946684800
bash configure --with-version-opt=adhoc

The exact script I'm using is a "scriptlet" that can run under either 
the Bash or Dash shell and is found in the section called 
'override-build' in this YAML file:


and contains:

SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)
# Option '--enable-warnings-as-errors=no' for armhf
bash configure \
   --enable-warnings-as-errors=no \
   --enable-javac-server=no \
   --with-vendor-name="Snap Build" \
   --with-vendor-url="https://snapcraft.io/openjdk" \
   --with-vendor-bug-url="https://github.com/jgneff/openjdk/issues" \
   --with-version-pre=ea \
   --with-version-opt=snap \
   --with-version-build="${SNAPCRAFT_PROJECT_VERSION#*+}" \
   --with-extra-cflags="$CFLAGS" \
   --with-extra-cxxflags="$CXXFLAGS" \
   --with-extra-ldflags="$LDFLAGS" \
make images docs
cd build/linux-*-server-release/images || exit

The package dependencies are listed under the section 'build-packages', 
and the only environment variable you might want to set is JAVA_HOME, 
which points to the Boot JDK. The minimum version required for the Boot 
JDK is either the previous version or, for an early-access build, the 
most recently released version.

Note: For reproducible builds, you must build JDK 19+21 or later with 
JDK 19+21 or later.


More information about the rb-general mailing list