joernio / joern

Open-source code analysis platform for C/C++/Java/Binary/Javascript/Python/Kotlin based on code property graphs. Discord https://discord.gg/vv4MH284Hc
https://joern.io/
Apache License 2.0
2.1k stars 289 forks source link

[Bug] The build is failing #4291

Closed magaton closed 8 months ago

magaton commented 8 months ago

Describe the bug Build fails with:

[error] (dataflowengineoss / Antlr4 / antlr4Generate) Antlr4 failed with exit code 1
[error] (rubysrc2cpg / Antlr4 / antlr4Generate) Antlr4 failed with exit code 1

The root cause is:

[info] Wrote /Users/magaton/Projects/joern/joern-cli/target/scala-3.3.1/joern-cli_3-2.0.287.pom
[error] Error: Unable to initialize main class org.antlr.v4.Tool
[error] Caused by: java.lang.NoClassDefFoundError: org/antlr/v4/runtime/misc/ParseCancellationException
[error] Error: Unable to initialize main class org.antlr.v4.Tool
[error] Caused by: java.lang.NoClassDefFoundError: org/antlr/v4/runtime/misc/ParseCancellationException

To Reproduce Mac osx, latest oracle jdk 19 sbt installed from brew clone the latest version of joern sbt stage

Expected behavior That build passes :)

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Additional context Build log below:

magaton@Milans-MacBook-Pro-2 joern % sbt stage
copying runtime jar...
[info] [launcher] getting org.scala-sbt sbt 1.9.9  (this may take some time)...
[info] [launcher] getting Scala 2.12.18 (for sbt)...
[info] welcome to sbt 1.9.9 (Oracle Corporation Java 19.0.2)
[info] loading settings for project joern-build from meta-build.sbt,plugins.sbt ...
[info] loading project definition from /Users/magaton/Projects/joern/project
[info] loading settings for project root from build.sbt ...
[info] loading settings for project joerncli from build.sbt ...
[info] loading settings for project querydb from build.sbt ...
[info] loading settings for project console from build.sbt ...
[info] loading settings for project dataflowengineoss from build.sbt ...
[info] loading settings for project macros from build.sbt ...
[info] loading settings for project semanticcpg from build.sbt ...
[info] loading settings for project benchmarks from build.sbt ...
[info] loading settings for project c2cpg from build.sbt ...
[info] loading settings for project ghidra2cpg from build.sbt ...
[info] loading settings for project x2cpg from build.sbt ...
[info] loading settings for project pysrc2cpg from build.sbt ...
[info] loading settings for project php2cpg from build.sbt ...
[info] loading settings for project jssrc2cpg from build.sbt ...
[info] loading settings for project javasrc2cpg from build.sbt ...
[info] loading settings for project jimple2cpg from build.sbt ...
[info] loading settings for project kotlin2cpg from build.sbt ...
[info] loading settings for project rubysrc2cpg from build.sbt ...
[info] loading settings for project gosrc2cpg from build.sbt ...
[info] loading settings for project swiftsrc2cpg from build.sbt ...
[info] loading settings for project csharpsrc2cpg from build.sbt ...
[info] loading settings for project x2cpg from build.sbt ...
[info] loading settings for project kotlin2cpg from build.sbt ...
[info] loading settings for project javasrc2cpg from build.sbt ...
[info] loading settings for project pysrc2cpg from build.sbt ...
[info] loading settings for project php2cpg from build.sbt ...
[info] loading settings for project jimple2cpg from build.sbt ...
[info] loading settings for project jssrc2cpg from build.sbt ...
[info] loading settings for project swiftsrc2cpg from build.sbt ...
[info] loading settings for project rubysrc2cpg from build.sbt ...
[info] loading settings for project gosrc2cpg from build.sbt ...
[info] loading settings for project csharpsrc2cpg from build.sbt ...
[info] resolving key references (24589 settings) ...
[info] set current project to joern (in build file:/Users/magaton/Projects/joern/)
[info] Wrote /Users/magaton/Projects/joern/joern-cli/frontends/x2cpg/target/scala-3.3.1/x2cpg_3-2.0.287.pom
[info] Wrote /Users/magaton/Projects/joern/macros/target/scala-3.3.1/macros_3-2.0.287.pom
[info] Wrote /Users/magaton/Projects/joern/joern-cli/frontends/pysrc2cpg/target/scala-3.3.1/pysrc2cpg_3-2.0.287.pom
[info] Wrote /Users/magaton/Projects/joern/joern-cli/frontends/php2cpg/target/scala-3.3.1/php2cpg_3-2.0.287.pom
[info] Wrote /Users/magaton/Projects/joern/joern-cli/frontends/ghidra2cpg/target/scala-3.3.1/ghidra2cpg_3-2.0.287.pom
[info] Wrote /Users/magaton/Projects/joern/joern-cli/frontends/csharpsrc2cpg/target/scala-3.3.1/csharpsrc2cpg_3-2.0.287.pom
[info] Wrote /Users/magaton/Projects/joern/joern-cli/frontends/jssrc2cpg/target/scala-3.3.1/jssrc2cpg_3-2.0.287.pom
[info] Wrote /Users/magaton/Projects/joern/joern-cli/frontends/gosrc2cpg/target/scala-3.3.1/gosrc2cpg_3-2.0.287.pom
[info] Wrote /Users/magaton/Projects/joern/joern-cli/frontends/rubysrc2cpg/target/scala-3.3.1/rubysrc2cpg_3-2.0.287.pom
[info] Wrote /Users/magaton/Projects/joern/joern-cli/frontends/swiftsrc2cpg/target/scala-3.3.1/swiftsrc2cpg_3-2.0.287.pom
[info] Wrote /Users/magaton/Projects/joern/joern-cli/frontends/jimple2cpg/target/scala-3.3.1/jimple2cpg_3-2.0.287.pom
[info] Wrote /Users/magaton/Projects/joern/joern-cli/frontends/javasrc2cpg/target/scala-3.3.1/javasrc2cpg_3-2.0.287.pom
[info] Wrote /Users/magaton/Projects/joern/joern-cli/frontends/c2cpg/target/scala-3.3.1/c2cpg_3-2.0.287.pom
[info] Wrote /Users/magaton/Projects/joern/console/target/scala-3.3.1/console_3-2.0.287.pom
[info] Wrote /Users/magaton/Projects/joern/joern-cli/frontends/kotlin2cpg/target/scala-3.3.1/kotlin2cpg_3-2.0.287.pom
[info] Wrote /Users/magaton/Projects/joern/querydb/target/scala-3.3.1/querydb_3-2.0.287.pom
[info] Wrote /Users/magaton/Projects/joern/joern-cli/target/scala-3.3.1/joern-cli_3-2.0.287.pom
[error] Error: Unable to initialize main class org.antlr.v4.Tool
[error] Caused by: java.lang.NoClassDefFoundError: org/antlr/v4/runtime/misc/ParseCancellationException
[error] Error: Unable to initialize main class org.antlr.v4.Tool
[error] Caused by: java.lang.NoClassDefFoundError: org/antlr/v4/runtime/misc/ParseCancellationException
[info] Wrote /Users/magaton/Projects/joern/semanticcpg/target/scala-3.3.1/semanticcpg_3-2.0.287.pom
[warn] You have no main class in your project. No start script will be generated.
[warn] You have no main class in your project. No start script will be generated.
[warn] You have no main class in your project. No start script will be generated.
[warn] You have no main class in your project. No start script will be generated.
[error] java.lang.RuntimeException: Antlr4 failed with exit code 1
[error]     at scala.sys.package$.error(package.scala:30)
[error]     at com.simplytyped.Antlr4Plugin$.runAntlr(Antlr4Plugin.scala:85)
[error]     at com.simplytyped.Antlr4Plugin$.$anonfun$antlr4GeneratorTask$2(Antlr4Plugin.scala:61)
[error]     at sbt.util.FileFunction$.$anonfun$cached$1(FileFunction.scala:81)
[error]     at sbt.util.FileFunction$.$anonfun$cached$4(FileFunction.scala:154)
[error]     at sbt.util.Difference.apply(Tracked.scala:415)
[error]     at sbt.util.Difference.apply(Tracked.scala:395)
[error]     at sbt.util.FileFunction$.$anonfun$cached$3(FileFunction.scala:150)
[error]     at sbt.util.Difference.apply(Tracked.scala:415)
[error]     at sbt.util.Difference.apply(Tracked.scala:390)
[error]     at sbt.util.FileFunction$.$anonfun$cached$2(FileFunction.scala:149)
[error]     at com.simplytyped.Antlr4Plugin$.$anonfun$antlr4GeneratorTask$1(Antlr4Plugin.scala:64)
[error]     at scala.Function1.$anonfun$compose$1(Function1.scala:49)
[error]     at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:63)
[error]     at sbt.std.Transform$$anon$4.work(Transform.scala:69)
[error]     at sbt.Execute.$anonfun$submit$2(Execute.scala:283)
[error]     at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:24)
[error]     at sbt.Execute.work(Execute.scala:292)
[error]     at sbt.Execute.$anonfun$submit$1(Execute.scala:283)
[error]     at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:265)
[error]     at sbt.CompletionService$$anon$2.call(CompletionService.scala:65)
[error]     at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
[error]     at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:577)
[error]     at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
[error]     at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
[error]     at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
[error]     at java.base/java.lang.Thread.run(Thread.java:1589)
[error] java.lang.RuntimeException: Antlr4 failed with exit code 1
[error]     at scala.sys.package$.error(package.scala:30)
[error]     at com.simplytyped.Antlr4Plugin$.runAntlr(Antlr4Plugin.scala:85)
[error]     at com.simplytyped.Antlr4Plugin$.$anonfun$antlr4GeneratorTask$2(Antlr4Plugin.scala:61)
[error]     at sbt.util.FileFunction$.$anonfun$cached$1(FileFunction.scala:81)
[error]     at sbt.util.FileFunction$.$anonfun$cached$4(FileFunction.scala:154)
[error]     at sbt.util.Difference.apply(Tracked.scala:415)
[error]     at sbt.util.Difference.apply(Tracked.scala:395)
[error]     at sbt.util.FileFunction$.$anonfun$cached$3(FileFunction.scala:150)
[error]     at sbt.util.Difference.apply(Tracked.scala:415)
[error]     at sbt.util.Difference.apply(Tracked.scala:390)
[error]     at sbt.util.FileFunction$.$anonfun$cached$2(FileFunction.scala:149)
[error]     at com.simplytyped.Antlr4Plugin$.$anonfun$antlr4GeneratorTask$1(Antlr4Plugin.scala:64)
[error]     at scala.Function1.$anonfun$compose$1(Function1.scala:49)
[error]     at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:63)
[error]     at sbt.std.Transform$$anon$4.work(Transform.scala:69)
[error]     at sbt.Execute.$anonfun$submit$2(Execute.scala:283)
[error]     at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:24)
[error]     at sbt.Execute.work(Execute.scala:292)
[error]     at sbt.Execute.$anonfun$submit$1(Execute.scala:283)
[error]     at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:265)
[error]     at sbt.CompletionService$$anon$2.call(CompletionService.scala:65)
[error]     at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
[error]     at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:577)
[error]     at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
[error]     at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
[error]     at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
[error]     at java.base/java.lang.Thread.run(Thread.java:1589)
[error] (dataflowengineoss / Antlr4 / antlr4Generate) Antlr4 failed with exit code 1
[error] (rubysrc2cpg / Antlr4 / antlr4Generate) Antlr4 failed with exit code 1
[error] Total time: 4 s, completed 7 Mar 2024, 10:36:58
magaton commented 8 months ago

Hello, anyone?

max-leuthaeuser commented 8 months ago

This is strange one. We do build/test everything with GH Actions and a macos-latest runner. No issues there. @mpollmeier maybe you are able to help?

mpollmeier commented 8 months ago

Hmm, looks like local issue on your machine :( Maybe a broken jar on your disk cache? Not sure where coursier stores it's cache on macos - on linux it's ~/.cache/coursier - delete everything antlr related and try again. Or move the entire coursier cache elsewhere, it'll recreate everything it needs.

magaton commented 8 months ago

Yes, you are right, the issue was with my local .m2. Thanks

mpollmeier commented 8 months ago

glitch in the matrix, does happen once in a while