英文:
Using subrepo for Chisel project errs
问题
我试图在我的项目中使用AsyncQueue子仓库(https://github.com/ucb-bar/asyncqueue),类似于Chisel Multiclock Demos中的ClockDividerDemo(https://github.com/edwardcwang/chisel-multiclock-demo/)。
然而,sbt出现错误:
[error] ... .scala:9:8: 未找到对象: freechips
[error] import freechips.asyncqueue.{AsyncQueue, AsyncQueueParams}
[error] ^
[error] 找到一个错误
具体来说,我将以下行添加到我的build.sbt文件的末尾:
lazy val asyncqueue = (project in file("asyncqueue-lite"))
lazy val myself = (project in file(".")).dependsOn(asyncqueue)
并且在我的Scala文件中添加了这行:
import freechips.asyncqueue.{AsyncQueue, AsyncQueueParams}
编辑:
完整的build.sbt文件如下:
ThisBuild / scalaVersion := "2.13.8"
ThisBuild / version := "0.1.0"
val chiselVersion = "3.6.0"
lazy val root = (project in file("."))
.settings(
name := "asyncqueue-chisel",
libraryDependencies ++= Seq(
"edu.berkeley.cs" %% "chisel3" % chiselVersion,
"edu.berkeley.cs" %% "chiseltest" % "0.6.0" % "test"
),
scalacOptions ++= Seq(
"-language:reflectiveCalls",
"-deprecation",
"-feature",
"-Xcheckinit"
),
addCompilerPlugin(
"edu.berkeley.cs" % "chisel3-plugin" % chiselVersion cross CrossVersion.full
)
)
lazy val asyncqueue = (project in file("asyncqueue-lite"))
lazy val myself = (project in file(".")).dependsOn(asyncqueue)
英文:
I am trying to use the AsyncQueue subrepo (https://github.com/ucb-bar/asyncqueue) in my own project, much as the ClockDividerDemo in Chisel Multiclock Demos (https://github.com/edwardcwang/chisel-multiclock-demo/).
However, sbt errs:
[error] ... .scala:9:8: not found: object freechips
[error] import freechips.asyncqueue.{AsyncQueue, AsyncQueueParams}
[error] ^
[error] one error found
To be specific, I added these lines to the tail of my build.sbt:
lazy val asyncqueue = (project in file("asyncqueue-lite"))
lazy val myself = (project in file(".")).dependsOn(asyncqueue)
And this line to my own Scala file:
import freechips.asyncqueue.{AsyncQueue, AsyncQueueParams}
EDIT:
Complete build.sbt:
ThisBuild / scalaVersion := "2.13.8"
ThisBuild / version := "0.1.0"
val chiselVersion = "3.6.0"
lazy val root = (project in file("."))
.settings(
name := "asyncqueue-chisel",
libraryDependencies ++= Seq(
"edu.berkeley.cs" %% "chisel3" % chiselVersion,
"edu.berkeley.cs" %% "chiseltest" % "0.6.0" % "test"
),
scalacOptions ++= Seq(
"-language:reflectiveCalls",
"-deprecation",
"-feature",
"-Xcheckinit"
),
addCompilerPlugin(
"edu.berkeley.cs" % "chisel3-plugin" % chiselVersion cross CrossVersion.full
)
)
lazy val asyncqueue = (project in file("asyncqueue-lite"))
lazy val myself = (project in file(".")).dependsOn(asyncqueue)
答案1
得分: 1
以下是您提供的内容的中文翻译:
我在任何Artifactory中都找不到发布的asyncqueue版本。要使您的项目依赖于该项目,sbt允许您在它们没有打包时直接从GitHub使用项目。
解决此问题的步骤如下:
- 更改
asyncqueue
项目的定义方式
// 不要使用
lazy val asyncqueue = (project in file("asyncqueue-lite"))
// 使用
lazy val asyncqueue = RootProject(uri("https://github.com/ucb-bar/asyncqueue.git"))
- 将
asyncqueue
添加为依赖项
lazy val root = (project in file("."))
.dependsOn(asyncqueue) // <- 这是如何使您的项目依赖于另一个项目的方式
.settings(
name := "asyncqueue-chisel",
// ...
)
- 降级
scala
至2.12.17
- asyncqueue依赖于scala 2.12。您可以分叉该项目并尝试构建一个与
scala 2.13
兼容的发布版本。这里有一个关于如何为不同的scala版本交叉编译核心库的问题的问题。 - chisel3-plugin没有发布适用于
scala 2.12.18
的版本,这是截至2023年6月7日发布的最新scala 2.12.x。
- asyncqueue依赖于scala 2.12。您可以分叉该项目并尝试构建一个与
ThisBuild / scalaVersion := "2.12.17"
- 降级
chisel3
至3.5.5
。使用3.5.6
或3.6.0
会引发一些版本冲突。将显示以下错误消息:
[error] this can be overridden using libraryDependencySchemes or evictionErrorLevel
[error] (ssExtractDependencies) found version conflict(s) in library dependencies; some are suspected to be binary incompatible:
[error]
[error] * edu.berkeley.cs:chisel3_2.12:3.5.6 (pvp) is selected over {3.1.+, 3.1.8}
[error] +- asyncqueue-chisel:asyncqueue-chisel_2.12:0.1.0 (depends on 3.5.6)
[error] +- edu.berkeley.cs:chisel-iotesters_2.12:1.2.10 (depends on 3.1.8)
[error] +- asyncqueue-lite:asyncqueue-lite_2.12:1.0.0 (depends on 3.1.+)
这是如何设置正确的chisel3
版本的方式:
val chiselVersion = "3.5.5"
现在,您的build.sbt
应该如下所示:
ThisBuild / scalaVersion := "2.12.17"
ThisBuild / version := "0.1.0"
val chiselVersion = "3.5.5"
lazy val UcbBarAsyncQueue = RootProject(uri("https://github.com/ucb-bar/asyncqueue.git"))
lazy val root = (project in file("."))
.dependsOn(UcbBarAsyncQueue)
.settings(
name := "asyncqueue-chisel",
libraryDependencies ++= Seq(
"edu.berkeley.cs" %% "chisel3" % chiselVersion,
"edu.berkeley.cs" %% "chiseltest" % "0.6.0" % "test"
),
scalacOptions ++= Seq(
"-language:reflectiveCalls",
"-deprecation",
"-feature",
"-Xcheckinit"
),
addCompilerPlugin(
"edu.berkeley.cs" % "chisel3-plugin" % chiselVersion cross CrossVersion.full
)
)
并且以下行:
import freechips.asyncqueue.{AsyncQueue, AsyncQueueParams}
应该能够编译无错误。
英文:
I couldn't find any release published in any artifactory for asyncqueue. To make your project depends on that one, sbt lets you use projects directly from github when they are not packed.
The steps to solve the issue are:
- Replace how
asyncqueue
project is defined
// instead of
lazy val asyncqueue = (project in file("asyncqueue-lite"))
// use
lazy val asyncqueue = RootProject(uri("https://github.com/ucb-bar/asyncqueue.git"))
- Add
asyncqueue
as a dependency
lazy val root = (project in file("."))
.dependsOn(asyncqueue) // <- this is how you make your project depends on another one
.settings(
name := "asyncqueue-chisel",
// ...
)
- downgrade
scala
to2.12.17
- asyncqueue depends on scala 2.12. You can fork the project and try to make build a released compatible with
scala 2.13
. Here you have a question about How a core library can be cross-compiled for different scala versions - chisel3-plugin doesn't have a release for
scala 2.12.18
which is the latest scala 2.12.x released on June 7, 2023
- asyncqueue depends on scala 2.12. You can fork the project and try to make build a released compatible with
ThisBuild / scalaVersion := "2.12.17"
- downgrade
chisel3
to3.5.5
. Using3.5.6
or3.6.0
will cause some conflict version. The following error message will be showed
[error] this can be overridden using libraryDependencySchemes or evictionErrorLevel
[error] (ssExtractDependencies) found version conflict(s) in library dependencies; some are suspected to be binary incompatible:
[error]
[error] * edu.berkeley.cs:chisel3_2.12:3.5.6 (pvp) is selected over {3.1.+, 3.1.8}
[error] +- asyncqueue-chisel:asyncqueue-chisel_2.12:0.1.0 (depends on 3.5.6)
[error] +- edu.berkeley.cs:chisel-iotesters_2.12:1.2.10 (depends on 3.1.8)
[error] +- asyncqueue-lite:asyncqueue-lite_2.12:1.0.0 (depends on 3.1.+)
This is how you can set the correct chisel3
version
val chiselVersion = "3.5.5"
Now, your build.sbt
should look like
ThisBuild / scalaVersion := "2.12.17"
ThisBuild / version := "0.1.0"
val chiselVersion = "3.5.5"
lazy val UcbBarAsyncQueue = RootProject(uri("https://github.com/ucb-bar/asyncqueue.git"))
lazy val root = (project in file("."))
.dependsOn(UcbBarAsyncQueue)
.settings(
name := "asyncqueue-chisel",
libraryDependencies ++= Seq(
"edu.berkeley.cs" %% "chisel3" % chiselVersion,
"edu.berkeley.cs" %% "chiseltest" % "0.6.0" % "test"
),
scalacOptions ++= Seq(
"-language:reflectiveCalls",
"-deprecation",
"-feature",
"-Xcheckinit"
),
addCompilerPlugin(
"edu.berkeley.cs" % "chisel3-plugin" % chiselVersion cross CrossVersion.full
)
)
and the line
import freechips.asyncqueue.{AsyncQueue, AsyncQueueParams}
should compile without errors
答案2
得分: 0
这是你需要的build.sbt文件的翻译:
ThisBuild / scalaVersion := "2.13.10"
ThisBuild / version := "0.1.0"
val chiselVersion = "3.6.0"
lazy val asyncqueue = (project in file("asyncqueue"))
lazy val root = (project in file("."))
.dependsOn(asyncqueue)
.settings(
name := "asyncqueue-chisel",
libraryDependencies ++= Seq(
"edu.berkeley.cs" %% "chisel3" % chiselVersion,
"edu.berkeley.cs" %% "chiseltest" % "0.6.0" % "test"
),
scalacOptions ++= Seq(
"-language:reflectiveCalls",
"-deprecation",
"-feature",
"-Xcheckinit"
),
addCompilerPlugin(
"edu.berkeley.cs" % "chisel3-plugin" % chiselVersion cross CrossVersion.full
)
)
希望这对你有所帮助!
英文:
It turned out that I need the following build.sbt:
ThisBuild / scalaVersion := "2.13.10"
ThisBuild / version := "0.1.0"
val chiselVersion = "3.6.0"
lazy val asyncqueue = (project in file("asyncqueue"))
lazy val root = (project in file("."))
.dependsOn(asyncqueue)
.settings(
name := "asyncqueue-chisel",
libraryDependencies ++= Seq(
"edu.berkeley.cs" %% "chisel3" % chiselVersion,
"edu.berkeley.cs" %% "chiseltest" % "0.6.0" % "test"
),
scalacOptions ++= Seq(
"-language:reflectiveCalls",
"-deprecation",
"-feature",
"-Xcheckinit"
),
addCompilerPlugin(
"edu.berkeley.cs" % "chisel3-plugin" % chiselVersion cross CrossVersion.full
)
)
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论