Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8306886

Building macOS libraries can be non-deterministic

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P4
    • tbd
    • jfx21
    • javafx
    • None
    • x86_64
    • os_x

    Description

      Building the native libraries on macOS is not always deterministic. Some of the shared libraries can be different from one build to the next on the same system with the same project path, such as 'libgstreamer-lite.dylib', 'libjavafx_font.dylib', and 'libjavafx_iio.dylib'.

      SYSTEM / OS / JAVA RUNTIME INFORMATION

      The following build tools were used:

      - cmake version 3.26.3
      - Command Line Tools for Xcode 14.2 version 14.2.0.0.1.1668646533
      - 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 'actions.sh' to build two copies of a simulated JavaFX GitHub Actions build and run 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 build3 build4

      ACTUAL RESULT

      Instead, the command shows differences in some of the shared libraries and in the archives that include them:

      $ diff -qr build3 build4
      Files build3/artifacts/bundles/javafx-jmods-21.zip and build4/artifacts/bundles/javafx-jmods-21.zip differ
      Files build3/artifacts/bundles/javafx-sdk-21.zip and build4/artifacts/bundles/javafx-sdk-21.zip differ
      Files build3/artifacts/javafx-jmods-21/javafx.graphics.jmod and build4/artifacts/javafx-jmods-21/javafx.graphics.jmod differ
      Files build3/artifacts/javafx-sdk-21/lib/libjavafx_font.dylib and build4/artifacts/javafx-sdk-21/lib/libjavafx_font.dylib differ
      Files build3/artifacts/javafx-sdk-21/lib/libjavafx_iio.dylib and build4/artifacts/javafx-sdk-21/lib/libjavafx_iio.dylib differ
      Files build3/javafx-exports.zip and build4/javafx-exports.zip differ
      Files build3/jmods/javafx.graphics.jmod and build4/jmods/javafx.graphics.jmod differ
      Files build3/modular-sdk/modules_libs/javafx.graphics/libjavafx_font.dylib and build4/modular-sdk/modules_libs/javafx.graphics/libjavafx_font.dylib differ
      Files build3/modular-sdk/modules_libs/javafx.graphics/libjavafx_iio.dylib and build4/modular-sdk/modules_libs/javafx.graphics/libjavafx_iio.dylib differ
      Files build3/publications/javafx.graphics-mac.jar and build4/publications/javafx.graphics-mac.jar differ
      Files build3/sdk/lib/libjavafx_font.dylib and build4/sdk/lib/libjavafx_font.dylib differ
      Files build3/sdk/lib/libjavafx_iio.dylib and build4/sdk/lib/libjavafx_iio.dylib 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-macos-universal/CMake.app/Contents
      export JAVA_HOME=$HOME/opt/jdk-19.0.2.jdk/Contents/Home
      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 'actions.sh' that runs the two builds and the unit tests:

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

      dir1=build3
      dir2=build4

      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 "$@"
      )

      printf "SOURCE_DATE_EPOCH=%s\n" "$SOURCE_DATE_EPOCH"
      for dir in $dir1 $dir2; do
          gradle cleanAll
          gradle all
          mv build "$dir"
      done
      gradle all test -x :web:test
      -----------

      WORKAROUND

      None.

      Attachments

        1. libjavafx_font-dylib.html
          135 kB
          John Neffenger
        2. libjavafx_iio-dylib.html
          158 kB
          John Neffenger

        Issue Links

          Activity

            People

              kcr Kevin Rushforth
              jgneff John Neffenger
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: