Gatling compilation failed - scala

I'm trying to build https://github.com/gatling/gatling but the compilation fails. The steps I undertook:
Installed sbt using the documentation.
Clone the github project.
Execute sbt compile in the directory gatling.
I get the following error:
[error] /home/groot/gatling/gatling-commons/src/main/scala/io/gatling
/commons/util/Arrays.scala:36:32: macro implementation not found: cfor
[error] (the most common reason for that is that you cannot use macro implementations in the same compilation run that defines them)
[error] cfor(length)(_ > 1, _ - 1) { i =>
[error] ^
[error] /home/groot/gatling/gatling-commons/src/main/scala/io/gatling/commons/util/StringHelper.scala:40:23: macro implementation not found: fast
[error] (the most common reason for that is that you cannot use macro implementations in the same compilation run that defines them)
[error] val EmptyFastring = fast""
[error] ^
[error] /home/groot/gatling/gatling-commons/src/main/scala/io/gatling/commons/validation/package.scala:38:20: macro implementation not found: info
[error] (the most common reason for that is that you cannot use macro implementations in the same compilation run that defines them)
[error] logger.info(message, e)
[error] ^
[error] three errors found
[error] (gatling-commons / Compile / compileIncremental) Compilation failed
[error] Total time: 10 s, completed May 4, 2018, 11:30:14 AM
I do not know enough of scala to debug this, how can I fix this?

Try IntelliJ Idea with scala plugin
Just use IntelliJ Idea open the project folder

I've executed as sudo (sudo sbt compile) and now the compilation is succesful.

Related

Scalac option Yopt-log-inline make errors

With scala 2.12.4 when I use theses parameters
scalacOptions := Seq("-unchecked", "-deprecation", "-opt:l:inline","-opt-inline-from:bfd.DateTime$","-Yopt-log-inline")
I have error which doesn't exist when I don't use "-Yopt-log-inline"
[info] Compiling 7 Scala sources to /Users/admin/Workspace/bfd/target/scala-2.12/classes ...
[error] error while loading Object, Missing dependency 'object scala in compiler mirror', required by /Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/lib/rt.jar(java/lang/Object.class)
[error] ## Exception when compiling 7 sources to /Users/admin/Workspace/bfd/target/scala-2.12/classes
[error] object scala in compiler mirror not found.
[error] scala.reflect.internal.MissingRequirementError$.signal(MissingRequirementError.scala:17)
[error] scala.reflect.internal.MissingRequirementError$.notFound(MissingRequirementError.scala:18)
[error] scala.reflect.internal.Mirrors$RootsBase.$anonfun$getModuleOrClass$4(Mirrors.scala:54)
[error] scala.reflect.internal.Mirrors$RootsBase.getModuleOrClass(Mirrors.scala:54)
[error] scala.reflect.internal.Mirrors$RootsBase.getModuleOrClass(Mirrors.scala:66)
[error] scala.reflect.internal.Mirrors$RootsBase.getPackage(Mirrors.scala:172)
[error] scala.reflect.internal.Definitions$DefinitionsClass.ScalaPackage$lzycompute(Definitions.scala:169)
[error] scala.reflect.internal.Definitions$DefinitionsClass.ScalaPackage(Definitions.scala:169)
[error] scala.reflect.internal.Definitions$DefinitionsClass.ScalaPackageClass$lzycompute(Definitions.scala:170)
[error] scala.reflect.internal.Definitions$DefinitionsClass.ScalaPackageClass(Definitions.scala:170)
[error] scala.reflect.internal.Definitions$DefinitionsClass.init(Definitions.scala:1423)
[error] scala.tools.nsc.Global$Run.<init>(Global.scala:1164)
[error] xsbt.ZincCompiler$ZincRun.<init>(CallbackGlobal.scala:63)
[error] xsbt.CachedCompiler0.run(CompilerInterface.scala:129)
[error] xsbt.CachedCompiler0.run(CompilerInterface.scala:106)
[error] xsbt.CompilerInterface.run(CompilerInterface.scala:32)
[error] sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[error] sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
...
I think the error is not related to the usage of inline. Maybe the options override the scala dependency definition.
Is it a bug in the compiler or just a bad setting with an unclear feedback?
-Yopt-log-inline expect a parameter. The equivalent to the wild card of -opt-inline-from:** is the underscore _.
So to correct this error add this parameter to scalacOptions like this.
scalacOptions ++= Seq("-opt:l:inline","-opt-inline-from:bfd.DateTime$","-Yopt-log-inline", "_")
edit:
What hepping here is a problem between scalac and sbt, sbt gives the class pass next to Scala option, so scalac think the classpath is the option of -Yopt-log-inline and start without actual classpath, which make a crach.
If you are using sbt and don't want to fall in this kind of error you can use "-Y" as your last option.

What is wrong with my project hierarchy?

I have created a project by importing existing sources in Intellij IDEA.
When I run from my comand line,sbt and then console I got this
[info] Compiling 7 Scala sources to
/home/milenko/example/project/target/scala-2.10/classes...
[error] /home/milenko/example/project/CommonBuild.scala:20: not found: type ModuleID
[error] dependencies: Seq[ModuleID] = Seq(),
[error] ^
[error] /home/milenko/example/project/CommonBuild.scala:26: not found: type Build
[error] trait CommonBuild extends Build {
[error] ^
[error] /home/milenko/example/project/CommonBuild.scala:28: not found: value SettingKey
[error] val course = SettingKey[String]("course")
[error] ^
[error] /home/milenko/example/project/CommonBuild.scala:30: not found: value SettingKey
[error] val assignment = SettingKey[String]("assignment")
[error] ^
[error] /home/milenko/example/project/CommonBuild.scala:32: not found: value SettingKey
[error] val assignmentsMap = SettingKey[Map[String, Assignment]]("assignmentsMap")
My example folder
milenko#milenko-desktop:~/example$ ls
assignment.sbt build.sbt project src target
Then I have changed directory to project,and run sbt and console in project.
My IDEA import is here
It seems that CommonBuild.scala is not positioned at the wright place.How to change this?
You should run sbt command from the root of your build, not in the project directory. project directory is used to build the build definition of your project, because sbt is recursive.
In other words, in your case you need to run sbt in ~/example directory.

object scalatest is not a member of package org [error] Cygwin

I was wondering if I could get some help with this one. I know there are many different issues with the same title, however, after following all the instructions (I hope), I could not get it to compile still. I've been at this for over 7 hours.
This is my issue. I am using Cygwin64 terminal to do some scala programming with sbt. I run the test and make sure that the test file is in the test folder but nothing is working. I have tried to compile it without the test file and then bring it back in but it does not work either.
$ sbt test
[info] Loading project definition from C:\cygwin64\home\Sam\hof\project
[info] Set current project to hof (in build file:/C:/cygwin64/home/Sam/hof/)
[info] Compiling 1 Scala source to C:\cygwin64\home\Sam\hof\target\scala-2.10\test-classes...
[error] C:\cygwin64\home\Sam\hof\src\test\scala\TestSuite.scala:3: object scalatest is not a member of package org
[error] class TestSuite extends org.scalatest.FunSuite {
[error] ^
[error] C:\cygwin64\home\Sam\hof\src\test\scala\TestSuite.scala:5: not found: value test
[error] test("map2 with add"){
[error] ^
[error] two errors found
[error] (test:compileIncremental) Compilation failed
[error] Total time: 3 s, completed Sep 19, 2016 1:07:10 AM
Is there anything I can do?
I had the same problem. Running sbt test in the project root gave me the object scalatest is not a member of package org error. But when I changed to src/test directory, it completed successfully.

Bad Symbolic reference to reactivemongo.api.collections.GenericHandlers encountered in class file 'JSONGenericHandlers.class'

I'm having my apis in play 2.3 with reactive mongo. Recently, i tried to cleaned the project and during the process, some things got updated. Later, when i tried to run or compile that, i'm getting these errors. Apart from clean, i didn't do anything. Kindly help me.
[info] Compiling 48 Scala sources and 1 Java source to /home/Ruthvick/zcapi/zceapi /target /scala-2.11/classes...
[error] bad symbolic reference to reactivemongo.api.collections.GenericHandlers encountered in class file 'JSONGenericHandlers.class'.
[error] Cannot access type GenericHandlers in package reactivemongo.api.collections. The current classpath may be
[error] missing a definition for reactivemongo.api.collections.GenericHandlers, or JSONGenericHandlers.class may have been compiled against a version that's
[error] incompatible with the one found on the current classpath.
[error] /home/Ruthvick/zcapi/zceapi/app/controllers/Application.scala:28: type arguments [play.modules.reactivemongo.json.collection.JSONCollection] do not conform to method collection's type parameter bounds [C <: reactivemongo.api.Collection]
[error] def collection: JSONCollection = db.collection[JSONCollection]("shoppage")
[error] ^
[error] /home/Ruthvick/zcapi/zceapi/app/controllers/Application.scala:47: could not find implicit value for parameter writer: GenericCollection.this.pack.Writer[play.api.libs.json.JsObject]
[error] collection.insert(result).map { lastError =>
[error] ^
[error] 60 errors found
[error] (compile:compile) Compilation failed
[error] application -
Thanks,
Your version of Play is not compatible with the newest Snapshot of Play Reactive Mongo. You could just use Version 0.10.5.
Add this to your Library Dependencies
"org.reactivemongo" %% "play2-reactivemongo" % "0.10.5.0.akka23"

scala breeze compilation error

I am trying to compile the scala breeze library (release 0.9) with sbt 2.13.
I am getting the following error:
[info] Loading project definition from C:\scala\breeze-releases-v0.9\project
[info] Set current project to breeze-parent (in build file:/C:/scala/breeze-releases-v0.9/)
[info] Compiling 280 Scala sources to C:\scala\breeze-releases-v0.9\math\target\scala-2.11\classes...
[error] C:\scala\breeze-releases-v0.9\math\src\main\scala\breeze\util\HeapDump.scala:5: object management is not a member of package com.sun
[error] import com.sun.management.HotSpotDiagnosticMXBean
[error] C:\scala\breeze-releases-v0.9\math\src\main\scala\breeze\util\HeapDump.scala:21: not found: type HotSpotDiagnosticMXBean
[error] private lazy val hotspotMBean: HotSpotDiagnosticMXBean = getHotspotMBean();
[error] C:\scala\breeze-releases-v0.9\math\src\main\scala\breeze\util\HeapDump.scala:38: not found: type HotSpotDiagnosticMXBean
[error] private def getHotspotMBean():HotSpotDiagnosticMXBean = {
[error] C:\scala\breeze-releases-v0.9\math\src\main\scala\breeze\util\HeapDump.scala:42: not found: type HotSpotDiagnosticMXBean
[error] HOTSPOT_BEAN_NAME, classOf[HotSpotDiagnosticMXBean]);
[error] four errors found
I am on java sdk 1.7.0_02
What should I do?
Thanks,
Mike
I answered this on Breeze's mailing list, but this is because you're using a non-HotSpot VM. I'll delete this class in the next release of Breeze.