Cabal - C sources in a subdirectory

Isaac Jones ijones at
Tue Nov 16 16:37:57 EST 2004

Einar Karttunen <ekarttun at> writes:

> Hello
> I have problems with Cabal failing to build simple packages
> if C-Sources are inside a subdirectory.

Thanks for the report; this shouldn't be hard to fix.

> C-Sources: c_src/foo.c

I didn't anticipate doing this, but it makes sense, since you can't
specify the path names of executables with the dot syntax as you can
with Haskell sources.

> Build creates c_src/foo.o => dist/build/foo.o (from the 
> C-Sources build instruction in Distribution.Simple.Build).
> In the later stage it tries to look for the object file
> in dist/build/c_src/foo.o which fails.

My preference would be to fix the build stage so that it puts the .o
file in the place where the link stage is looking for it.  Otherwise,
I guess you could get .o files overwriting each-other if they have the
same name!

> A complete minimal example is at

Thanks.  I think I'll be able to fix this tonight.  Are you using the
tarball from the web page, or are you checking things out via darcs?



More information about the Libraries mailing list