chipsalliance / chipsalliance/chisel
Unable to build chisel in Builder.scala : object BuildInfo is not a member of package chisel3
- Dominant language
- Scala
- Stars
- 4.8k
- Forks
- 658
- Avg merge
- 18h 59m
- Merged PRs (30d)
- 14
Description
**Type of issue**: Bug Report
**Please provide the steps to reproduce the problem:**
After clone the chisel package from git through cmd.exe and finishes submodule init and update, I tried to build chisel as a project in IntelliJ and its sbt shell.
**What is the current behavior?**
After importing the packages, click "Build", the build output will produce "chisel: build failed" with 2 errors:
```
C:\rocketProjects\rocket-chip\chisel\core\src\main\scala\chisel3\internal\Builder.scala:799:44
object BuildInfo is not a member of package chisel3
val "2" :: major :: _ :: Nil = chisel3.BuildInfo.scalaVersion.split("\\.").toList
C:\rocketProjects\rocket-chip\chisel\core\src\main\scala\chisel3\internal\Builder.scala:800:11
value toInt is not a member of Any
major.toInt
```
I checked the document in the chisel3 package, and realised that the BuildInfo part locates in **Build.sc** :
```scala
private def generateBuildInfo = T {
val outputFile = T.dest / "chisel3" / "BuildInfo.scala"
val firtoolVersionString = firtoolVersion().map("Some(" + _ + ")").getOrElse("None")
val contents =
s"""
|package chisel3
|case object BuildInfo {
| val buildInfoPackage: String = "${artifactName()}"
| val version: String = "${buildVersion()}"
| val scalaVersion: String = "${scalaVersion()}"
| val firtoolVersion: scala.Option[String] = $firtoolVersionString
| override val toString: String = {
| "buildInfoPackage: %s, version: %s, scalaVersion: %s, firtoolVersion %s".format(
| buildInfoPackage, version, scalaVersion, firtoolVersion
| )
| }
|}
|""".stripMargin
os.write(outputFile, contents, createFolders = true)
PathRef(T.dest)
}
```
May I know whether this is the cause of the build error?
**What is the expected behavior?**
Build without error (build success)
**Please tell us about your environment:**
- version: 5.0.0 (latest release)
- OS: Windows 11 Pro
- IntelliJ IDEA Community Edition 2023.1.2
- sbt version: Oracle Openjdk version 1.8.0_202
- java SE 8
**Other Information**
The reason for using IntelliJ is because the OS is Windows, and it will complicate things up very much if I use WSL or setup disk for Ubuntu, so I decided to just go with IntelliJ after watching this tutorial online (https://www.youtube.com/watch?v=BhKz8umpILg).
I attached a screenshot of the IntelliJ producing the 2 errors mentioned above in the Builder.scala:
Thank you so much!!
**What is the use case for changing the behavior?**
Contributor guide
Research direction
Start by reproducing the IntelliJ or sbt build on Windows with the reported Java 8 and Chisel 5.0.0 setup. Read core/src/main/scala/chisel3/internal/Builder.scala around lines 799-800 and the Build.sc generateBuildInfo definition to trace why chisel3.BuildInfo is unavailable. Done means the project builds without the reported BuildInfo and toInt errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- scala
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100