diff --git a/pkgs/development/compilers/graalvm/community-edition/buildGraalvm.nix b/pkgs/development/compilers/graalvm/community-edition/buildGraalvm.nix index 7d62411f5740190..858d7443ff6261e 100644 --- a/pkgs/development/compilers/graalvm/community-edition/buildGraalvm.nix +++ b/pkgs/development/compilers/graalvm/community-edition/buildGraalvm.nix @@ -63,22 +63,7 @@ let mkdir -p $out/bin ln -s ${lib.getDev musl}/bin/musl-gcc $out/bin/${stdenv.hostPlatform.system}-musl-gcc ''); - # GraalVM 23.0.0+ (i.e.: JDK 21.0.0+) clean-up the environment inside darwin - # So we need to re-added some env vars to make everything work correctly again - darwin-cc = (runCommandCC "darwin-cc" - { - nativeBuildInputs = [ makeWrapper ]; - buildInputs = [ darwin.apple_sdk.frameworks.Foundation zlib ]; - } '' - makeWrapper ${stdenv.cc}/bin/cc $out/bin/cc \ - --prefix NIX_CFLAGS_COMPILE_${stdenv.cc.suffixSalt} : "$NIX_CFLAGS_COMPILE" \ - --prefix NIX_LDFLAGS_${stdenv.cc.suffixSalt} : "$NIX_LDFLAGS" - ''); - binPath = lib.makeBinPath ( - lib.optionals stdenv.isDarwin [ darwin-cc ] - ++ lib.optionals useMusl [ musl-gcc ] - ++ [ stdenv.cc ] - ); + binPath = lib.makeBinPath (lib.optionals useMusl [ musl-gcc ] ++ [ stdenv.cc ]); runtimeLibraryPath = lib.makeLibraryPath ([ cups ] ++ lib.optionals gtkSupport [ cairo glib gtk3 ]); @@ -180,6 +165,14 @@ 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"; + echo "Ahead-Of-Time compilation" $out/bin/native-image -H:+UnlockExperimentalVMOptions -H:-CheckToolchain -H:+ReportExceptionStackTraces HelloWorld ./helloworld | fgrep 'Hello World'