question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Graalvm native-image support

See original GitHub issue

Hello, I’ve tried to build a native-image for simple setup with “http4s-blaze-core” % “0.21.4”. sbt 'show graalvm-native-image:packageBin'

and got errors:

[info] Set current project to Scala Seed Project (in build file:/Users/dmitriy/projects/scala/tmp/blaze-graalvm-test/)
[info] Wrote /Users/dmitriy/projects/scala/tmp/blaze-graalvm-test/target/scala-2.13/scala-seed-project_2.13-0.1.0-SNAPSHOT.pom
[info] Build on Server(pid: 72024, port: 59014)
[info] [Scala Seed Project:72024]    classlist:   5,490.36 ms,  2.79 GB
[info] [Scala Seed Project:72024]        (cap):   2,018.71 ms,  2.79 GB
[info] [Scala Seed Project:72024]        setup:   2,307.80 ms,  2.79 GB
[error] warning: unknown locality of class Lscala/util/hashing/MurmurHash3$accum$1;, assuming class is not local. To remove the warning report an issue to the library or language author. The issue is caused by Lscala/util/hashing/MurmurHash3$accum$1; which is not following the naming convention.
[info] [Scala Seed Project:72024]   (typeflow):   8,087.28 ms,  2.94 GB
[info] [Scala Seed Project:72024]    (objects):   9,236.84 ms,  2.94 GB
[info] [Scala Seed Project:72024]   (features):     314.38 ms,  2.94 GB
[info] [Scala Seed Project:72024]     analysis:  18,062.00 ms,  2.94 GB
[error] Error: Unsupported features in 3 methods
[error] Detailed message:
[error] Error: com.oracle.graal.pointsto.constraints.UnresolvedElementException: Discovered unresolved type during parsing: org.slf4j.impl.StaticLoggerBinder. 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.
[error] Trace: 
[error]         at parsing org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:418)
[error] Call path from entry point to org.slf4j.LoggerFactory.getILoggerFactory(): 
[error]         at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:408)[error]         at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:357)[error]         at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:383)[error]         at org.http4s.blaze.channel.nio1.NIO1SocketServerGroup.<init>(NIO1SocketServerGroup.scala:95)[error]         at org.http4s.blaze.channel.nio1.NIO1SocketServerGroup$.apply(NIO1SocketServerGroup.scala:47)[error]         at org.http4s.blaze.channel.nio1.NIO1SocketServerGroup$.fixedGroup(NIO1SocketServerGroup.scala:61)[error]         at example.Main$.main(Hello.scala:34)
[error]         at example.Main.main(Hello.scala)
[error]         at com.oracle.svm.core.JavaMainWrapper.runCore(JavaMainWrapper.java:151)
[error]         at com.oracle.svm.core.JavaMainWrapper.run(JavaMainWrapper.java:186)
[error]         at com.oracle.svm.core.code.IsolateEnterStub.JavaMainWrapper_run_5087f5482cc9a6abc971913ece43acb471d2631b(generated:0)
[error] Error: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: Invoke with MethodHandle argument could not be reduced to at most a single call or single field acce
ss. The method handle must be a compile time constant, e.g., be loaded from a `static final` field. Method that contains the method handle invocation: java.lang.invoke.MethodHandle.i
nvokeBasic()
[error] To diagnose the issue, you can add the option --report-unsupported-elements-at-runtime. The error is then reported at run time when the invoke is executed.
[error] Trace: 
[error]         at parsing java.lang.invoke.LambdaForm$MH/414370096.invoke_MT(LambdaForm$MH)
[error] Call path from entry point to java.lang.invoke.LambdaForm$MH/414370096.invoke_MT(Object, Object): 
[error]         at java.lang.invoke.LambdaForm$MH/414370096.invoke_MT(LambdaForm$MH)
[error]         at scala.runtime.Statics.releaseFence(Statics.java:148)
[error]         at org.http4s.blaze.channel.ChannelHead.<init>(ChannelHead.scala:9)
[error]         at org.http4s.blaze.channel.nio1.NIO1HeadStage.<init>(NIO1HeadStage.scala:111)
[error]         at org.http4s.blaze.channel.nio1.NIO1SocketServerGroup.fromKey$1(NIO1SocketServerGroup.scala:270)
[error]         at org.http4s.blaze.channel.nio1.NIO1SocketServerGroup.$anonfun$handleClientChannel$2(NIO1SocketServerGroup.scala:286)
[error]         at org.http4s.blaze.channel.nio1.NIO1SocketServerGroup$$Lambda$171/702574143.apply(Unknown Source)
[error]         at org.http4s.blaze.channel.nio1.SelectorLoop$$anon$2.run(SelectorLoop.scala:148)
[error]         at com.oracle.svm.core.jdk.RuntimeSupport.executeHooks(RuntimeSupport.java:144)
[error]         at com.oracle.svm.core.jdk.RuntimeSupport.executeStartupHooks(RuntimeSupport.java:89)
[error]         at com.oracle.svm.core.JavaMainWrapper.runCore(JavaMainWrapper.java:143)
[error]         at com.oracle.svm.core.JavaMainWrapper.run(JavaMainWrapper.java:186)
[error]         at com.oracle.svm.core.code.IsolateEnterStub.JavaMainWrapper_run_5087f5482cc9a6abc971913ece43acb471d2631b(generated:0)
[error] Error: com.oracle.svm.hosted.substitute.DeletedElementException: Unsupported type java.lang.invoke.MemberName is reachable: All methods from java.lang.invoke should have been
 replaced during image building.
[error] 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 tim
e.
[error] Trace: 
[error]         at parsing java.lang.invoke.MethodHandles$Lookup.findVirtual(MethodHandles.java:861)
[error] Call path from entry point to java.lang.invoke.MethodHandles$Lookup.findVirtual(Class, String, MethodType): 
[error]         no path found from entry point to target method
[error] Error: Use -H:+ReportExceptionStackTraces to print stacktrace of underlying exception
[error] Error: Image build request failed with exit status 1
[error] java.lang.RuntimeException: Failed to run List(native-image, --class-path, /Users/dmitriy/projects/scala/tmp/blaze-graalvm-test/target/scala-2.13/scala-seed-project_2.13-0.1.
0-SNAPSHOT.jar:/Users/dmitriy/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/http4s/blaze-core_2.13/0.14.12/blaze-core_2.13-0.14.12.jar:/Users/dmitriy/Library/Caches/Cou
rsier/v1/https/repo1.maven.org/maven2/org/typelevel/cats-core_2.13/2.1.1/cats-core_2.13-2.1.1.jar:/Users/dmitriy/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/http4s/ht
tp4s-core_2.13/0.21.4/http4s-core_2.13-0.21.4.jar:/Users/dmitriy/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-library/2.13.2/scala-library-2.13.2.jar:
/Users/dmitriy/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/typelevel/cats-macros_2.13/2.1.1/cats-macros_2.13-2.1.1.jar:/Users/dmitriy/Library/Caches/Coursier/v1/https
/repo1.maven.org/maven2/org/eclipse/jetty/alpn/alpn-api/1.1.3.v20160715/alpn-api-1.1.3.v20160715.jar:/Users/dmitriy/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/http4s
/http4s-blaze-core_2.13/0.21.4/http4s-blaze-core_2.13-0.21.4.jar:/Users/dmitriy/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/io/chrisdavenport/vault_2.13/2.0.0/vault_2.13-2.0.0.jar:/Users/dmitriy/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/typelevel/cats-effect_2.13/2.1.3/cats-effect_2.13-2.1.3.jar:/Users/dmitriy/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/com/twitter/hpack/1.0.2/hpack-1.0.2.jar:/Users/dmitriy/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/co/fs2/fs2-io_2.13/2.3.0/fs2-io_2.13-2.3.0.jar:/Users/dmitriy/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/slf4j/slf4j-api/1.7.25/slf4j-api-1.7.25.jar:/Users/dmitriy/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/http4s/parboiled_2.13/2.0.1/parboiled_2.13-2.0.1.jar:/Users/dmitriy/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/co/fs2/fs2-core_2.13/2.3.0/fs2-core_2.13-2.3.0.jar:/Users/dmitriy/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/typelevel/cats-kernel_2.13/2.1.1/cats-kernel_2.13-2.1.1.jar:/Users/dmitriy/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/http4s/blaze-http_2.13/0.14.12/blaze-http_2.13-0.14.12.jar:/Users/dmitriy/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/log4s/log4s_2.13/1.8.2/log4s_2.13-1.8.2.jar:/Users/dmitriy/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/io/chrisdavenport/unique_2.13/2.0.0/unique_2.13-2.0.0.jar:/Users/dmitriy/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/scodec/scodec-bits_2.13/1.1.14/scodec-bits_2.13-1.1.14.jar, -H:Name=Scala Seed Project, --no-fallback, example.Main), exit status: 1
[error]         at scala.sys.package$.error(package.scala:30)
[error]         at com.typesafe.sbt.packager.graalvmnativeimage.GraalVMNativeImagePlugin$.buildLocal(GraalVMNativeImagePlugin.scala:115)
[error]         at com.typesafe.sbt.packager.graalvmnativeimage.GraalVMNativeImagePlugin$.$anonfun$scopedSettings$7(GraalVMNativeImagePlugin.scala:76)
[error]         at scala.Function1.$anonfun$compose$1(Function1.scala:49)
[error]         at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:62)
[error]         at sbt.std.Transform$$anon$4.work(Transform.scala:67)
[error]         at sbt.Execute.$anonfun$submit$2(Execute.scala:281)
[error]         at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:19)
[error]         at sbt.Execute.work(Execute.scala:290)
[error]         at sbt.Execute.$anonfun$submit$1(Execute.scala:281)
[error]         at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:178)
[error]         at sbt.CompletionService$$anon$2.call(CompletionService.scala:37)
[error]         at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error]         at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[error]         at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error]         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[error]         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[error]         at java.lang.Thread.run(Thread.java:748)
[error] (Graalvm-native-image / packageBin) Failed to run List(native-image, --class-path, /Users/dmitriy/projects/scala/tmp/blaze-graalvm-test/target/scala-2.13/scala-seed-project_2.13-0.1.0-SNAPSHOT.jar:/Users/dmitriy/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/http4s/blaze-core_2.13/0.14.12/blaze-core_2.13-0.14.12.jar:/Users/dmitriy/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/typelevel/cats-core_2.13/2.1.1/cats-core_2.13-2.1.1.jar:/Users/dmitriy/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/http4s/http4s-core_2.13/0.21.4/http4s-core_2.13-0.21.4.jar:/Users/dmitriy/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-library/2.13.2/scala-library-2.13.2.jar:/Users/dmitriy/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/typelevel/cats-macros_2.13/2.1.1/cats-macros_2.13-2.1.1.jar:/Users/dmitriy/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/eclipse/jetty/alpn/alpn-api/1.1.3.v20160715/alpn-api-1.1.3.v20160715.jar:/Users/dmitriy/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/http4s/http4s-blaze-core_2.13/0.21.4/http4s-blaze-core_2.13-0.21.4.jar:/Users/dmitriy/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/io/chrisdavenport/vault_2.13/2.0.0/vault_2.13-2.0.0.jar:/Users/dmitriy/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/typelevel/cats-effect_2.13/2.1.3/cats-effect_2.13-2.1.3.jar:/Users/dmitriy/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/com/twitter/hpack/1.0.2/hpack-1.0.2.jar:/Users/dmitriy/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/co/fs2/fs2-io_2.13/2.3.0/fs2-io_2.13-2.3.0.jar:/Users/dmitriy/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/slf4j/slf4j-api/1.7.25/slf4j-api-1.7.25.jar:/Users/dmitriy/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/http4s/parboiled_2.13/2.0.1/parboiled_2.13-2.0.1.jar:/Users/dmitriy/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/co/fs2/fs2-core_2.13/2.3.0/fs2-core_2.13-2.3.0.jar:/Users/dmitriy/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/typelevel/cats-kernel_2.13/2.1.1/cats-kernel_2.13-2.1.1.jar:/Users/dmitriy/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/http4s/blaze-http_2.13/0.14.12/blaze-http_2.13-0.14.12.jar:/Users/dmitriy/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/log4s/log4s_2.13/1.8.2/log4s_2.13-1.8.2.jar:/Users/dmitriy/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/io/chrisdavenport/unique_2.13/2.0.0/unique_2.13-2.0.0.jar:/Users/dmitriy/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/org/scodec/scodec-bits_2.13/1.1.14/scodec-bits_2.13-1.1.14.jar, -H:Name=Scala Seed Project, --no-fallback, example.Main), exit status: 1
[error] Total time: 28 s, completed Apr 30, 2020 1:45:33 PM

Do you have any plans to implement native-image support?

You can find my test repo here: https://github.com/dkovalenko/blaze-graalvm-test To build using docker, without local native-image installation you can uncomment

// graalVMNativeImageGraalVersion := Some("20.0.0")

in build.sbt

Thank you.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:12 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
rossabakercommented, May 1, 2020

You’re using the raw blaze backend without any of the http4s wrapper. I would change the dependency to "org.http4s" %% “blaze-http” % “0.14.2”. http4s-blaze-core` pulls that in transitively, but it’s way more than you need.

I am not a GraalVM expert, but it looks like you’re failing on a missing slf4j backend. Someone mentioned the java.util.logging backend as a good choice. I would try also adding "org.slf4j" % "slf4j-jdk14" % "1.7.30" as a dependency.

There is work on documenting GraalVM use with the rest of http4s at https://github.com/http4s/http4s/issues/3299. You’re one level deeper, but may find more tips there.

0reactions
dkovalenkocommented, May 26, 2021

Thank you!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Native Image - GraalVM
Native Image supports JVM-based languages, e.g., Java, Scala, Clojure, Kotlin. The resulting image can, optionally, execute dynamic languages like ...
Read more >
GraalVM Native Image Support - Spring
1. Introducing GraalVM Native Images. GraalVM Native Images provide a new way to deploy and run Java applications. Compared to the Java Virtual ......
Read more >
Native Image - Oracle Help Center
Native Image supports JVM-based languages, e.g., Java, Scala, Clojure, Kotlin. ... Native Image for GraalVM Community Edition is licensed under the GPL 2 ......
Read more >
Native Image Support for Google Cloud Libraries - GitHub
Enables GraalVM Native Image support for Google Cloud Java Client Libraries. - GitHub - GoogleCloudPlatform/native-image-support-java: Enables GraalVM ...
Read more >
Revolutionizing Java with GraalVM Native Image - InfoQ
GraalVM Native Image enjoys significant adoption with support from leading Java frameworks such as Spring Boot, Micronaut, Quarkus, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found