我正在尝试构建一个使用Euterpea的项目。
运行stack build
时出现以下错误,提示我需要添加Euterpea
到文件的build-depends
部分.cabal
。
$ sb
composition-0.1.0.0: build (lib + exe)
Preprocessing library composition-0.1.0.0...
[2 of 2] Compiling Lib ( src/Lib.hs, .stack-work/dist/x86_64-linux-nix/Cabal-1.24.2.0/build/Lib.o )
/home/matthew/backup/composition/composition/src/Lib.hs:5:1: error:
Failed to load interface for ‘Euterpea’
It is a member of the hidden package ‘Euterpea-2.0.4’.
Perhaps you need to add ‘Euterpea’ to the build-depends in your .cabal file.
Use -v to see a list of the files searched for.
-- While building package composition-0.1.0.0 using:
/home/matthew/.stack/setup-exe-cache/x86_64-linux-nix/Cabal-simple_mPHDZzAJ_1.24.2.0_ghc-8.0.2 --builddir=.stack-work/dist/x86_64-linux-nix/Cabal-1.24.2.0 build lib:composition exe:composition-exe --ghc-options " -ddump-hi -ddump-to-file"
Process exited with code: ExitFailure 1
我在Euterpea
那里添加,然后library
我的.cabal
文件部分如下。
library
hs-source-dirs:
src
build-depends: base >= 4.7 && < 5
, Euterpea
exposed-modules:
Lib
other-modules:
Paths_composition
default-language: Haskell2010
但是,当我再次运行stack build
时,它给出了相同的错误 - 并将我的.cabal
文件更改回原来的样子,library
然后该部分看起来像
library
hs-source-dirs:
src
build-depends:
base >= 4.7 && < 5
exposed-modules:
Lib
other-modules:
Paths_composition
default-language: Haskell2010
为什么要stack build
更改我的cabal
文件?我以前从未见过这种情况发生。
旁注:不确定它是否相关,但.cabal
文件的格式似乎与通常不同。与以前的项目一样,我通过运行自动初始化stack new <project-name>
。我不知道我可能做了什么与以前的项目不同导致stack build
.