LukaJCB / rxscala-js

Scala idiomatic wrapper for RxJS
http://lukajcb.github.io/rxscala-js/latest/api/rxscalajs/Observable.html
47 stars 7 forks source link

Current version of rxscala-js cause linking errors #27

Open MrCurtis opened 6 years ago

MrCurtis commented 6 years ago

I have a project which uses both rxscala-js and spire.

build.sbt:

name := "CircleLimit root project"

lazy val root = project.in(file(".")).
  aggregate(circleLimitJS, circleLimitJVM).
  settings(
    publish := {},
    publishLocal := {}
  )

lazy val circleLimit = crossProject.in(file(".")).
  settings(
    name := "circleLimit",
    version := "0.1-SNAPSHOT",
    scalaVersion := "2.12.4",
    testFrameworks += new TestFramework("utest.runner.Framework"),
    resolvers ++= Seq(
      "Sonatype Releases" at "https://oss.sonatype.org/content/repositories/releases/"
    ),
    libraryDependencies += "org.typelevel" %%% "spire" % "0.14.1",
    libraryDependencies += "com.lihaoyi" %%% "utest" % "0.6.0" % Test,
    libraryDependencies += "org.seleniumhq.selenium" % "selenium-java" % "3.7.1" % Test
  ).
  jsSettings(
    libraryDependencies += "org.scala-js" %%% "scalajs-dom" % "0.9.3",
    libraryDependencies += "com.github.lukajcb" %%% "rxscala-js" % "0.15.2",
    jsDependencies += "org.webjars.npm" % "rxjs" % "5.3.0" / "bundles/Rx.min.js" commonJSName "Rx"
  )

lazy val circleLimitJVM = circleLimit.jvm
lazy val circleLimitJS = circleLimit.js

When I try to compile the project to javascript I get the following errors:

[error] Referring to non-existent method cats.kernel.Order.on$mIcI$sp(scala.Function1)cats.kernel.Order
[error]   called from spire.std.LongAlgebra.on$mIcI$sp(scala.Function1)cats.kernel.Order
[error]   called from spire.syntax.std.ArrayOps$mcI$sp.qsortBy$mIcI$sp(scala.Function1,cats.kernel.Order,scala.reflect.ClassTag)scala.Unit
[error]   called from spire.math.poly.PolySparse$.apply(scala.collection.TraversableOnce,algebra.ring.Semiring,cats.kernel.Eq,scala.reflect.ClassTag)spire.math.poly.PolySparse
[error]   called from spire.math.Polynomial$.apply(scala.collection.TraversableOnce,algebra.ring.Semiring,cats.kernel.Eq,scala.reflect.ClassTag)spire.math.poly.PolySparse
[error]   called from spire.math.Polynomial.mapTerms(scala.Function1,algebra.ring.Semiring,cats.kernel.Eq,scala.reflect.ClassTag,algebra.ring.Semiring,cats.kernel.Eq)spire.math.Polynomial
[error]   called from spire.math.poly.PolySparse.mapTerms(scala.Function1,algebra.ring.Semiring,cats.kernel.Eq,scala.reflect.ClassTag,algebra.ring.Semiring,cats.kernel.Eq)spire.math.Polynomial
[error]   called from spire.math.Polynomial.removeZeroRoots(algebra.ring.Semiring,cats.kernel.Eq)spire.math.Polynomial
[error]   called from spire.math.poly.PolySparse.removeZeroRoots(algebra.ring.Semiring,cats.kernel.Eq)spire.math.Polynomial
[error]   called from spire.math.poly.BigDecimalRootRefinement$.shift$1(spire.math.Polynomial,spire.math.Rational)spire.math.Polynomial
[error]   called from spire.math.poly.BigDecimalRootRefinement$.hasRoot$1(spire.math.Rational,spire.math.Rational,spire.math.poly.BigDecimalRootRefinement$ApproximationContext)scala.Boolean
[error]   called from spire.math.poly.BigDecimalRootRefinement$.adjust$1(java.math.BigDecimal,scala.Option,java.math.BigDecimal,scala.Option,spire.math.poly.BigDecimalRootRefinement$ApproximationContext,spire.math.Rational,spire.math.Rati$
nal)spire.math.poly.BigDecimalRootRefinement$Approximation
[error]   called from spire.math.poly.BigDecimalRootRefinement$.spire$math$poly$BigDecimalRootRefinement$$QIR(spire.math.poly.BigDecimalRootRefinement$ApproximationContext,spire.math.Rational,spire.math.Rational,java.math.BigDecimal,java.$
ath.BigDecimal)spire.math.poly.BigDecimalRootRefinement$Approximation
[error]   called from spire.math.poly.BigDecimalRootRefinement.refineApproximation(spire.math.poly.BigDecimalRootRefinement$ApproximationContext)spire.math.poly.BigDecimalRootRefinement$Approximation
[error]   called from spire.math.poly.BigDecimalRootRefinement.refine(java.math.MathContext)spire.math.poly.BigDecimalRootRefinement
[error]   called from spire.math.poly.BigDecimalRootRefinement$.apply(spire.math.Polynomial,spire.math.Rational,spire.math.Rational,java.math.MathContext)spire.math.poly.BigDecimalRootRefinement
[error]   called from spire.math.Algebraic.rec$1(spire.math.Algebraic$Expr,scala.Int,java.math.RoundingMode)java.math.BigDecimal
[error]   called from spire.math.Algebraic.toBigDecimal(java.math.MathContext)scala.math.BigDecimal
[error]   called from spire.math.Algebraic.equals(java.lang.Object)scala.Boolean
[error]   called from spire.math.Algebraic.isWhole()scala.Boolean
[error]   called from scala.math.ScalaNumericAnyConversions.isValidInt()scala.Boolean
[error]   called from spire.math.SafeLong.isValidInt()scala.Boolean
[error]   called from scala.math.ScalaNumericAnyConversions.unifiedPrimitiveEquals(java.lang.Object)scala.Boolean
[error]   called from scala.math.BigInt.unifiedPrimitiveEquals(java.lang.Object)scala.Boolean
[error]   called from scala.math.BigInt.equals(java.lang.Object)scala.Boolean
[error]   called from scala.runtime.BoxesRunTime$.equals2(java.lang.Object,java.lang.Object)scala.Boolean
[error]   called from scala.runtime.BoxesRunTime$.equals(java.lang.Object,java.lang.Object)scala.Boolean
[error]   called from scala.collection.mutable.FlatHashTable.findElemImpl(java.lang.Object)java.lang.Object
[error]   called from scala.collection.mutable.HashSet.findElemImpl(java.lang.Object)java.lang.Object
[error]   called from scala.collection.mutable.FlatHashTable.containsElem(java.lang.Object)scala.Boolean
[error]   called from scala.collection.mutable.HashSet.containsElem(java.lang.Object)scala.Boolean
[error]   called from scala.collection.mutable.HashSet.contains(java.lang.Object)scala.Boolean
[error]   called from scala.collection.GenSetLike.apply(java.lang.Object)scala.Boolean
[error]   called from scala.collection.mutable.AbstractSet.apply(java.lang.Object)scala.Boolean
[error]   called from scala.collection.mutable.HashSet.apply(java.lang.Object)java.lang.Object
[error]   called from scala.collection.mutable.ResizableArray.foreach(scala.Function1)scala.Unit
[error]   called from scala.collection.mutable.ArrayBuffer.foreach(scala.Function1)scala.Unit
[error]   called from scala.collection.generic.TraversableForwarder.foreach(scala.Function1)scala.Unit
[error]   called from scala.collection.mutable.ListBuffer.foreach(scala.Function1)scala.Unit
[error]   called from scala.collection.generic.Growable.$$plus$plus$eq(scala.collection.TraversableOnce)scala.collection.generic.Growable
[error]   called from scala.collection.mutable.GrowingBuilder.$$plus$plus$eq(scala.collection.TraversableOnce)scala.collection.generic.Growable
[error]   called from scala.collection.generic.GenericCompanion.apply(scala.collection.Seq)scala.collection.GenTraversable
[error]   called from circle_limit.CircleLimitApp$.<init>()
[error]   exported to JavaScript with @JSExport
[error] involving instantiated classes:
[error]   spire.std.LongAlgebra
[error]   spire.syntax.std.ArrayOps$mcI$sp
[error]   spire.math.poly.PolySparse$
[error]   spire.math.Polynomial$
[error]   spire.math.poly.PolySparse
[error]   spire.math.poly.BigDecimalRootRefinement$
[error]   spire.math.poly.BigDecimalRootRefinement
[error]   spire.math.Algebraic
[error]   spire.math.SafeLongLong
[error]   scala.math.BigInt
[error]   scala.runtime.BoxesRunTime$
[error]   scala.collection.mutable.HashSet
[error]   scala.collection.mutable.ArrayBuffer
[error]   scala.collection.mutable.ListBuffer
[error]   scala.collection.mutable.GrowingBuilder
[error]   scala.collection.mutable.ListBuffer$
[error]   scala.collection.mutable.Set$
...
<many more linking errors>
...
(circleLimitJS/compile:fullOptJS) org.scalajs.core.tools.linker.LinkingException: There were linking errors

Note that if I use version 0.15.0 of rxscala-js then these do not occur.

I assume the bug is caused by both rxscala-js and spire using the cats library, but don't know how to procede further.

MrCurtis commented 6 years ago

By moving back through the commit history and attempting compiling it seems like the problem is introduced in this commit: e107de7aa6f6022ee78f7af3b4a0c5862aa3a582 (which is currently the latest commit).