Ticket #850 (assigned defect)

Opened 2 years ago

Last modified 2 years ago

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

Reported by: dankna Owned by: dankna
Priority: normal Milestone:
Component: Cabal library Version: HEAD
Severity: normal Keywords: configure mac objective-c
Cc: dankna@… Difficulty: unknown
GHC Version: Platform:

Description

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.

Change History

Changed 2 years ago by dankna

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.

Changed 2 years ago by dankna

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

Changed 2 years ago by dankna

Patch sent with "darcs send".

Changed 2 years ago by dankna

  • owner set to dankna
  • status changed from new to assigned
Note: See TracTickets for help on using tickets.