Linking executables and the library of a Cabal package description

John D. Ramsdell ramsdell at mitre.org
Tue Oct 16 20:09:14 EDT 2007


Duncan Coutts <duncan.coutts at worc.ox.ac.uk> writes:

> I think the problem here is search paths. Try adding . to the
> Hs-Source-Dirs, or alternatively moving everything into the root dir
> rather than under exec.

If you add . to the Hs-Source-Dirs, you build module A twice, once for
the library, and once for the building of b.  Notice b is not linked
with the library.

$ runhaskell Setup.hs build
Preprocessing library a-1.0...
Preprocessing executables for a-1.0...
Building a-1.0...
[1 of 1] Compiling A                ( A.hs, dist/build/A.o )
/usr/bin/ar: creating dist/build/libHSa-1.0.a
[1 of 2] Compiling A                ( A.hs, dist/build/b/b-tmp/A.o )
[2 of 2] Compiling Main             ( exec/Main.hs, dist/build/b/b-tmp/Main.o )
Linking dist/build/b/b ...
$

> This smells like a bug in cabal to me.

Time for me to submit a bug report?

John


More information about the Libraries mailing list