You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ scala-cli bug.scala
Compiling project (Scala 3.1.3, Scala Native)
Compiled project (Scala 3.1.3, Scala Native)
[info] Linking (2575 ms)
[info] Discovered 665 classes and 3691 methods
[info] Optimizing (debug mode) (2722 ms)
[info] Generating intermediate code (1956 ms)
[info] Produced 16 files
[info] Compiling to native code (2162 ms)
[error] /usr/bin/ld: /workspace/sandbox/.scala-build/project_3e87ab6122_3e87ab6122-45290ff20c/native/native-code-resources-1/scala-native/bug.c.o: in function `foo':
[error] bug.c:(.text+0x0): multiple definition of `foo'; /workspace/sandbox/.scala-build/project_3e87ab6122_3e87ab6122-45290ff20c/native/native-code-main-0/scala-native/bug.c.o:bug.c:(.text+0x0): first defined here
[error] /usr/bin/ld: /workspace/sandbox/.scala-build/project_3e87ab6122_3e87ab6122-45290ff20c/native/native-code-main14358077217882765813-6/scala-native/bug.c.o: in function `foo':
[error] bug.c:(.text+0x0): multiple definition of `foo'; /workspace/sandbox/.scala-build/project_3e87ab6122_3e87ab6122-45290ff20c/native/native-code-main-0/scala-native/bug.c.o:bug.c:(.text+0x0): first defined here
[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/project_3e87ab6122_3e87ab6122-45290ff20c/native/main
at scala.scalanative.build.LLVM$.$anonfun$link$3(LLVM.scala:139)
at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
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:5)
at scala.scalanative.build.LLVM$.link(LLVM.scala:134)
at scala.scalanative.build.Build$.$anonfun$build$1(Build.scala:97)
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:5)
at scala.scalanative.build.Build$.build(Build.scala:55)
at scala.scalanative.cli.ScalaNativeLd$.$anonfun$runLd$3(ScalaNativeLd.scala:71)
at scala.scalanative.util.Scope$.apply(Scope.scala:32)
at scala.scalanative.cli.ScalaNativeLd$.runLd(ScalaNativeLd.scala:70)
at scala.scalanative.cli.ScalaNativeLd$.main(ScalaNativeLd.scala:44)
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/1661433802-2294276439271201219.log'
Expected behaviour
It should work :)
The text was updated successfully, but these errors were encountered:
Version(s)
0.1.12
Describe the bug
Following the instructions for creating Scala Native application with Native code doesn't work due to a
multiple definition
error.http://www.scala-native.org/en/latest/user/sbt.html#applications-with-native-code
To Reproduce
resources/scala-native/bug.c
bug.scala
Expected behaviour
It should work :)
The text was updated successfully, but these errors were encountered: