Scalac Error while compiling a project in Intellij

Answered

Hi everyone,

I have a problem compiling and running the test on my project https://github.com/parzival3/Coverage.

When I'm testing it in the shell the compilation and the execution of the test completes without any errors.

~/Git/Coverage(master*) » sbt "testOnly *AluTest"                                                                                                                                                              enrico@enrico-ThinkPad-T480s 
[info] welcome to sbt 1.3.13 (Private Build Java 1.8.0_265)
[info] loading global plugins from /home/enrico/.sbt/1.0/plugins
[info] loading project definition from /home/Git/Coverage/project
[info] loading settings for project root from build.sbt ...
[info] loading settings for project chisel-testers2-build from plugins.sbt ...
[info] loading project definition from /home/enrico/.sbt/1.0/staging/530a6390c74b6717d868/chisel-testers2/project
[info] loading settings for project chisel-testers2 from build.sbt ...
[info] set current project to Coverage (in build file:/home/Git/Coverage/)
[info] [0.004] Elaborating design...
[info] [0.847] Done elaborating.
CompilerAnnotation is deprecated since FIRRTL 1.4.0. Please use 'RunFirrtlTransformAnnotation(new firrtl.LowFirrtlEmitter)' instead.
file loaded in 0.061379867 seconds, 20 symbols, 15 statements
test Alu Success: 0 tests passed in 3 cycles in 0.042452 seconds 70.67 Hz
[info] AluTest:
[info] ALU
[info] - should test static circuits
[info] Run completed in 2 seconds, 947 milliseconds.
[info] Total number of tests run: 1
[info] Suites: completed 1, aborted 0
[info] Tests: succeeded 1, failed 0, canceled 0, ignored 0, pending 0
[info] All tests passed.
[success] Total time: 4 s, completed Oct 9, 2020 9:38:10 PM

If I run the test thought the sbt console in IntelliJ I don't have any problem either.

But if I run the tests through IntelliJ I get this stack trace

 

scalac: Error: org.scalactic.BooleanMacro.<init>(Lscala/reflect/macros/whitebox/Context;)V
java.lang.NoSuchMethodError: org.scalactic.BooleanMacro.<init>(Lscala/reflect/macros/whitebox/Context;)V
at org.scalatest.AssertionsMacro$.assume(AssertionsMacro.scala:96)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at scala.reflect.macros.runtime.JavaReflectionRuntimes$JavaReflectionResolvers.$anonfun$resolveJavaReflectionRuntime$6(JavaReflectionRuntimes.scala:51)
at scala.tools.nsc.typechecker.Macros.macroExpandWithRuntime(Macros.scala:824)
at scala.tools.nsc.typechecker.Macros.macroExpandWithRuntime$(Macros.scala:800)
at scala.tools.nsc.Global$$anon$4.macroExpandWithRuntime(Global.scala:482)
at scala.tools.nsc.typechecker.Macros$MacroExpander.$anonfun$expand$1(Macros.scala:630)
at scala.tools.nsc.Global.withInfoLevel(Global.scala:228)
at scala.tools.nsc.typechecker.Macros$MacroExpander.expand(Macros.scala:623)
at scala.tools.nsc.typechecker.Macros$MacroExpander.apply(Macros.scala:610)
at scala.tools.nsc.typechecker.Macros.standardMacroExpand(Macros.scala:785)
at scala.tools.nsc.typechecker.Macros.standardMacroExpand$(Macros.scala:783)
at scala.tools.nsc.Global$$anon$4.standardMacroExpand(Global.scala:482)
at scala.tools.nsc.typechecker.AnalyzerPlugins$$anon$10.default(AnalyzerPlugins.scala:457)
at scala.tools.nsc.typechecker.AnalyzerPlugins$$anon$10.default(AnalyzerPlugins.scala:454)
at scala.tools.nsc.typechecker.AnalyzerPlugins.invoke(AnalyzerPlugins.scala:411)
at scala.tools.nsc.typechecker.AnalyzerPlugins.pluginsMacroExpand(AnalyzerPlugins.scala:454)
at scala.tools.nsc.typechecker.AnalyzerPlugins.pluginsMacroExpand$(AnalyzerPlugins.scala:454)
at scala.tools.nsc.Global$$anon$4.pluginsMacroExpand(Global.scala:482)
at scala.tools.nsc.typechecker.Macros.macroExpand(Macros.scala:774)
at scala.tools.nsc.typechecker.Macros.macroExpand$(Macros.scala:767)
at scala.tools.nsc.Global$$anon$4.macroExpand(Global.scala:482)
at scala.tools.nsc.typechecker.Typers$Typer.vanillaAdapt$1(Typers.scala:1164)
at scala.tools.nsc.typechecker.Typers$Typer.adapt(Typers.scala:1224)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5730)
at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$adapt$1(Typers.scala:902)
at scala.tools.nsc.typechecker.Typers$Typer.adaptToImplicitMethod$1(Typers.scala:490)
at scala.tools.nsc.typechecker.Typers$Typer.adapt(Typers.scala:1220)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5730)
at scala.tools.nsc.typechecker.Typers$Typer.typedStat$1(Typers.scala:5780)
at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$typedStats$10(Typers.scala:3353)
at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:3353)
at scala.tools.nsc.typechecker.Typers$Typer.typedBlock(Typers.scala:2485)
at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$typed1$102(Typers.scala:5645)
at scala.tools.nsc.typechecker.Typers$Typer.typedOutsidePatternMode$1(Typers.scala:499)
at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5680)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5716)
at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$typedArg$1(Typers.scala:3371)
at scala.tools.nsc.typechecker.Typers$Typer.typedArg(Typers.scala:490)
at scala.tools.nsc.typechecker.PatternTypers$PatternTyper.typedArgWithFormal$1(PatternTypers.scala:113)
at scala.tools.nsc.typechecker.PatternTypers$PatternTyper.$anonfun$typedArgsForFormals$4(PatternTypers.scala:129)
at scala.tools.nsc.typechecker.PatternTypers$PatternTyper.typedArgsForFormals(PatternTypers.scala:129)
at scala.tools.nsc.typechecker.PatternTypers$PatternTyper.typedArgsForFormals$(PatternTypers.scala:110)
at scala.tools.nsc.typechecker.Typers$Typer.typedArgsForFormals(Typers.scala:201)
at scala.tools.nsc.typechecker.Typers$Typer.handleMonomorphicCall$1(Typers.scala:3710)
at scala.tools.nsc.typechecker.Typers$Typer.doTypedApply(Typers.scala:3743)
at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$typed1$26(Typers.scala:4772)
at scala.tools.nsc.typechecker.Typers$Typer.silent(Typers.scala:714)
at scala.tools.nsc.typechecker.Typers$Typer.tryTypedApply$1(Typers.scala:4772)
at scala.tools.nsc.typechecker.Typers$Typer.normalTypedApply$1(Typers.scala:4856)
at scala.tools.nsc.typechecker.Typers$Typer.typedApply$1(Typers.scala:4867)
at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5670)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5716)
at scala.tools.nsc.typechecker.Typers$Typer.typedStat$1(Typers.scala:5780)
at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$typedStats$10(Typers.scala:3353)
at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:3353)
at scala.tools.nsc.typechecker.Typers$Typer.typedTemplate(Typers.scala:2013)
at scala.tools.nsc.typechecker.Typers$Typer.typedClassDef(Typers.scala:1826)
at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5636)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5716)
at scala.tools.nsc.typechecker.Typers$Typer.typedStat$1(Typers.scala:5780)
at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$typedStats$10(Typers.scala:3353)
at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:3353)
at scala.tools.nsc.typechecker.Typers$Typer.typedPackageDef$1(Typers.scala:5346)
at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5639)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5716)
at scala.tools.nsc.typechecker.Analyzer$typerFactory$TyperPhase.apply(Analyzer.scala:114)
at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:453)
at scala.tools.nsc.typechecker.Analyzer$typerFactory$TyperPhase.run(Analyzer.scala:103)
at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1503)
at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1487)
at scala.tools.nsc.Global$Run.compileSources(Global.scala:1480)
at scala.tools.nsc.Global$Run.compile(Global.scala:1606)
at xsbt.CachedCompiler0.run(CompilerInterface.scala:130)
at xsbt.CachedCompiler0.run(CompilerInterface.scala:105)
at xsbt.CompilerInterface.run(CompilerInterface.scala:31)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sbt.internal.inc.AnalyzingCompiler.call(AnalyzingCompiler.scala:237)
at sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:111)
at sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:90)
at org.jetbrains.jps.incremental.scala.local.IdeaIncrementalCompiler.compile(IdeaIncrementalCompiler.scala:42)
at org.jetbrains.jps.incremental.scala.local.LocalServer.compile(LocalServer.scala:43)
at org.jetbrains.jps.incremental.scala.remote.Main$.compileLogic(Main.scala:145)
at org.jetbrains.jps.incremental.scala.remote.Main$.$anonfun$handleCommand$1(Main.scala:131)
at org.jetbrains.jps.incremental.scala.remote.Main$.decorated$1(Main.scala:121)
at org.jetbrains.jps.incremental.scala.remote.Main$.handleCommand(Main.scala:128)
at org.jetbrains.jps.incremental.scala.remote.Main$.serverLogic(Main.scala:105)
at org.jetbrains.jps.incremental.scala.remote.Main$.nailMain(Main.scala:63)
at org.jetbrains.jps.incremental.scala.remote.Main.nailMain(Main.scala)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.martiansoftware.nailgun.NGSession.run(NGSession.java:319)

If you want to tray and run the test on my repository please not that the test AluTestVerilator  requires an additional program called Verilator. I suggest you to run only the test named AluTest  which uses only sacal with

sbt "testOnly *AluTest"

Any idea on why this is happening?

Thansk a lot :-)

 

My configuration:

Ubuntu GNU/Linux 20.04

 

IntelliJ IDEA 2020.2.3 (Ultimate Edition)
Build #IU-202.7660.26, built on October 6, 2020
Licensed to Enrico Tolotto
Subscription is active until September 6, 2021
For educational use only.
Runtime version: 11.0.8+10-b944.34 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Linux 5.3.0-40-generic
GC: ParNew, ConcurrentMarkSweep
Memory: 4029M
Cores: 8
Non-Bundled Plugins: IdeaVIM, Key Promoter X, org.scalafmt.ScalaFmt, org.easysoc.firrtl, org.intellij.scala, org.easysoc.chisel
Current Desktop: KDE

2 comments
Comment actions Permalink

Seems to work fine for me

From the error

scalac: Error: org.scalactic.BooleanMacro.<init>(Lscala/reflect/macros/whitebox/Context;)V
java.lang.NoSuchMethodError: org.scalactic.BooleanMacro.<init>(Lscala/reflect/macros/whitebox/Context;)V
at org.scalatest.AssertionsMacro$.assume(AssertionsMacro.scala:96)

it looks like some library version incompatibility (scalatest, scalactic). Does SBT import complete succesfully in IDE? What options do you have set here:

0
Comment actions Permalink

Hi Andrey and thank you for your quick response :-).

I didn't set any of those options, and if I enable the builds option I can run my tests from IntelliJ.

Also, I forgot to report that both my test classes are reported as errors.

Class 'AluTest' needs to be mixin, since member 'withFixture' in 'ChiselScalatestTester' is marked 'abstract' and 'override', but no concrete implementation could be found in a base class

 

I've recently upgraded my IntelliJ from 2020.2.2 to 2020.2.3. I don't know if that is the cause of the problem.

Until I don't find a solution I'll use the sbt shell to compile and run my tests.

Thanks a lot again.

Have a nice day :-)

Enrico

0

Please sign in to leave a comment.