Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Configure fails when an Objective-C .h file is specified #840

Closed
bos opened this Issue May 24, 2012 · 4 comments

Comments

Projects
None yet
3 participants
Contributor

bos commented May 24, 2012

(Imported from Trac #850, reported by @dankna on 2011-05-27)

When configuring a library or executable which has specified a C header with includes: in its .cabal file, and that header is actually Objective-C or includes other headers which are, configure fails. This is because of the test that Cabal does to determine whether all prerequisite C libraries are present, in which it compiles with gcc directly rather than going through the Haskell compiler as it does in the build phase.

I'm working on a patch to this and should have it in about an hour.

@ghost ghost was assigned May 24, 2012

Contributor

bos commented May 24, 2012

(Imported comment by @dankna on 2011-05-27)

It occurs to me trying to solve this that it's actually a hard problem. Passing the -x <language> flag to gcc is the easy part, but in the general case the header file could be C, ObjC, C++, or even ObjC++. There's no way for Cabal to infer which it is, since it has the same extension, .h, in all four cases.

I see two approaches. One would be to have the package author pass the information in the .cabal file somehow. The drawback is that it's not really clear what a good interface would be. The other would be to try to autodetect it after all somehow, perhaps by getting gcc to spit out dependency information to see what source files (which /can/ have their languages inferred by their filenames) includes what header files.

Contributor

bos commented May 24, 2012

(Imported comment by @dankna on 2011-05-27)

Harvesting the dependency information turns out to be feasible and not too difficult; I'm working on this approach.

Contributor

bos commented May 24, 2012

(Imported comment by @dankna on 2011-05-27)

Patch sent with "darcs send".

jsl commented Feb 28, 2015

This ticket doesn't have any activity since 2011, and the patch that was sent is not attached. I propose closing - please re-open or create a new ticket if this is still desired.

@ttuegel ttuegel closed this Feb 28, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment