Commit a98e9f48 authored by Thiago Kenji Okada's avatar Thiago Kenji Okada
Browse files

buildGraalvm: fix native-image warnings in installCheckPhase

parent f7a8b887
Loading
Loading
Loading
Loading
+5 −11
Original line number Diff line number Diff line
@@ -165,33 +165,27 @@ let
      echo "Testing GraalVM"
      $out/bin/java -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX:+UseJVMCICompiler HelloWorld | fgrep 'Hello World'

      # Workaround GraalVM issue where the builder does not have access to the
      # environment variables since 21.0.0
      # Only needed for native-image tests
      # https://github.com/oracle/graal/pull/6095
      # https://github.com/oracle/graal/pull/6095
      # https://github.com/oracle/graal/issues/7502
      export NATIVE_IMAGE_DEPRECATED_BUILDER_SANITATION="true";
      extraNativeImageArgs="$(export -p | sed -n 's/^declare -x \([^=]\+\)=.*$/ -E\1/p' | tr -d \\n)"

      echo "Ahead-Of-Time compilation"
      $out/bin/native-image -H:+UnlockExperimentalVMOptions -H:-CheckToolchain -H:+ReportExceptionStackTraces HelloWorld
      $out/bin/native-image -H:+UnlockExperimentalVMOptions -H:-CheckToolchain -H:+ReportExceptionStackTraces -march=compatibility $extraNativeImageArgs HelloWorld
      ./helloworld | fgrep 'Hello World'

      ${# --static is only available in Linux
      lib.optionalString (stdenv.isLinux && !useMusl) ''
        echo "Ahead-Of-Time compilation with -H:+StaticExecutableWithDynamicLibC"
        $out/bin/native-image -H:+UnlockExperimentalVMOptions -H:+StaticExecutableWithDynamicLibC HelloWorld
        $out/bin/native-image -H:+UnlockExperimentalVMOptions -H:+StaticExecutableWithDynamicLibC -march=compatibility $extraNativeImageArgs HelloWorld
        ./helloworld | fgrep 'Hello World'

        echo "Ahead-Of-Time compilation with --static"
        $out/bin/native-image --static HelloWorld
        $out/bin/native-image $extraNativeImageArgs -march=compatibility --static HelloWorld
        ./helloworld | fgrep 'Hello World'
      ''}

      ${# --static is only available in Linux
      lib.optionalString (stdenv.isLinux && useMusl) ''
        echo "Ahead-Of-Time compilation with --static and --libc=musl"
        $out/bin/native-image --static HelloWorld --libc=musl
        $out/bin/native-image $extraNativeImageArgs -march=compatibility --libc=musl --static HelloWorld
        ./helloworld | fgrep 'Hello World'
      ''}