cabal executable using local hsc modules

Andreas Voellmy andreas.voellmy at gmail.com
Mon Mar 25 14:46:59 CET 2013


Hi,

I have a library that has some modules written as .hsc files and I want to
include some executables that use those modules. Cabal doesn't seem to find
the modules when it is building the executable. It complains that the
module used by the executable is in a hidden package (of the same name as
the package being built). Adding the package as a dependency in the
executable section doesn't work since it references a library defined in
the same package.  Is this a bug?   I've attached three files illustrating
the problem. A.hsc is a tiny module in the library, B.hs is the executable
that uses A, foo.cabal defines both the library and the executable. I am
using

$ cabal --version
cabal-install version 1.16.0.2
using version 1.16.0.3 of the Cabal library

and when I run "cabal install -v" I get

$ cabal install --disable-library-profiling
Resolving dependencies...
Configuring foo-1.0...
Building foo-1.0...
Preprocessing library foo-1.0...
[1 of 1] Compiling A                ( dist/build/A.hs, dist/build/A.o )
In-place registering foo-1.0...
Preprocessing executable 'B' for foo-1.0...

B.hs:3:8:
    Could not find module `A'
    It is a member of the hidden package `foo-1.0'.
    Perhaps you need to add `foo' to the build-depends in your .cabal file.
    Use -v to see a list of the files searched for.
Failed to install foo-1.0
cabal: Error: some packages failed to install:
foo-1.0 failed during the building phase. The exception was:
ExitFailure 1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/libraries/attachments/20130325/03d902eb/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: foo.cabal
Type: application/octet-stream
Size: 192 bytes
Desc: not available
URL: <http://www.haskell.org/pipermail/libraries/attachments/20130325/03d902eb/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: B.hs
Type: application/octet-stream
Size: 57 bytes
Desc: not available
URL: <http://www.haskell.org/pipermail/libraries/attachments/20130325/03d902eb/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: A.hsc
Type: application/octet-stream
Size: 31 bytes
Desc: not available
URL: <http://www.haskell.org/pipermail/libraries/attachments/20130325/03d902eb/attachment-0002.obj>


More information about the Libraries mailing list