B-Lang-org / bsc

Bluespec Compiler (BSC)
Other
902 stars 141 forks source link

expandPorts.tcl has hardcoded paths which do not exist. #683

Open jahagirdar opened 3 months ago

jahagirdar commented 3 months ago
export BLUESPECDIR=/tmp/bsc/inst
/tmp/bsc/util/bluetcl-scripts/expandPorts.tcl foo mkfoo mkfoo.v 
couldn't read file "/tmp/bsc/inst/lib/tcllib/bluespec/portUtil.tcl": no such file or directory

Copied portUtil.tcl from src to /tmp/bsc/inst/lib/tcllib/bluespec/ to fix this. Then

/tmp/bsc/util/bluetcl-scripts/expandPorts.tcl foo mkfoo mkfoo.v                                                                                                       
can't find package types

Copied types.tcl to /tmp/bsc/inst/lib/tcllib/bluespec/ and modified /tmp/bsc/inst/lib/tcllib/bluespec/pkgIndex.tcl with the below line to fix this

package ifneeded types 1.0 [list source [file join $dir types.tcl]]

quark17 commented 3 months ago

Note that the files don't have to be copied into the BSC installation. Bluetcl has a search path where it looks for Tcl libraries, and you can add a new directory to that path. A common way is by creating a file ${HOME}/.bluetclrc and adding the following line to it:

lappend auto_path /path/to/libraries/

BSC also consults the environment variable BLUETCLLIBPATH which can be define with a search path.

In any case, thank you for reporting this. The files in bsc/util/bluetcl-scripts/ are provided as examples, and I wouldn't be surprised if there's a lot that needs to be cleaned up there. These files were in the proprietary BSC release, but didn't seem to be necessary for the core of BSC. The bsc-contrib repo is where we put BH/BSV libraries that should be open source but didn't belong as the core of BSC; we maybe should have put the Bluetcl libraries in that repo too. No effort was put into making these files work, they were just placed in /util so that the source is available for anyone who still wanted to use it. It would be good to fix up the files to make them work, or add a README on how to make them work (or at least to set expectations about the state of the files), but it hasn't been a priority.