我从Shake 手册的“运行”部分创建了推荐的build.sh
文件:
#!/bin/sh
mkdir -p _shake
ghc --make Shakefile.hs -v -rtsopts -threaded -with-rtsopts=-I0 -outputdir=_shake -o _shake/build && _shake/build "$@"
但运行该脚本会出现以下错误:
[1 of 1] Compiling Main ( Shakefile.hs, _shake/Main.o )
Shakefile.hs:1:1: error:
Could not find module ‘Development.Shake’
Use -v (or `:set -v` in ghci) to see a list of the files searched for.
|
1 | import Development.Shake
| ^^^^^^^^^^^^^^^^^^^^^^^^
Shakefile.hs:2:1: error:
Could not find module ‘Development.Shake.Command’
Use -v (or `:set -v` in ghci) to see a list of the files searched for.
|
2 | import Development.Shake.Command
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Shakefile.hs:3:1: error:
Could not find module ‘Development.Shake.FilePath’
Use -v (or `:set -v` in ghci) to see a list of the files searched for.
|
3 | import Development.Shake.FilePath
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Shakefile.hs:4:1: error:
Could not find module ‘Development.Shake.Util’
Use -v (or `:set -v` in ghci) to see a list of the files searched for.
|
4 | import Development.Shake.Util
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
我做了cabal v2-install shake --installpath=bin
,但之后仍然得到同样的错误。我也试过bin/shake
但得到同样的错误。
我尝试在 中添加-package shake
命令ghc
,build.sh
但收到此错误:
<command line>: cannot satisfy -package shake
(use -v for more information)
按照建议添加-v
会出现此错误:
Glasgow Haskell Compiler, Version 8.8.4, stage 2 booted by GHC version 8.8.3
Using binary package database: /Users/avh4/.ghcup/ghc/8.8.4/lib/ghc-8.8.4/package.conf.d/package.cache
package flags [-package shake{package shake True ([])}]
loading package database /Users/avh4/.ghcup/ghc/8.8.4/lib/ghc-8.8.4/package.conf.d
<command line>: cannot satisfy -package shake
(use -v for more information)
在没有Haskell 堆栈的情况下使用 Shake 的正确方法是什么(最好只使用通过ghcup
和/或 cabal-install v2 命令安装的 ghc 8.8 )?