clash-lang / clash-compiler

Haskell to VHDL/Verilog/SystemVerilog compiler
https://clash-lang.org/
Other
1.43k stars 151 forks source link

Add ability to use a different ghc version other than the ghc build clash #2675

Open evan0greenup opened 7 months ago

evan0greenup commented 7 months ago

I build ghc via stack build. stack use its own ghc other than system ghc.

As a result, the ghc build clash will not locate in PATH environment variable when clash runs.

Is there any way to overcome this issue? (build flag or other option, which configure the build procedures of clash without alter my system environment)?

rowanG077 commented 7 months ago

I'm not 100% sure if I get what you want to do. In general I think the easiest setup is using the clash-starters or something close to it which I expect should sidestep this issue since it uses the same GHC version for everything.

DigitalBrains1 commented 7 months ago

I agree with Rowan, I think you should generally house your Clash design in a starter project. I am also not 100% sure if this is your question.

That said, for quick one-off tests, I do have this:

$ cat ~/.local/bin/clash-1.8
#!/bin/sh

unset DIR
DIR="$(pwd)"
cd ~/src/clash/clash-one-eight
stack run --cwd "$DIR" clash -- "$@"
$ cat ~/.local/bin/clashi-1.8 
#!/bin/sh

unset DIR
DIR="$(pwd)"
cd ~/src/clash/clash-one-eight
stack run --cwd "$DIR" clashi -- "$@"

It helps me to run a freestanding .hs file with a Clash design. The dir clash-one-eight is just an empty starter project, made with

$ stack new clash-one-eight clash-lang/simple
$ cd clash-one-eight
$ stack build