-
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
Cryptic parsing error messages with --link-at-build-time
and incomplete classpath
#6253
Comments
Hey @zakkak I'm back in this game... Unfortunately since I updated some dependencies and restructure my project I'm no longer able to build it with native-image. I use the same dependency (gdv.xport at version 6.5.0 now). In a small example like your reproducer (https://github.com/zakkak/mandrel/tree/2023-04-27-fix-6253) all works fine but in a larger project like described in #5711 it fails. To build your reproducer I changed the following things:
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-jexl3</artifactId>
<version>3.2.1</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
native-image \
--no-fallback \
-H:+ReportExceptionStackTraces \
--link-at-build-time \
--initialize-at-build-time=net.sf.oval.ogn.ObjectGraphNavigatorJXPathImpl\\,\
net.sf.oval.expression\\,org.apache.logging.log4j.util.OsgiServiceLocator \
-jar target/reproducer-1.0-SNAPSHOT.jar Errror message: Caused by: com.oracle.graal.pointsto.constraints.UnresolvedElementException: Discovered unresolved method during parsing: gdv.xport.feld.Feld.getInhalt(). This error is reported at image build time because class de.j21p.pandora.core.adapter.input.InputGdvXport is registered for linking at image build time by command line
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.reportUnresolvedElement(SharedGraphBuilderPhase.java:298)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.handleUnresolvedMethod(SharedGraphBuilderPhase.java:288)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.handleUnresolvedInvoke(SharedGraphBuilderPhase.java:244) Now I have some trouble... Is it possible to get your pr compiled on my machine? FYI: I didn't compile graalvm by myself for now. Or to get any other support by you? |
Hi @knuspertante for building GraalVM from source you may refer to https://github.com/oracle/graal/tree/master/vm#readme In short:
|
@zakkak thanks a lot! You are my hero ;-) |
As discussed in #6507 (comment)
|
Works around oracle#6253 till a proper JVCMI fix is available. Closes: oracle#6253
Works around oracle#6253 till a proper JVCMI fix is available. Closes: oracle#6253
Works around oracle#6253 till a proper JVCMI fix is available. Closes: oracle#6253
Works around oracle#6253 till a proper JVCMI fix is available. Closes: oracle#6253
I have tested this with GraalVM for JDK 17 (23.0.0-dev), GraalVM for JDK 20 (23.0.0-dev) and GraalVM for JDK 21 (23.1.0-dev) and it looks like this issue is no longer a valid one. The actually unresolved type is properly reported. The corresponding error messages for each version are: GraalVM for JDK 17
By the log message GraalVM for JDK 20 and GraalVM for JDK 21
By the log message NoteThe wording could potentially be improved since |
Unfortunately we are seeing this again with GraalVM for JDK 21 and Update: Unfortunately the existing reproducer doesn't work, so I need to create a new one to confirm the issue and further investigate. |
Works around oracle#6253 till a proper JVCMI fix is available.
The new reproducer is:
|
Works around oracle#6253 till a proper JVCMI fix is available.
Works around oracle#6253 till a proper JVCMI fix is available.
Describe the issue
Parsing errors may be cryptic when using
--link-at-build-time
and incomplete classpath.For instance if a
Class A
cannot be initialized due to aNoClassDefFoundError
caused by a missing dependency, the user will be presented with anUnresolvedElementException
stating that some method ofClass A
is unresolved, but it won't provide any additional info on the cause.Steps to reproduce the issue
Describe GraalVM and your environment:
More details
The reproducer will result in build errors like the following:
not providing any indication about the reason the said method is unresolved (in this case the absence of
org/mozilla/javascript/Scriptable
from the classpath.#6245 was meant to address this but it looks like there are cases that still escape.
The issue seems to be caused when Graal ignores
NoClassDefFoundError
s ingraal/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/phases/SharedGraphBuilderPhase.java
Lines 223 to 228 in e9893c0
this results in the eager resolution failure to not get logged as the cause of the
UnresolvedElement
.cc @cstancu
The text was updated successfully, but these errors were encountered: