-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reflection NPE using native-image
on a compile Clojure jar
#385
Comments
@Gastove Have you tried doing Like:
I've had good luck with this where I previously was getting similar errors using the |
@Gastove thank you for trying out GraalVM. That NPE was reported before and fixed in the meantime. The NPE was hiding another issue: trying to load a jar from a static initializer, which I suspect might happen when you include a dependency on another Clojure library in your second configuration. See this section on limitations regarding static initializers. You should try building from source (see the quick start guide), the NPE should go away and you should get a more helpful error message. |
Ah, well. @ckampfe, your approach gets me to a |
Please report them and we'll try to fix. Is the |
I'm hitting When I try to build Graal from source, it goes like this:
Now, from the
The first time I ran this, this worked for a while, compiling C libs and working merrily; now, unless I do an
But the stack traces and error reporting are... intense. Rather than paste them here, please peruse this gist for the full output: https://gist.github.com/Gastove/288ba000ba73052ab383a9393318a77c What other information can I provide? What can I do to help? |
(Ah, just for reference: I'm using Fedora 27.) |
Just to be clear, @cstancu is referring to the downloads at the bottom of the page under "JVMCI JDK Downloads". |
@dougxc AH. Okay, that makes more sense. I did see that instruction/requirement, and thought I had followed it -- clearly, I got confused. Will re-try and report back. |
Okay, yep: this works considerably better. I don't have a clear error message about what, specifically, is using a static initializer, and in perfect world one would be very nice -- would make working around it much easier. But! Still happy to get this far, and I appreciate the guidance. I personally would consider this closed. |
@Gastove what does the error message look like? We are working on improving the error messages and make them more actionable. |
@cstancu holy moly -- I don't..... understand why, but I'm seeing two different stacktraces built out of the same jar; one is very helpful, the other less so. In both cases, here's the command I'm using to execute
The first stack trace looks something like this:
So, I know what the problem is, but not where in the code to dig to fix it. The other goes like so:
This is absolutely perfect -- it doesn't ever hit code I actually wrote, but it does point to a specific call stack within a specific library I can now work around. I do not at all understand why I got one, then the other. Possibly I didn't manage to kill the build server after rebuilding graal myself? |
It is "normal" to get multiple "stack traces" during image building. Each of them corresponds to an unsupported feature error. When the analysis runs we don't stop on the first discovered unsupported feature but keep going on unexplored code paths. This way you get a complete image of all the problems. So it has nothing to do with the build server; you would get the same output if you run without the server. When we report unsupported features discovered by the analysis the stack traces are not actually execution stack traces, but constructed call paths from the entry method to the location of the issue, i.e., the I actually see three different unsupported feature errors in the output you pasted: The The The Thank you for providing these details. This helps us understand how the error messages are perceived by people not familiar with the internals of the system and improve them by clearing out the confusing parts. |
I do know that Clojure isn't officially supported per se; that said, this particular failure case surprised me, so I figured I'd stop by and mention it.
If I have a pure Clojure standard library project (e.g. no dependencies), and compile it into a jar, I can build it into a native image flawlessly with Graal. It's fast, starts instantly -- all I ever dreamed of. This works whether I try it on a regular or shaded/fat/uber jar (which makes sense; with no dependencies, they should be basically identical).
On the other hand, if I include a dependency, on another Clojure library, and compile that, the resulting jar always NPEs during
native-image
generation, regardless of how I try to do it. I've tried building a shaded/fat/uber jar; I've also tried building a normal jar and making sure all dependencies are on the classpath. No dice. Regardless of what I do, I get what for me is a somewhat obtuse stack trace -- which is to say, I've got no clue on earth where to start digging in to help fix it.Here's the verbose build output:
Thanks for the amazing project :D Let me know if there's something helpful I can to do help sort this out.
The text was updated successfully, but these errors were encountered: