oracle / graal

GraalVM compiles Java applications into native executables that start instantly, scale fast, and use fewer compute resources 🚀
https://www.graalvm.org
Other
20.34k stars 1.63k forks source link

"Error: The GraalVM directory /home/Programs/Graalvm/22.2.0 is invalid." when trying to do: "gu install native-image" #5069

Open rubyFeedback opened 2 years ago

rubyFeedback commented 2 years ago

Hey there GraalVM devs,

I just did the following command on my linux box:

gu install native-image

This command normally works when I install native-image. (On a side node, perhaps in the future this could be bundled as-is in regards to native-image; but I made another issue request for that, in regards to "fat binaries", and it's normally not a big issue, so this is an aside.)

However had, the output on the commandline states this:

Error: The GraalVM directory /home/Programs/Graalvm/22.2.0 is invalid.

Ok. Now here is my problem:

What does "is invalid" even mean? What does that mean in the context? I can create files in that directory. I can remove files there. I can do everything normally possible. So what does this error mean?

I assume that there must be something wrong, perhaps I set something incorrectly. But graalvm respectively gu native-image should TELL me what the issue is. How should I google for this error? Have aliens infiltrated my computer? Is a cat stuck in the mainframe? Is some ENV setting wrong? It could be anything really.

So, TL;DR summary:

Please consider making better error messages. In the context of the error message here, TELL the user at the least ROUGHLY what could be wrong, if it is a permission issue or a file missing or some other problem - let the user know.

Thanks for reading.

fniephaus commented 2 years ago

The error message appears to be printed when the directory does not exist, or does not contain a release file, or does not contain a lib/installer/components subdirectory: https://github.com/oracle/graal/blob/947235d692779add62f56d3ea5e8f5a699428846/vm/src/org.graalvm.component.installer/src/org/graalvm/component/installer/ComponentInstaller.java#L550-L555

I agree that this is a poor error message because it's not immediately actionable for users. In general, we'd like to improve such errors throughout all of GraalVM, contributions and issues are always welcome!

Could you please figure out why you get this error message and maybe share a reproducer with us (e.g., how did you acquire your GraalVM installation and what's causing the error to show up)?

DSouzaM commented 1 year ago

I ran into this problem on OS X on 22.2.0, but maybe for a different reason than the original poster.

The error I get is:

Error: The GraalVM directory /Library/Java/JavaVirtualMachines/graalvm-ee-java17-22.2.0/Contents is invalid.

My Graal home is /Library/Java/JavaVirtualMachines/graalvm-ee-java17-22.2.0/Contents/Home/. This Home directory contains the expected file + directory.

Maybe this directory layout is unexpected by gu. I followed the OS X installation instructions to install it, so presumably it should be supported.

As a temporary workaround, I was able to supply a VM property to point to the real Graal home:

gu --vm.DGRAALVM_HOME_DEV=/Library/Java/JavaVirtualMachines/graalvm-ee-java17-22.2.0/Contents/Home/ <cmd>