graalvm

Discuss GraalVM related topics. Use clojure 1.10.2 or newer for all new projects. Contribute to https://github.com/clj-easy/graal-docs and https://github.com/BrunoBonacci/graalvm-clojure. GraalVM slack: https://www.graalvm.org/slack-invitation/.
borkdude 2020-07-01T07:34:17.012100Z

@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;

lread 2020-07-01T11:30:30.017500Z

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.

borkdude 2020-07-01T11:44:42.018300Z

@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;

borkdude 2020-07-01T11:44:57.018700Z

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

borkdude 2020-07-01T11:45:27.019Z

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

lread 2020-07-01T11:50:38.019600Z

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

lread 2020-07-01T14:14:59.024Z

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.

borkdude 2020-07-01T14:16:22.024300Z

ah

borkdude 2020-07-01T14:16:47.024500Z

that explains it

borkdude 2020-07-01T14:17:22.024800Z

so I guess I can ditch the dependency then

lread 2020-07-01T14:17:41.025300Z

Ya, I think you can.

borkdude 2020-07-01T14:18:07.025800Z

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

borkdude 2020-07-01T14:18:37.026500Z

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

lread 2020-07-01T14:21:09.028200Z

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.

lread 2020-07-01T14:26:36.030400Z

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.

borkdude 2020-07-01T14:27:50.030700Z

PR would be good

lread 2020-07-01T14:28:22.031200Z

Ok I shall do PR for README.

borkdude 2020-07-01T14:32:45.031500Z

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

borkdude 2020-07-01T14:34:08.031700Z

ah I see: https://clojurians.slack.com/archives/C6QH853H8/p1593559436160400

lread 2020-07-01T14:50:28.034500Z

Ya, you found it.

borkdude 2020-07-01T16:10:39.034900Z

@lee Thanks for clearing up the mystery.

lread 2020-07-01T16:36:43.036500Z

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

avi 2020-07-01T17:04:12.037100Z

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

mikeb 2020-07-01T21:29:05.037800Z

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