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

Cannot build GraalVM native image for Scala 2.13 #11837

Closed
plokhotnyuk opened this issue Dec 25, 2019 · 2 comments
Closed

Cannot build GraalVM native image for Scala 2.13 #11837

plokhotnyuk opened this issue Dec 25, 2019 · 2 comments
Labels

Comments

@plokhotnyuk
Copy link

It works fine for a simple hello world sample with Scala 2.11.12/2.12.10:

$ git clone -b graalvm-ce-java8-native-image --single-branch [email protected]:plokhotnyuk/jsoniter-scala.git
...
$ cd jsoniter-scala/jsoniter-scala-examples
...
$ sbt clean +assembly
...
$ /usr/lib/jvm/graalvm-ce-java8/bin/native-image --no-server --no-fallback --allow-incomplete-classpath -H:UnsafeAutomaticSubstitutionsLogLevel=3 -H:+ReportExceptionStackTraces --report-unsupported-elements-at-runtime -jar target/scala-2.12/jsoniter-scala-examples-assembly-0.1.0-SNAPSHOT.jar
...
$ time ./jsoniter-scala-examples-assembly-0.1.0-SNAPSHOT
Hello, World!

real	0m0,001s
user	0m0,001s
sys	0m0,000s

But it cannot be compiled to the native image with Scala 2.13.1:

$ /usr/lib/jvm/graalvm-ce-java8/bin/native-image --no-server --no-fallback --allow-incomplete-classpath -H:UnsafeAutomaticSubstitutionsLogLevel=3 -H:+ReportExceptionStackTraces --report-unsupported-elements-at-runtime -jar target/scala-2.13/jsoniter-scala-examples-assembly-0.1.0-SNAPSHOT.jar
...
/tmp/SVM-2002383037456502398/jsoniter-scala-examples-assembly-0.1.0-SNAPSHOT.o:(.data+0xb0): undefined reference to `Java_java_lang_invoke_MethodHandle_invokeBasic'
/tmp/SVM-2002383037456502398/jsoniter-scala-examples-assembly-0.1.0-SNAPSHOT.o:(.data+0x188): undefined reference to `Java_java_lang_invoke_MethodHandle_invokeBasic'
/tmp/SVM-2002383037456502398/jsoniter-scala-examples-assembly-0.1.0-SNAPSHOT.o:(.data+0x198): undefined reference to `Java_java_lang_invoke_MethodHandle_invokeBasic'
/tmp/SVM-2002383037456502398/jsoniter-scala-examples-assembly-0.1.0-SNAPSHOT.o:(.data+0x200): undefined reference to `Java_java_lang_invoke_MethodHandle_invokeBasic'
/tmp/SVM-2002383037456502398/jsoniter-scala-examples-assembly-0.1.0-SNAPSHOT.o:(.data+0x250): undefined reference to `Java_sun_misc_Unsafe_defineAnonymousClass'
/tmp/SVM-2002383037456502398/jsoniter-scala-examples-assembly-0.1.0-SNAPSHOT.o:(.data+0x328): undefined reference to `Java_java_lang_invoke_MethodHandle_invokeBasic'
/tmp/SVM-2002383037456502398/jsoniter-scala-examples-assembly-0.1.0-SNAPSHOT.o:(.data+0x538): undefined reference to `Java_java_lang_invoke_MethodHandle_invokeBasic'
/tmp/SVM-2002383037456502398/jsoniter-scala-examples-assembly-0.1.0-SNAPSHOT.o:(.data+0x600): undefined reference to `Java_java_lang_invoke_MethodHandle_invokeBasic'
/tmp/SVM-2002383037456502398/jsoniter-scala-examples-assembly-0.1.0-SNAPSHOT.o:(.data+0x670): undefined reference to `Java_java_lang_invoke_MethodHandle_invokeBasic'
/tmp/SVM-2002383037456502398/jsoniter-scala-examples-assembly-0.1.0-SNAPSHOT.o:(.data+0x7b8): undefined reference to `Java_sun_misc_Unsafe_defineClass'
/tmp/SVM-2002383037456502398/jsoniter-scala-examples-assembly-0.1.0-SNAPSHOT.o:(.data+0x918): undefined reference to `Java_java_lang_invoke_MethodHandle_invokeBasic'
/tmp/SVM-2002383037456502398/jsoniter-scala-examples-assembly-0.1.0-SNAPSHOT.o:(.data+0xaf0): undefined reference to `Java_java_lang_invoke_MethodHandle_invokeBasic'
/tmp/SVM-2002383037456502398/jsoniter-scala-examples-assembly-0.1.0-SNAPSHOT.o:(.data+0xbd0): undefined reference to `Java_java_lang_invoke_MethodHandle_invokeBasic'
collect2: error: ld returned 1 exit status

	at com.oracle.svm.hosted.image.NativeBootImageViaCC.write(NativeBootImageViaCC.java:382)
	at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:652)
	at com.oracle.svm.hosted.NativeImageGenerator.lambda$run$0(NativeImageGenerator.java:445)
	at java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1386)
	at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
	at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
	at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
	at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
Error: Image build request failed with exit status 1
@SethTisue
Copy link
Member

SethTisue commented Dec 30, 2019

do you have reason to believe this is actionable in the scala/scala repo? (regardless, the report is good to have)

@SethTisue SethTisue added this to the Backlog milestone Dec 30, 2019
@plokhotnyuk
Copy link
Author

W/A is using of the --initialize-at-build-time option!

@olafurpg Thanks a lot for the hint, Ólafur!

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

No branches or pull requests

2 participants