Using subrepo for Chisel project errs

huangapple go评论51阅读模式
英文:

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使用项目

解决此问题的步骤如下:

  1. 更改asyncqueue项目的定义方式
// 不要使用
lazy val asyncqueue = (project in file("asyncqueue-lite"))
// 使用
lazy val asyncqueue = RootProject(uri("https://github.com/ucb-bar/asyncqueue.git"))
  1. asyncqueue添加为依赖项
lazy val root = (project in file("."))
  .dependsOn(asyncqueue) // <- 这是如何使您的项目依赖于另一个项目的方式
  .settings(
    name := &quot;asyncqueue-chisel&quot;,
    // ...
  )
  1. 降级scala2.12.17
ThisBuild / scalaVersion := &quot;2.12.17&quot;
  1. 降级chisel33.5.5。使用3.5.63.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 = &quot;3.5.5&quot;

现在,您的build.sbt应该如下所示:

ThisBuild / scalaVersion := &quot;2.12.17&quot;
ThisBuild / version := &quot;0.1.0&quot;

val chiselVersion = &quot;3.5.5&quot;

lazy val UcbBarAsyncQueue = RootProject(uri(&quot;https://github.com/ucb-bar/asyncqueue.git&quot;))

lazy val root = (project in file(&quot;.&quot;))
  .dependsOn(UcbBarAsyncQueue)
  .settings(
    name := &quot;asyncqueue-chisel&quot;,
    libraryDependencies ++= Seq(
      &quot;edu.berkeley.cs&quot; %% &quot;chisel3&quot; % chiselVersion,
      &quot;edu.berkeley.cs&quot; %% &quot;chiseltest&quot; % &quot;0.6.0&quot; % &quot;test&quot;
    ),
    scalacOptions ++= Seq(
      &quot;-language:reflectiveCalls&quot;,
      &quot;-deprecation&quot;,
      &quot;-feature&quot;,
      &quot;-Xcheckinit&quot;
    ),
    addCompilerPlugin(
      &quot;edu.berkeley.cs&quot; % &quot;chisel3-plugin&quot; % 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:

  1. Replace how asyncqueue project is defined
// instead of
lazy val asyncqueue = (project in file(&quot;asyncqueue-lite&quot;))
// use
lazy val asyncqueue = RootProject(uri(&quot;https://github.com/ucb-bar/asyncqueue.git&quot;))
  1. Add asyncqueue as a dependency
lazy val root = (project in file(&quot;.&quot;))
  .dependsOn(asyncqueue) // &lt;- this is how you make your project depends on another one
  .settings(
    name := &quot;asyncqueue-chisel&quot;,
    // ...
  )
  1. downgrade scala to 2.12.17
ThisBuild / scalaVersion := &quot;2.12.17&quot;
  1. downgrade chisel3 to 3.5.5. Using 3.5.6 or 3.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 = &quot;3.5.5&quot;

Now, your build.sbt should look like

ThisBuild / scalaVersion := &quot;2.12.17&quot;
ThisBuild / version := &quot;0.1.0&quot;

val chiselVersion = &quot;3.5.5&quot;

lazy val UcbBarAsyncQueue = RootProject(uri(&quot;https://github.com/ucb-bar/asyncqueue.git&quot;))

lazy val root = (project in file(&quot;.&quot;))
  .dependsOn(UcbBarAsyncQueue)
  .settings(
    name := &quot;asyncqueue-chisel&quot;,
    libraryDependencies ++= Seq(
      &quot;edu.berkeley.cs&quot; %% &quot;chisel3&quot; % chiselVersion,
      &quot;edu.berkeley.cs&quot; %% &quot;chiseltest&quot; % &quot;0.6.0&quot; % &quot;test&quot;
    ),
    scalacOptions ++= Seq(
      &quot;-language:reflectiveCalls&quot;,
      &quot;-deprecation&quot;,
      &quot;-feature&quot;,
      &quot;-Xcheckinit&quot;
    ),
    addCompilerPlugin(
      &quot;edu.berkeley.cs&quot; % &quot;chisel3-plugin&quot; % 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 := &quot;2.13.10&quot;
ThisBuild / version := &quot;0.1.0&quot;

val chiselVersion = &quot;3.6.0&quot;

lazy val asyncqueue = (project in file(&quot;asyncqueue&quot;))
lazy val root = (project in file(&quot;.&quot;))
  .dependsOn(asyncqueue)
  .settings(
    name := &quot;asyncqueue-chisel&quot;,
    libraryDependencies ++= Seq(
      &quot;edu.berkeley.cs&quot; %% &quot;chisel3&quot; % chiselVersion,
      &quot;edu.berkeley.cs&quot; %% &quot;chiseltest&quot; % &quot;0.6.0&quot; % &quot;test&quot;
    ),
    scalacOptions ++= Seq(
      &quot;-language:reflectiveCalls&quot;,
      &quot;-deprecation&quot;,
      &quot;-feature&quot;,
      &quot;-Xcheckinit&quot;
    ),
    addCompilerPlugin(
      &quot;edu.berkeley.cs&quot; % &quot;chisel3-plugin&quot; % chiselVersion cross CrossVersion.full
    )
  )

huangapple
  • 本文由 发表于 2023年7月6日 20:22:33
  • 转载请务必保留本文链接:https://go.coder-hub.com/76628792.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定