JDK-8306884 : Building WebKit on Linux is not deterministic
  • Type: Bug
  • Component: javafx
  • Sub-Component: build
  • Affected Version: jfx21
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • OS: linux_ubuntu
  • CPU: x86_64
  • Submitted: 2023-04-26
  • Updated: 2023-05-09
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdUnresolved
Related Reports
Blocks :  
Description
Building the WebKit native library on Linux is not deterministic. The library, called 'libjfxwebkit.so', differs from one build to the next on the same system with the same project path.

SYSTEM / OS / JAVA RUNTIME INFORMATION

The following build tools were used:

- cmake version 3.26.3
- gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
- OpenJDK Runtime Environment (build 19.0.2+7-44)
- Apache Ant(TM) version 1.10.13 compiled on January 4 2023

STEPS TO REPRODUCE

Set the environment variables by sourcing the file called 'jfxbuild.env'. Then run the Bash script called 'release.sh' to build two copies of a simulated JavaFX release and run all of the unit tests.

Both files are included in the SOURCE section below.

EXPECTED RESULTS

When the build script completes, the following command should show no output:

$ diff -qr build5 build6

ACTUAL RESULT

Instead, the command shows differences in the file 'libjfxwebkit.so' and in the archives that include it:

$ diff -qr build5 build6
Files build5/jmods/javafx.web.jmod and build6/jmods/javafx.web.jmod differ
Files build5/modular-sdk/modules_libs/javafx.web/libjfxwebkit.so and build6/modular-sdk/modules_libs/javafx.web/libjfxwebkit.so differ
Files build5/publications/javafx.web-linux.jar and build6/publications/javafx.web-linux.jar differ
Files build5/sdk/lib/libjfxwebkit.so and build6/sdk/lib/libjfxwebkit.so differ

SOURCE CODE FOR AN EXECUTABLE TEST CASE

The file 'jfxbuild.env' that sets the environment variables:

-----------
#!/bin/bash
# Sets up the environment for building JavaFX
syspath=/usr/sbin:/usr/bin:/sbin:/bin

export CMAKE_HOME=$HOME/opt/cmake-3.26.3-linux-x86_64
export JAVA_HOME=$HOME/opt/jdk-19.0.2
export ANT_HOME=$HOME/opt/apache-ant-1.10.13

SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)
export SOURCE_DATE_EPOCH

# JDK_HOME and PATH are required by the build
export JDK_HOME=$JAVA_HOME
export PATH=$ANT_HOME/bin:$JAVA_HOME/bin:$CMAKE_HOME/bin:$syspath
-----------

The file 'release.sh' that runs the two builds and the unit tests:

-----------
#!/bin/bash
# Creates two production builds and runs unit tests
trap exit INT TERM
set -o errexit

dir1=build5
dir2=build6

if [ -d $dir1 ] || [ -d $dir2 ]; then
    printf "Target directories exist: %s %s\n" $dir1 $dir2 >&2
    exit 1
fi

gradle () (
    set -o xtrace
    bash gradlew --no-daemon \
        -PCONF=Release -PPROMOTED_BUILD_NUMBER=12 \
        -PHUDSON_BUILD_NUMBER=101 -PHUDSON_JOB_NAME=jfx \
        -PCOMPILE_WEBKIT=true -PCOMPILE_MEDIA=true -PBUILD_LIBAV_STUBS=true \
        "$@"
)

printf "SOURCE_DATE_EPOCH=%s\n" "$SOURCE_DATE_EPOCH"
for dir in $dir1 $dir2; do
    gradle cleanAll
    gradle sdk jmods javadoc
    mv build "$dir"
done
gradle sdk jmods javadoc test
-----------

WORKAROUND

None.