简体   繁体   English

阴谋错误:至少缺少以下依赖项:

[英]Cabal error: At least the following dependencies are missing:

I am trying to create a test suite for my Haskell/Cabal package using HUnit, and am getting the following error when I run cabal test: 我正在尝试使用HUnit为我的Haskell / Cabal软件包创建一个测试套件,并且在运行Cabal测试时遇到以下错误:

matthew@matthew-Gnawty:~/backup/projects/apollo$ cabal test
Re-configuring with test suites enabled. If this fails, please run configure
manually.
Resolving dependencies...
Configuring apollo-0.1.0.0...
cabal: At least the following dependencies are missing:
hunit >=1.2 && <1.4

I have run 'cabal hunit' to install hunit. 我已经运行'cabal hunit'来安装hunit。 To check that it has been installed I have run "ghc-pkg list HUnit" which returns: 要检查它是否已安装,我运行了“ ghc-pkg list HUnit”,它返回:

matthew@matthew-Gnawty:~/backup/projects/apollo$ ghc-pkg list HUnit
/var/lib/ghc/package.conf.d
   HUnit-1.2.5.2
/home/matthew/.ghc/x86_64-linux-7.6.3/package.conf.d
   HUnit-1.3.1.1

Why can't cabal configure properly? 为什么cabal无法正确配置?


I have tried: 我努力了:

To ensure that either the global (1.2.5.2) version or local (1.3.1.1) version is noticed by cabal by specifying the build-depends as: 通过将build-depends指定为以下内容,以确保cabal注意到全局(1.2.5.2)版本或本地(1.3.1.1)版本:

build-depends: base >=4.6 && <4.7,
               hunit >=1.2 && <1.4

in my [packagename].cabal file. 在我的[packagename] .cabal文件中。

I have also noticed https://www.haskell.org/cabal/FAQ.html#runghc-setup-complains-of-missing-packages , and did not understand the explanation given there, and how the Setup.hs is relevant. 我也注意到https://www.haskell.org/cabal/FAQ.html#runghc-setup-complains-of-missing-packages ,并且不理解那里给出的解释以及Setup.hs的相关性。

My Setup.hs file consists of only 我的Setup.hs文件仅包含

import Distribution.Simple
main = defaultMain

I have tried adding 'import Test.HUnit' to the Setup.hs file: 我尝试将“导入Test.HUnit”添加到Setup.hs文件中:

import Distribution.Simple
import Test.HUnit
main = defaultMain

running 'cabal test' with this Setup.hs gives the same error. 使用此Setup.hs运行“ cabal测试”会产生相同的错误。

This issue seems to be resolved by capitalizing hunit to HUnit, ie changing 这个问题似乎可以通过将hunit大写为HUnit来解决,即更改

build-depends: base >=4.6 && <4.7,
               hunit >=1.2 && <1.4

to

build-depends: base >=4.6 && <4.7,
               HUnit >=1.2 && <1.4

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM