Cabal - C sources in a subdirectory

Hello I have problems with Cabal failing to build simple packages if C-Sources are inside a subdirectory. With a Setup.description like: Name: Foo Version: 0.1 License: LGPL Modules: Foo Exposed-Modules: Foo Extensions: ForeignFunctionInterface C-Sources: c_src/foo.c 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. A complete minimal example is at http://www.cs.helsinki.fi/u/ekarttun/haskell/cfail.tar.gz - Einar Karttunen

Einar Karttunen
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 http://www.cs.helsinki.fi/u/ekarttun/haskell/cfail.tar.gz
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? peace, isaac

On 16.11 13:37, Isaac Jones wrote:
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!
Yes, that seems to be the best alternative.
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?
With darcs. - Einar Karttunen

Einar Karttunen
On 16.11 13:37, Isaac Jones wrote:
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!
Yes, that seems to be the best alternative.
I pushed the change a couple of hours ago, so if you do a pull (or grab the tarball from the "code" section of the web page) you should see this fix. Let me know if it works for you. peace, isaac
participants (2)
-
Einar Karttunen
-
Isaac Jones