Description
Version(s)
1.0.4
Describe the bug
The default versions of Scala Native (and Scala.js) are behind the latest releases. Because they are not guaranteed to be forward-compatible, that means that libraries and toolkits built with the latest Native/JS releases may not work with scala-cli out-of-the-box.
To Reproduce
//> using toolkit typelevel:latest
//> using platform native
import cats.effect.*
object App extends IOApp.Simple:
def run = IO.unit
$ scala-cli foo.scala
Compiling project (Scala 3.3.0, Scala Native)
Compiled project (Scala 3.3.0, Scala Native)
[info] Linking (11491 ms)
[info] Checking intermediate code (quick) (300 ms)
[info] Discovered 1744 classes and 11262 methods
[info] Optimizing (debug mode) (6478 ms)
[info] Generating intermediate code (6400 ms)
[info] Produced 16 files
[info] Compiling to native code (4600 ms)
[error] /usr/bin/ld: /workspace/sandbox/.scala-build/sandbox_05adbf4d1c_919f107979-b0bbeb3ef8/native/native-code-nativelib_native0.4_3-0.4.15-1/scala-native/gc/immix/Marker.c.o: in function `Object_IsWeakReference':
[error] Marker.c:(.text+0x88): undefined reference to `__weak_ref_ids_min'
[error] /usr/bin/ld: Marker.c:(.text+0xa2): undefined reference to `__weak_ref_ids_max'
[error] clang: error: linker command failed with exit code 1 (use -v to see invocation)
Exception in thread "main" scala.scalanative.build.BuildException: Failed to link /workspace/sandbox/.scala-build/sandbox_05adbf4d1c_919f107979-b0bbeb3ef8/native/main
at scala.scalanative.build.LLVM$.link(LLVM.scala:131)
at scala.scalanative.build.Build$.$anonfun$build$1(Build.scala:106)
at scala.scalanative.build.Logger.time(Logger.scala:35)
at scala.scalanative.build.Logger.time$(Logger.scala:32)
at scala.scalanative.cli.utils.FilteredLogger.time(FilteredLogger.scala:7)
at scala.scalanative.build.Build$.build(Build.scala:61)
at scala.scalanative.cli.ScalaNativeLd$.$anonfun$runLd$3(ScalaNativeLd.scala:73)
at scala.scalanative.util.Scope$.apply(Scope.scala:32)
at scala.scalanative.cli.ScalaNativeLd$.runLd(ScalaNativeLd.scala:72)
at scala.scalanative.cli.ScalaNativeLd$.main(ScalaNativeLd.scala:42)
at scala.scalanative.cli.ScalaNativeLd.main(ScalaNativeLd.scala)
Error: scala.build.errors.ScalaNativeBuildError: Error compiling with Scala Native
For more details, please see '/workspace/sandbox/.scala-build/stacktraces/1695712231-10233067241258950535.log'
Adding //> using nativeVersion 0.4.15
fixes it.
Expected behaviour
IMHO a latest toolkit should Just Work:tm: with latest scala-cli. If a user has to explicitly lookup and add a version then it undermines the convenience factor and generally breaks user expectation.
There are two possible strategies to address this.
-
scala-cli should update its defaults to latest Scala.js and Scala Native versions as soon as they are released.
-
Toolkits should not release with libraries that require newer Native/JS versions than what scala-cli ships by default. In practice, this means the libraries aggregated in toolkits should also hold back on JS/Native updates, otherwise it might be impossible to release a toolkit with an important bug fix to one of those libraries.
cc @TonioGela
Metadata
Metadata
Assignees
Labels
Type
Projects
Status