alexei-matveev / instaparse-demo

Test AOT of Instaparse
Eclipse Public License 1.0
0 stars 1 forks source link

Doesn't run with graalvm-ce-1.0.0-rc15 #2

Open jeroenvandijk opened 5 years ago

jeroenvandijk commented 5 years ago

After applying #1 and running lein uberjar I got a new error with GraalVM:

 /Users/jeroen/bin/graalvm-ce-1.0.0-rc15/Contents/Home/bin/native-image --report-unsupported-elements-at-runtime  -jar target/uberjar/instaparse-demo-0.1.0-SNAPSHOT.jar
Build on Server(pid: 90464, port: 52386)
[instaparse-demo-0.1.0-SNAPSHOT:90464]    classlist:     346.41 ms
[instaparse-demo-0.1.0-SNAPSHOT:90464]        (cap):     792.30 ms
[instaparse-demo-0.1.0-SNAPSHOT:90464]        setup:   1,170.98 ms
Warning: class initialization of class instaparse.demo failed with exception java.lang.NoClassDefFoundError: clojure/lang/Var. This class will be initialized at run time because either option --report-unsupported-elements-at-runtime or option --allow-incomplete-classpath is used for image building. Use the option --delay-class-initialization-to-runtime=instaparse.demo to explicitly request delayed initialization of this class.
[instaparse-demo-0.1.0-SNAPSHOT:90464]     analysis:   1,678.13 ms
Warning: Abort stand-alone image build. com.oracle.graal.pointsto.constraints.UnresolvedElementException: Discovered unresolved type during parsing: clojure.lang.Var. To diagnose the issue you can use the --allow-incomplete-classpath option. The missing type is then reported at run time when it is accessed the first time.
Detailed message:
Trace:
    at parsing instaparse.demo.main(Unknown Source)
Call path from entry point to instaparse.demo.main(String[]):
    at instaparse.demo.main(Unknown Source)
    at com.oracle.svm.core.JavaMainWrapper.run(JavaMainWrapper.java:153)
    at com.oracle.svm.core.code.IsolateEnterStub.JavaMainWrapper_run_5087f5482cc9a6abc971913ece43acb471d2631b(generated:0)

Build on Server(pid: 90464, port: 52386)
[instaparse-demo-0.1.0-SNAPSHOT:90464]    classlist:     219.97 ms
[instaparse-demo-0.1.0-SNAPSHOT:90464]        (cap):     707.10 ms
[instaparse-demo-0.1.0-SNAPSHOT:90464]        setup:   1,026.61 ms
[instaparse-demo-0.1.0-SNAPSHOT:90464]   (typeflow):   1,757.64 ms
[instaparse-demo-0.1.0-SNAPSHOT:90464]    (objects):     464.16 ms
[instaparse-demo-0.1.0-SNAPSHOT:90464]   (features):     138.84 ms
[instaparse-demo-0.1.0-SNAPSHOT:90464]     analysis:   2,422.26 ms
[instaparse-demo-0.1.0-SNAPSHOT:90464]     universe:     131.17 ms
[instaparse-demo-0.1.0-SNAPSHOT:90464]      (parse):     436.35 ms
[instaparse-demo-0.1.0-SNAPSHOT:90464]     (inline):     718.58 ms
[instaparse-demo-0.1.0-SNAPSHOT:90464]    (compile):   3,099.51 ms
[instaparse-demo-0.1.0-SNAPSHOT:90464]      compile:   4,479.08 ms
[instaparse-demo-0.1.0-SNAPSHOT:90464]        image:     314.90 ms
[instaparse-demo-0.1.0-SNAPSHOT:90464]        write:     131.00 ms
[instaparse-demo-0.1.0-SNAPSHOT:90464]      [total]:   8,776.14 ms
Warning: Image 'instaparse-demo-0.1.0-SNAPSHOT' is a fallback-image

At runtime

./instaparse-demo-0.1.0-SNAPSHOT aaabbb
Exception in thread "main" java.lang.NoClassDefFoundError: clojure/lang/Var
    at instaparse.demo.<clinit>(Unknown Source)
Caused by: java.lang.ClassNotFoundException: clojure.lang.Var
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 1 more
alexei-matveev commented 5 years ago

See a more serious warning on Clojure 1.10 I just added at the top of the README ... Yours might be a Mac Issue. Just tried it with GraalVM RC15:

$ ~/opt/graalvm/bin/native-image --report-unsupported-elements-at-runtime -jar ./target/uberjar/instaparse-demo-0.1.0-SNAPSHOT-standalone.jar 
Build on Server(pid: 8881, port: 42837)*
[instaparse-demo-0.1.0-SNAPSHOT-standalone:8881]    classlist:   2,538.37 ms
[instaparse-demo-0.1.0-SNAPSHOT-standalone:8881]        (cap):   1,287.93 ms
[instaparse-demo-0.1.0-SNAPSHOT-standalone:8881]        setup:   2,945.34 ms
[instaparse-demo-0.1.0-SNAPSHOT-standalone:8881]   (typeflow):  14,907.31 ms
[instaparse-demo-0.1.0-SNAPSHOT-standalone:8881]    (objects):  10,805.63 ms
[instaparse-demo-0.1.0-SNAPSHOT-standalone:8881]   (features):     473.09 ms
[instaparse-demo-0.1.0-SNAPSHOT-standalone:8881]     analysis:  26,904.79 ms
[instaparse-demo-0.1.0-SNAPSHOT-standalone:8881]     universe:     695.16 ms
[instaparse-demo-0.1.0-SNAPSHOT-standalone:8881]      (parse):   2,146.40 ms
[instaparse-demo-0.1.0-SNAPSHOT-standalone:8881]     (inline):   3,233.39 ms
[instaparse-demo-0.1.0-SNAPSHOT-standalone:8881]    (compile):  17,061.65 ms
[instaparse-demo-0.1.0-SNAPSHOT-standalone:8881]      compile:  23,797.18 ms
[instaparse-demo-0.1.0-SNAPSHOT-standalone:8881]        image:   2,479.27 ms
[instaparse-demo-0.1.0-SNAPSHOT-standalone:8881]        write:     341.70 ms
[instaparse-demo-0.1.0-SNAPSHOT-standalone:8881]      [total]:  59,906.53 ms
$ ./instaparse-demo-0.1.0-SNAPSHOT-standalone aaabbbbb
Hello, World!
[:S [:AB [:A "a" "a" "a"] [:B "b" "b" "b" "b" "b"]]]
$ ~/opt/graalvm/bin/native-image --version
GraalVM Version 1.0.0-rc15 CE

Uberjar was compiled with Ubuntu OpenJDK, they seem to mock up the version:

$ java -version
openjdk version "10.0.2" 2018-07-17
OpenJDK Runtime Environment (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.4)
OpenJDK 64-Bit Server VM (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.4, mixed mode)