简体   繁体   中英

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:

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. To check that it has been installed I have run "ghc-pkg list HUnit" which returns:

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?


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: base >=4.6 && <4.7,
               hunit >=1.2 && <1.4

in my [packagename].cabal file.

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.

My Setup.hs file consists of only

import Distribution.Simple
main = defaultMain

I have tried adding 'import Test.HUnit' to the Setup.hs file:

import Distribution.Simple
import Test.HUnit
main = defaultMain

running 'cabal test' with this Setup.hs gives the same error.

This issue seems to be resolved by capitalizing hunit to HUnit, ie changing

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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