[Haskell-cafe] Using a library in a executable within same cabal package

Ivan Lazar Miljenovic ivan.miljenovic at gmail.com
Sat Apr 24 06:14:50 EDT 2010

Arnaud Bailly <abailly at oqube.com> writes:
> Not sure this question is totally on-topic.

Sure is.

> Please point me in the right direction if it is not. I would like to
> make a cabal package containing both an executable and several
> libraries,

Each cabal package can contain only one library (which is why gtk2hs is
only now starting to be cabalised).

> and link the main executable to the libraries produced in
> the build. It is not clear how I can achieve that from the
> documentation. I tried Extra-libraries option but it does not work.

By default, you don't need to do anything extra to have executables
using a library in the same package (assuming they have the same source
directory) as GHC will find all the modules it needs.

Cabal-1.8 has a new feature that lets executables explicitly depend upon
the libraries, which means the library doesn't need to get rebuilt
several times.  However, this is causing problems with building haddock
documentation: http://hackage.haskell.org/trac/hackage/ticket/656

Ivan Lazar Miljenovic
Ivan.Miljenovic at gmail.com

More information about the Haskell-Cafe mailing list