babashka / clojure-lanterna

A Clojurey wrapper around the Lanterna terminal output library.
http://multimud.github.io/clojure-lanterna
12 stars 3 forks source link

console-tetris doesn't work with GraalVM #3

Open borkdude opened 3 years ago

borkdude commented 3 years ago

This project https://github.com/borkdude/console-tetris has a master branch which can be compiled with GraalVM (using script/compile). The master branch is still based on the original clojure-lanterna.

It is ported to our version of clojure-lanterna based on Lanterna 3 in the pod-babashka-lanterna branch. It works on the JVM:

lein run -m tetris.core

and also as a babashka pod (using https://github.com/babashka/pod-babashka-lanterna and bb master):

$ cp ~.../pod-babashka-lanterna/pod-babashka-lanterna .
$ bb -cp src -m tetris.core

however the GraalVM-compiled version doesn't work which is something to look into.

st3fan commented 3 years ago

I gave this a try with GraalVM 20.3.0 which was released a few days ago, but unfortunately running script/compile ends with a fatal exception that I have not yet been able to track down:

Fatal error:java.lang.NoSuchFieldError: SplittingMaxNumberOfSplitNodes
    at org.graalvm.compiler.truffle.compiler.SharedTruffleCompilerOptions.<clinit>(SharedTruffleCompilerOptions.java:191)
    at org.graalvm.compiler.truffle.compiler.SharedTruffleCompilerOptions_OptionDescriptors.get(SharedTruffleCompilerOptions_OptionDescriptors.java:17)
    at org.graalvm.compiler.truffle.compiler.SharedTruffleCompilerOptions_OptionDescriptors$1.next(SharedTruffleCompilerOptions_OptionDescriptors.java:552)
    at org.graalvm.compiler.truffle.compiler.SharedTruffleCompilerOptions_OptionDescriptors$1.next(SharedTruffleCompilerOptions_OptionDescriptors.java:543)
    at com.oracle.svm.hosted.option.HostedOptionParser.collectOptions(HostedOptionParser.java:78)
    at com.oracle.svm.hosted.option.HostedOptionParser.<init>(HostedOptionParser.java:62)
    at com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:238)
    at com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:509)
    at com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:115)
    at com.oracle.svm.hosted.NativeImageGeneratorRunner$JDK9Plus.main(NativeImageGeneratorRunner.java:541)
Error: Image build request failed with exit status 1
com.oracle.svm.driver.NativeImage$NativeImageError: Image build request failed with exit status 1
    at com.oracle.svm.driver.NativeImage.showError(NativeImage.java:1647)
    at com.oracle.svm.driver.NativeImage.build(NativeImage.java:1397)
    at com.oracle.svm.driver.NativeImage.performBuild(NativeImage.java:1358)
    at com.oracle.svm.driver.NativeImage.main(NativeImage.java:1317)
    at com.oracle.svm.driver.NativeImage$JDK9Plus.main(NativeImage.java:1829)

This is on macOS 10.15.7 with the following Java version:

openjdk version "11.0.4" 2019-07-16 LTS
OpenJDK Runtime Environment Corretto-11.0.4.11.1 (build 11.0.4+11-LTS)
OpenJDK 64-Bit Server VM Corretto-11.0.4.11.1 (build 11.0.4+11-LTS, mixed mode)
borkdude commented 3 years ago

@st3fan Could you try 20.2.0?

st3fan commented 3 years ago

I tried 20.2.0 and that seems to work correctly. I end up with:

-rwxr-xr-x  1 stefan  staff  27466344 Nov 21 09:10 tetris*

And I can run and play that version.

You did not mention the platform in this issue - do you want me to give it a try on Linux too?

borkdude commented 3 years ago

@st3fan Which branch of https://github.com/borkdude/console-tetris have you compiled?

st3fan commented 3 years ago

On the pod-babashka-lanterna branch, the project compiles and runs - the game runs, bricks are falling down. However, it doesn't handle terminal interactions well:

Is that the behaviour you saw too?

borkdude commented 3 years ago

@st3fan That's what I'm seeing too. Sorry for the late reply. I just updated the pod-babashka-lanterna branch to GraalVM 20.3.0.