logo
down
shadow

how to have different source code when cross-compiling Scala with sbt? (changes in MurmurHash)


how to have different source code when cross-compiling Scala with sbt? (changes in MurmurHash)

By : user2951198
Date : November 18 2020, 01:01 AM
To fix this issue I am using SBT 0.13.2 (could be e.g. 0.13.5 just as well) and am trying to take a project written for 2.10 and cross-compile it for both 2.9 and 2.10. It uses scala.util.hashing.MurmurHash3, which doesn't exist in 2.9; instead there's scala.util.MurmurHash (which may not be compatible???). My source will need to be different to handle the imports in different places and the different interfaces. I presume I need to have two different .scala files and somehow tell SBT to compile one .scala file when compiling for 2.9, and a different .scala file for 2.10. How do I do this? , You can append to unmanagedSourceDirectories:
code :
lazy val commonSettings = Seq(
  scalaVersion := "2.10.4",
  unmanagedSourceDirectories in Compile +=
    (sourceDirectory in Compile).value / ("scala_" + (scalaBinaryVersion.value match {
      case v if v startsWith "2.9." => "2.9"
      case v => v
    }))
)

lazy val root = (project in file(".")).
  aggregate(app).
  settings(commonSettings: _*)

lazy val app = (project in file("app")).
  settings(commonSettings: _*)


Share : facebook icon twitter icon
How can I use Scala's MurmurHash implementation: scala.util.MurmurHash3?

How can I use Scala's MurmurHash implementation: scala.util.MurmurHash3?


By : Amee Joshi
Date : March 29 2020, 07:55 AM
may help you . It's called just scala.util.MurmurHash without the 3. But it's indeed the Murmurhash 3 algorithm (see the comments in the source)
EDIT I've just seen that Rex Kerr is the author of scala.util.MurmurHash. I would advise you not to accept this answer (assuming it's the correct one); since Rex Kerr is on StackOverflow he may chime in and give you a much better one...
Cross compiling source from windows to linux

Cross compiling source from windows to linux


By : frank
Date : March 29 2020, 07:55 AM
will help you We also need to see some code, but....
Windows has its own types for basic things above the vanilla C ones, as does Linux. It sounds like DWORD as a type is not known in Linux (likely). You'll probably have to create a mytypes.h file that redefines Windows standards like DWORD into Linux speak when building for a Linux platform. Linux has types.h that defines things like int32_t which is the equivalent. See this thread for more about this.
Problems cross compiling Qt 4.7 from source for ARM

Problems cross compiling Qt 4.7 from source for ARM


By : Martiono
Date : March 29 2020, 07:55 AM
it should still fix some issue
{standard input}:1294: Error: selected processor does not support Thumb mode 'swp r6,r4,[r3]'
code :
 asm volatile("swpb %0,%2,[%3]"
: "=&r"(ret), "=m" (*ptr)
: "r"(newval), "r"(ptr)
: "cc", "memory");
asm volatile("swpb %0,%1,[%2]"
             : "=r"(ret)
             : "0"(newval), "r"(ptr)
             : "memory");
How to set different scalacOptions per Scala version when cross-compiling using Build.scala?

How to set different scalacOptions per Scala version when cross-compiling using Build.scala?


By : Ellie Salander
Date : November 18 2020, 01:01 AM
this will help When building with Scala 2.10 and SBT 0.13.2, I want to have -language:_, but this isn't recognized by Scala 2.9. There's a question about settings different scalacOptions for cross-compilation (Conditional scalacOptions with SBT), but it is about build.sbt. I'm using Build.scala because I'm doing a multi-project build. , In SBT 0.13+ this will work:
code :
def scalacOptionsVersion(scalaVersion: String) = {
  Seq(
    "-unchecked",
    "-deprecation",
    "-Xlint",
    "-Xfatal-warnings",
    "-Ywarn-dead-code",
    "-target:jvm-1.7",
    "-encoding", "UTF-8"
  ) ++ CrossVersion.partialVersion(scalaVersion) match {
         case Some((2, scalaMajor)) if scalaMajor == 9 => Nil
         case _ => Seq("-language:_")
       }
}


val appSettings = Seq(
  scalacOptions := scalacOptionsVersion(scalaVersion.value)

  // other settings...
)
How can I resolve dependencies when cross-compiling in Scala with sbt?

How can I resolve dependencies when cross-compiling in Scala with sbt?


By : Roger Smith
Date : March 29 2020, 07:55 AM
it fixes the issue I want to build a 2.11 and 2.12 version of my project, so I have something like this in my Build.scala file:
code :
lazy val bla = project in file("bla")
 .settings(
   libraryDependencies ++= Seq(
     "org.scala-lang" % "scala-reflect" % scalaVersion.value
   )
 )
Related Posts Related Posts :
  • Assign generic method to variable in Scala
  • General Finite State Machine (Transducer) in Scala
  • What is the usage of a final var in Scala
  • Define Generic Types with String
  • Why there is a ClassCastException when isInstanceOf returns true on a scala type with wildcard parameter?
  • How to reaload scala application after code change using actors and sbt
  • akka non-blocking BoundedMailbox
  • Why are constructor parameters made into members for case classes?
  • Higher order tail recursive function needs to terminate early
  • How can I reusably filter based on type in Scala?
  • Why does Scala sbt update every time I start it from command prompt?
  • Recommended Scala io library
  • Thread-safely transforming a value in a mutable map
  • Why does chaining match expressions does not compile?
  • Ebean not persisting foreign keys
  • Difference between def m(p: T forSome {type T} and def m1(p:Any), is there any ? Explanation needed based on Scala Langu
  • macro does not find out enclosing vals
  • Spark : how to run spark file from spark shell
  • Flattening a list of lists to a set with exceptions in scala
  • flatMap implementation in Scala
  • Confused about a few lines code in a scala official document page
  • How to input parameters when running bash command with Scala
  • Location header is lost if max-redirects > 1
  • Controller Spec is using FakeApplication, but can't load test configuration
  • Scala code analyzer targets case variable names that are identical to the outer matched varables - "suspicous shado
  • Why does authorize directive execute after the code it's supposed to protect?
  • Scala. Checking if a Type is Comparable
  • Does having a private constructor on a value class negate the benefits of a value class?
  • How to transform submitted json in Play 2.0?
  • Scala warning match may not be exhaustive
  • Pure not a member of objective Promise in PlayFramework
  • How to unmarshal POST params and JSON body in a single route?
  • Spark:How to use join method?
  • is client thread-safe in Twitter Finagle
  • Why is the method accepts only one argument?
  • Scala Play 2.3 Working with gCloud Storage - any libs to go async?
  • spray.io strange get/delete/detach directives behavior
  • SBT cannot resolve class declared in src/main/scala in a src/test/scala test class
  • Scala typeclass without function argument
  • Configuring actor behavior using typesafe Config and HOCON
  • Scalatra: Migrating Jersey Filters to Scalatra
  • Compilation error when using Scaldi
  • Scalac hanging in phase typer
  • How to set different scalacOptions per Scala version when cross-compiling using Build.scala?
  • Possible Bug in JDBC?
  • Is there a Scala compiler flag to warn when tail recursion is applied without annotation?
  • scala case class put methods in companion object?
  • multiproject sbt doesn't generate file structure
  • Scala "multilevel" abstract class / abstract objects replacement
  • Scala, getting the type parameters of a KList as an HList
  • Why does Play refuse form reporting "Cannot resolve method apply with such signature: Missing arguments"?
  • How to split string with trailing empty strings in result?
  • Scala group by list of list and subtracts grouped values
  • Scala - Creating a function to produce Unary string or integer values
  • shadow
    Privacy Policy - Terms - Contact Us © ourworld-yourmove.org