Skip to content
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

graalvm native-image error #623

Open
ohuu opened this issue Feb 14, 2022 · 5 comments
Open

graalvm native-image error #623

ohuu opened this issue Feb 14, 2022 · 5 comments

Comments

@ohuu
Copy link

ohuu commented Feb 14, 2022

I'm trying out Skunk with graalvm's native-image feature. It's failing and I've narrowed it down to when I call Session.prepare. I've also noticed that Metals can't get any info on that function when hovering over it, perhaps these problems are related?

The error from GraalVM is below.

I took a look at Skunk source code to see if I could find anything obvious that might be causing the error and all I can think is that there appears to be some cross compilation going on here, is there anything loading classes at runtime based on the platform or anything? GraalVM really dislikes that for obvious reasons.

It would be absolutely amazing to get Skunk working in a native image. All the other database libraries rely on JDBC and I haven't been able to get them to work.

#13 84.97 Fatal error:java.lang.InternalError: Enclosing method not found
#13 84.98       at java.base/java.lang.Class.getEnclosingMethod(Class.java:1296)
#13 84.98       at java.base/sun.reflect.generics.scope.ClassScope.computeEnclosingScope(ClassScope.java:50)
#13 84.98       at java.base/sun.reflect.generics.scope.AbstractScope.getEnclosingScope(AbstractScope.java:77)
#13 84.98       at java.base/sun.reflect.generics.scope.AbstractScope.lookup(AbstractScope.java:95)
#13 84.98       at java.base/sun.reflect.generics.factory.CoreReflectionFactory.findTypeVariable(CoreReflectionFactory.java:110)
#13 84.98       at java.base/sun.reflect.generics.visitor.Reifier.visitTypeVariableSignature(Reifier.java:165)
#13 84.99       at java.base/sun.reflect.generics.tree.TypeVariableSignature.accept(TypeVariableSignature.java:43)
#13 84.99       at java.base/sun.reflect.generics.visitor.Reifier.reifyTypeArguments(Reifier.java:68)
#13 84.99       at java.base/sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:138)
#13 84.99       at java.base/sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:49)
#13 84.99       at java.base/sun.reflect.generics.repository.ClassRepository.computeSuperInterfaces(ClassRepository.java:117)
#13 84.99       at java.base/sun.reflect.generics.repository.ClassRepository.getSuperInterfaces(ClassRepository.java:95)
#13 84.99       at java.base/java.lang.Class.getGenericInterfaces(Class.java:1137)
#13 84.99       at com.oracle.svm.hosted.analysis.NativeImagePointsToAnalysis.fillGenericInfo(NativeImagePointsToAnalysis.java:343)
#13 84.99       at com.oracle.svm.hosted.analysis.NativeImagePointsToAnalysis.checkType(NativeImagePointsToAnalysis.java:140)
#13 84.99       at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
#13 84.99       at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177)
#13 84.99       at java.base/java.util.AbstractList$RandomAccessSpliterator.forEachRemaining(AbstractList.java:720)
#13 84.99       at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
#13 85.00       at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
#13 85.00       at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
#13 85.00       at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
#13 85.00       at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
#13 85.00       at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:497)
#13 85.00       at com.oracle.svm.hosted.analysis.NativeImagePointsToAnalysis.checkObjectGraph(NativeImagePointsToAnalysis.java:125)
#13 85.00       at com.oracle.graal.pointsto.PointsToAnalysis.checkObjectGraph(PointsToAnalysis.java:676)
#13 85.00       at com.oracle.graal.pointsto.PointsToAnalysis.finish(PointsToAnalysis.java:644)
#13 85.00       at com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:704)
#13 85.00       at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:529)
#13 85.00       at com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:488)
#13 85.00       at com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:403)
#13 85.00       at com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:569)
#13 85.00       at com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:122)
#13 85.00       at com.oracle.svm.hosted.NativeImageGeneratorRunner$JDK9Plus.main(NativeImageGeneratorRunner.java:599)
#13 85.00 [accuheat3:25]      [total]:  83,712.94 ms,  2.26 GB
#13 85.02 # Printing build artifacts to: /app/accuheat3.build_artifacts.txt
#13 85.97 Error: Image build request failed with exit status 1
#13 85.97 com.oracle.svm.driver.NativeImage$NativeImageError: Image build request failed with exit status 1
#13 85.98       at com.oracle.svm.driver.NativeImage.showError(NativeImage.java:1762)
#13 85.98       at com.oracle.svm.driver.NativeImage.build(NativeImage.java:1473)
#13 85.98       at com.oracle.svm.driver.NativeImage.performBuild(NativeImage.java:1434)
#13 85.98       at com.oracle.svm.driver.NativeImage.main(NativeImage.java:1421)
@ohuu
Copy link
Author

ohuu commented Feb 15, 2022

In order to find out exactly what's causing the error I need to change the source in skunk, I've cloned the library but I'm struggling to create a project that uses the cloned skunk project as a dependency in SBT. I've tried the obvious things:

lazy val skunk = project.in(file("../skunk"))
lazy val root = project.in(file(".")).dependsOn(skunk)

but that doesn't work. How can I depend on skunk so I can track down this error?

@davidlar
Copy link

I get the same error when I update to Scala 3. I did some debugging of the native build.

The problem is scala/scala3#13568 and could probably be fixed by replacing the anonymous inner classes extending PreparedQuery for example.

@armanbilge
Copy link
Member

The problem is lampepfl/dotty#13568 and could probably be fixed by replacing the anonymous inner classes extending PreparedQuery for example.

So if I'm understanding correctly, scala/scala3#13568 can cause Graal Native image to break? If so, that sounds like something that should be reported as an issue on the dotty repo.

@davidlar
Copy link

A new release built on Scala 3.3.4 (or 3.5.1) will fix this!

@igor-ramazanov
Copy link
Contributor

3.3.4 released, haven't tested yet, but should be done, unless there are other issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants