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.

Support GraalVM native image on Scala 3

See original GitHub issue

To build a cats-effect 3 app with Scala 3 and GraalVM native image, one currently has to set some configuration options, otherwise the build falls back to a version that requires a JDK.

This is what the native-image agent generated for me:

[
{
  "name":"cats.effect.unsafe.IORuntimeCompanionPlatform",
  "fields":[{"name":"0bitmap$1", "allowUnsafeAccess":true}]
},
{
  "name":"cats.effect.unsafe.WorkStealingThreadPool",
  "fields":[{"name":"0bitmap$1", "allowUnsafeAccess":true}]
},
{
  "name":"java.lang.invoke.VarHandle"
},
{
  "name":"sun.misc.Unsafe",
  "allDeclaredFields":true
}
]

(passed with -H:ReflectionConfigurationFiles)

Maybe we can include some version of this in the jar itself, so users don’t need to bother with these options: https://www.graalvm.org/reference-manual/native-image/BuildConfiguration/

Here’s a sample app built with this config: https://github.com/kubukoz/graalvm-native-ce3/ (note that the options aren’t necessary when building with Scala 2.13.6)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
kubukozcommented, Jun 1, 2021

Maybe some of this could be attached to the dotty runtime? 😄

0reactions
djspiewakcommented, Aug 15, 2021

Agreed. I think this works fine.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fails to build native image for Scala 3 application which uses ...
Describe the issue Native image fails for Scala 3 application with kind-projector plugin enabled due to being unable to locate needed ...
Read more >
GraalVM native-image with Scala 3 reflection hell - Reddit
Although I had relatively good experiences with GraalVM Native-Image and Scala 2.13, I am now having trouble porting my applications to Scala 3....
Read more >
Native Image - GraalVM
Write efficient, more secure, and instantly scalable cloud native Java applications ... Native Image is supported by all the leading microservice frameworks ...
Read more >
GraalVM Native Image · Cats Effect - Typelevel
Luckily, GraalVM Native Image has full support for both Proxy and POSIX signals. Cats Effect jars contain extra metadata that makes building native...
Read more >
compiling the client with GraalVM Native Image - YouTube
Episode 3 of the series! This one is focused on adding support for generating a GraalVM native image for our client.
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