Fork me on GitHub
#graalvm
<
2020-07-01
>
borkdude07:07:17

@lee I am using classes from svm. I'm not sure what GraalVM SDK vs svm is. import com.oracle.svm.core.annotate.Substitute; import com.oracle.svm.core.annotate.TargetElement; import com.oracle.svm.core.annotate.TargetClass; import com.oracle.svm.core.jdk.JDK11OrLater;

lread11:07:30

Problem is that tools deps includes tar.gz files from org.graalvm.nativeimgage/svm in classpath which causes native-image to fail. I looked at deps within org.graalvm.nativeimage/svm and found org.graalvm.sdk/graal-sdk which seems to have all we really need.

borkdude11:07:42

@lee What I don't understand is that the SDK jar doesn't mention any svm jars:

ls_jar.clj  org.graalvm.sdk/graal-sdk 20.1.0 | grep svm
while I'm importing these:
import com.oracle.svm.core.annotate.Substitute;

borkdude11:07:57

Maybe the dependency isn't needed once it's compiled? But that's not how Java classes work right?

borkdude11:07:27

@lee What happens if you leave out the graal-sdk as well?

lread11:07:38

I’ll play around a little more and get back to you.

lread14:07:59

Ya I was out to lunch with thinking org.graalvm.sdk/graal-sdk helped. If I leave it out as well, my compile still works. If I look at output from native-image I see that there is a lib/svm/builder/svm.jar from Graal’s install dir included for both native-image’s -cp and -imagecp. This svm.jar contains all classes you listed above.

borkdude14:07:47

that explains it

borkdude14:07:22

so I guess I can ditch the dependency then

lread14:07:41

Ya, I think you can.

borkdude14:07:07

still the svm.jar would be the same version in the dependency as in Graal's install, so don't think it's needed and the problem might be elsewhere

borkdude14:07:37

and declaring the dependency is stating a truth: it IS dependent on that

lread14:07:09

I guess it is more like a provided dep then. It would be harmless if tools deps handled native deps like lein seems to, but tools deps does not.

lread14:07:36

If leaving it in is correct then https://github.com/borkdude/clj-reflector-graal-java11-fix README could be updated on tools dep usage. Happy to PR, lemme know.

borkdude14:07:50

PR would be good

lread14:07:22

Ok I shall do PR for README.

borkdude14:07:45

what's the root of the issue though? is it something with tools.deps?

lread14:07:28

Ya, you found it.

borkdude16:07:39

@lee Thanks for clearing up the mystery.

lread16:07:43

Glad to do my part. @aviflax was the one who started the ball rolling (thanks @aviflax!).

avi17:07:12

Wow, thanks so much Lee for figuring this out and documenting it for others! :hugging_face:

mikeb21:07:05

Has anyone been able to get a graal compiled binary working with dynamodb?