在尝试链接到Scala项目中的FastParse时,我遇到了一堆链接器错误,我刚刚尝试在其中构建一个ScalaJS Web应用程序。
我将FastParse的ScalaJS依赖项添加到我的build.sbt中:这里大致是相关的行(完整文件here):
libraryDependencies ++= Seq(
"com.lihaoyi" %%% "fastparse" % "0.4.1"
)
我的错误很多,但这里有一个代表性的错误:
[error] Referring to non-existent class fastparse.Implicits$Repeater$
[error] called from parsers.MainParser$$anonfun$impls$1.apply()fastparse.core.Parser
[error] called from parsers.MainParser$$anonfun$impls$1.apply()java.lang.Object
[error] called from scala.Option.getOrElse(scala.Function0)java.lang.Object
[error] called from fastparse.StringReprOps$.errorMessage(fastparse.utils.ParserInput,java.lang.String,scala.Int)java.lang.String
[error] called from fastparse.core.ParseError.<init>(fastparse.core.Parsed$Failure)
[error] called from fastparse.Api.<init>(scala.reflect.ClassTag,fastparse.utils.ElemSetHelper,fastparse.utils.ReprOps,scala.math.Ordering)
[error] called from fastparse.StringApi.<init>()
[error] called from fastparse.all$.<init>()
[error] called from parsers.MainParser$.<init>()
[error] called from webapp.WebApp$.makeChoices(java.lang.String,java.lang.String)scala.collection.immutable.List
[error] called from webapp.WebApp$.$$js$exported$meth$makeChoices(java.lang.String,java.lang.String)java.lang.Object
[error] called from webapp.WebApp$.makeChoices
[error] exported to JavaScript with @JSExport
[error] involving instantiated classes:
[error] parsers.MainParser$$anonfun$impls$1
[error] scala.None$
[error] scala.Some
[error] fastparse.StringReprOps$
[error] webapp.WebApp$
我做错了什么?
答案 0 :(得分:1)
问题是我需要在build.sbt
中使用两行的JVM版本的FastParse。这显然打破了我的构建。我删除了那一行并清理了我的构建,现在这个项目的ScalaJS和ScalaJVM版本都很好地构建了。
(谢谢李浩义为我发现问题)