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

Make native-image generation work with any Scala version #13

Merged
merged 2 commits into from
Sep 13, 2020

Conversation

olafurpg
Copy link
Member

Fixes #12.

Previously, native-image generation failed if the user had an older
version of Scala like 2.12.10. Now, native-image generation works with
any Scala version thanks to improvements in the upstream native-image
substitutions. The substitutions are now conditionally enabled based on
the presence of releaseFence() methods. The substitions now have no
effect if they are not needed.

Olafur Pall Geirsson added 2 commits September 13, 2020 09:16
Previously, the `nativeImage` task failed with the follow error when
using Scala 2.12.10

```
[error] Error: substitution target for scala.meta.internal.svm_subs.Target_scala_runtime_Statics is not loaded. Use field `onlyWith` in the `TargetClass` annotation to make substitution only active when needed.
```

Now, the error message is
```
outdated Scala version. To fix this problem, add `scalaVersion := "2.12.12"` (or any version newer than 2.12.12) to build.sbt
```

A better fix would be to use the `onlyWith` field as recommended in the
native-image error message. However, I failed to get this working.
Fixes scalameta#12.

Previously, native-image generation failed if the user had an older
version of Scala like 2.12.10. Now, native-image generation works with
any Scala version thanks to improvements in the upstream native-image
substitutions. The substitutions are now conditionally enabled based on
the presence of `releaseFence()` methods. The substitions now have no
effect if they are not needed.
@olafurpg olafurpg merged commit 55487b0 into scalameta:master Sep 13, 2020
@olafurpg olafurpg deleted the issue-12 branch September 13, 2020 09:40
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

Successfully merging this pull request may close these issues.

simple example fails to build native image
1 participant