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

Provide better error when main class is not an object #3842

Open
keynmol opened this issue Mar 14, 2024 · 0 comments
Open

Provide better error when main class is not an object #3842

keynmol opened this issue Mar 14, 2024 · 0 comments

Comments

@keynmol
Copy link
Contributor

keynmol commented Mar 14, 2024

//> using platform scala-native

class App:
  def main(args: Array[String]): Unit = println("hello")

Results in a scary looking error:

> scli run . -M App
Compiling project (Scala 3.3.1, Scala Native 0.4.17)
Compiled project (Scala 3.3.1, Scala Native 0.4.17)
[error] Found 1 missing definitions while linking
[error] Not found Member(Top(App),D4mainLAL16java.lang.String_uEo)
Exception in thread "main" scala.scalanative.linker.LinkingException: Undefined definitions found in reachability phase
        at scala.scalanative.linker.Reach.fail(Reach.scala:979)
        at scala.scalanative.linker.Reach.reportMissing(Reach.scala:974)
        at scala.scalanative.linker.Reach.result(Reach.scala:52)

On 0.5.0 is somewhat better, but still:

[info] Discovered 871 classes and 5425 methods after classloading
[error] Found 1 unreachable symbols!
[error] Unknown static method App.main(java.lang.String[]): scala.runtime.BoxedUnit, referenced from:


Exception in thread "main" [info] Total (1106 ms)
scala.scalanative.linker.LinkingException: Unreachable symbols found after classloading run. It can happen when using dependencies not cross-compiled for Scala Native or not yet ported JDK definitions.
        at scala.scalanative.build.ScalaNative$.$anonfun$withReachabilityPostprocessing$3(ScalaNative.scala:94)
        at scala.concurrent.Future.$anonfun$flatMap$1(Future.scala:307)
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

No branches or pull requests

1 participant