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

scala-examples: issue with building and running scala-native substitution demo #97

Open
neomatrix369 opened this issue Oct 11, 2021 · 5 comments

Comments

@neomatrix369
Copy link
Contributor

On the back of the PR #93, building and running the scala-native substitution demo gives an issue after following the steps in the README were followed, see https://github.com/graalvm/graalvm-demos/tree/master/scala-examples/scalac-native#native-image-of-the-scala-compiler.

Running the step ./scalac-image.sh gives the below error:

root@b41b00dc8fec:/graalvm-demos/scala-examples/scalac-native# ./scalac-image.sh -H:+ReportExceptionStackTraces
[scalac:220]    classlist:  25,162.81 ms,  0.96 GB
Error: Main entry point class 'scala.tools.nsc.Main' not found.
com.oracle.svm.core.util.UserError$UserException: Main entry point class 'scala.tools.nsc.Main' not found.
	at com.oracle.svm.core.util.UserError.abort(UserError.java:68)
	at com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:323)
	at com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:543)
	at com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:119)
	at com.oracle.svm.hosted.NativeImageGeneratorRunner$JDK9Plus.main(NativeImageGeneratorRunner.java:573)
[scalac:220]      [total]:  25,444.44 ms,  0.96 GB
Error: Image build request failed with exit status 1

The original contributor to the example has been contacted and help has been sought to help fix this issue when running with the latest version of GraalVM CE.

@neomatrix369
Copy link
Contributor Author

A helped PR from @vjovanov #98, thanks

@neomatrix369
Copy link
Contributor Author

neomatrix369 commented Oct 12, 2021

@vjovanov just merged your commit to the newly built image, and re-ran the above steps, I did take care of GRAALVM_HOME and JAVA_HOME to point to the right binaries (GraalVM 21.2.0 Java 11 and Java 8 respectively - this is correct?), but we are expecting this error, right?

./scalac-image.sh -H:+ReportExceptionStackTraces
[scalac:141]    classlist:  40,863.00 ms,  0.93 GB
Error: Main entry point class 'scala.tools.nsc.Main' not found.
com.oracle.svm.core.util.UserError$UserException: Main entry point class 'scala.tools.nsc.Main' not found.
	at com.oracle.svm.core.util.UserError.abort(UserError.java:68)
	at com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:323)
	at com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:543)
	at com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:119)
	at com.oracle.svm.hosted.NativeImageGeneratorRunner$JDK9Plus.main(NativeImageGeneratorRunner.java:573)
[scalac:141]      [total]:  41,248.44 ms,  0.93 GB
Error: Image build request failed with exit status 1

I'll debug further from here to see why this is still happening.

Does it need any specific build of Java 8 (OpenJDK 8 will do?)?

@olyagpl
Copy link
Member

olyagpl commented Oct 12, 2021

If you use GraalVM on Java 11 or 17, you would see this notice printed:
This demo works only with Java 8. Set your JAVA_HOME to a JDK 8 version.
I've merged the PR from
Vojin Jovanovic: #98:

@olyagpl olyagpl closed this as completed Oct 12, 2021
@neomatrix369
Copy link
Contributor Author

I didn't see this notice This demo works only with Java 8. Set your JAVA_HOME to a JDK 8 version.

Also would be good to add this note to the README page of the demo :D

@olyagpl
Copy link
Member

olyagpl commented Oct 12, 2021

I'm reopening the issue. I’ve just tested on Java 8 GraalVM and it fails to compile scalac:

Error: com.oracle.svm.hosted.substitute.DeletedElementException: Unsupported method java.lang.invoke.MethodHandleNatives.setCallSiteTargetNormal(CallSite, MethodHandle) is reachable
To diagnose the issue, you can add the option --report-unsupported-elements-at-runtime. The unsupported element is then reported at run time when it is accessed the first time.

@olyagpl olyagpl reopened this Oct 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants