difficulty building executable

Evan Martin martine at danga.com
Thu Jul 13 21:46:42 EDT 2006

Hi all,

Sorry if this isn't the right list for cabal questions, but I figure
that if I couldn't figure this out from reading the docs, you'd at
least like to be aware of the doc bug.

I have a library that seems to build ok, and along with it I have a
"demo" executable that uses the module.  However, that demo executable
doesn't build: it seems ghc tries to chase a dependency from the
executable back into the library source instead of using the built

Here's the cabal file:
name: DBus
version: 0.1
license: BSD3
license-file: LICENSE
copyright: Copyright (C) 2006 Evan Martin <martine at danga.com>
author: Evan Martin <martine at danga.com>
homepage: http://neugierig.org/software/hdbus
synopsis: DBus bindings
description: Bindings for the DBus API.
  For details on DBus, see the DBus wiki at:
build-depends: base
extensions: ForeignFunctionInterface, OverlappingInstances,
exposed-modules: DBus, DBus.Message, DBus.Connection
other-modules: DBus.Error, DBus.Internal, DBus.Shared

executable: demo
main-is: Demo.hs
other-modules: DBus

Here's the output of build --verbose:
Reading parameters from /home/martine/projects/haskell/hdbus/DBus.buildinfo
Preprocessing library DBus-0.1...
/usr/bin/hsc2hs -D__GLASGOW_HASKELL__=604 -I/usr/include/dbus-1.0
-I/usr/lib/dbus-1.0/include -o DBus.hs DBus.hsc
/usr/bin/hsc2hs -D__GLASGOW_HASKELL__=604 -I/usr/include/dbus-1.0
-I/usr/lib/dbus-1.0/include -o DBus/Message.hs DBus/Message.hsc
/usr/bin/hsc2hs -D__GLASGOW_HASKELL__=604 -I/usr/include/dbus-1.0
-I/usr/lib/dbus-1.0/include -o DBus/Connection.hs DBus/Connection.hsc
/usr/bin/hsc2hs -D__GLASGOW_HASKELL__=604 -I/usr/include/dbus-1.0
-I/usr/lib/dbus-1.0/include -o DBus/Error.hs DBus/Error.hsc
/usr/bin/hsc2hs -D__GLASGOW_HASKELL__=604 -I/usr/include/dbus-1.0
-I/usr/lib/dbus-1.0/include -o DBus/Internal.hs DBus/Internal.hsc
/usr/bin/hsc2hs -D__GLASGOW_HASKELL__=604 -I/usr/include/dbus-1.0
-I/usr/lib/dbus-1.0/include -o DBus/Shared.hs DBus/Shared.hsc
Preprocessing executables for DBus-0.1...
Building DBus-0.1...
/usr/bin/ghc -optc-I/usr/include/dbus-1.0
-optc-I/usr/lib/dbus-1.0/include -package-name DBus -odir dist/build
-hidir dist/build -hide-all-packages --make -i -i. -ffi
-fallow-overlapping-instances -fglasgow-exts -package base-1.0 DBus
DBus.Message DBus.Connection DBus.Error DBus.Internal DBus.Shared
Chasing modules from:
Compiling DBus.Internal    ( ./DBus/Internal.hs, dist/build/DBus/Internal.o )
Compiling DBus.Shared      ( ./DBus/Shared.hs, dist/build/DBus/Shared.o )
Compiling DBus.Error       ( ./DBus/Error.hs, dist/build/DBus/Error.o )
Compiling DBus             ( DBus.hs, dist/build/DBus.o )
Compiling DBus.Message     ( ./DBus/Message.hs, dist/build/DBus/Message.o )
Compiling DBus.Connection  ( ./DBus/Connection.hs,
dist/build/DBus/Connection.o )
/usr/bin/ar q dist/build/libHSDBus-0.1.a dist/build/DBus.o
dist/build/DBus/Message.o dist/build/DBus/Connection.o
dist/build/DBus/Error.o dist/build/DBus/Internal.o
/usr/bin/ar: creating dist/build/libHSDBus-0.1.a
/usr/bin/ld -r -x -o dist/build/HSDBus-0.1.o dist/build/DBus.o
dist/build/DBus/Message.o dist/build/DBus/Connection.o
dist/build/DBus/Error.o dist/build/DBus/Internal.o
/usr/bin/ghc -odir dist/build/demo/demo-tmp -hidir
dist/build/demo/demo-tmp -o dist/build/demo/demo -hide-all-packages
--make -i -i. -package base-1.0 Demo.hs
Chasing modules from: Demo.hs
Compiling DBus.Internal    ( ./DBus/Internal.hs,
dist/build/demo/demo-tmp/DBus/Internal.o )

Internal.hsc:21:8: parse error on input `import'

That "import" it's failing on is because Internal.hsc depends on FFI.
However, Demo.hs doesn't itself refer to Internal anywhere: instead (I
think?) it ought to use the Internal.o that was built in the library.
(As you can see in the log, Internal.o built just fine within the

Please let me know if you need any more information.
I'll post a quick tutorial on the simplest possible build that uses
pkg-config (I saw the earlier thread where it was suggested to support
it directly -- that'd help me too) once I get this working.

More information about the cabal-devel mailing list