Ticket #262 (new enhancement)

Opened 8 months ago

Last modified 3 months ago

Check for required C libraries during configure

Reported by: guest Assigned to:
Priority: high Milestone: Cabal-1.6
Component: Cabal library Version: 1.2.3.0
Severity: normal Keywords:
Cc: gwern0@gmail.com Difficulty: easy (<4 hours)
GHC Version: 6.8.2 Platform:

Description

Cabal should check for required C libraries and other non-Haskell dependencies at the configure stage, rather than just waiting for the linker to fail with an obscure error message during the build stage.

Error messages should be helpful for the typical Cabal user, who should not be assumed to know anything about C libraries or linking.

That is not so simple. For example:

The haddock package current requires the C libraries for readline, due to its dependency on the GHC API. If that library is missing, the user should have some way of figuring out how do the right thing on the given platform - for most Linux distros, install the readline-dev package (as opposed to just readline), for Mac OS X download the GNUreadline framework from the GHC website and drag it into the appropriate Frameworks folder depending on whether this is Tiger and below or Leopard and above, etc.

Change History

03/25/08 05:03:50 changed by guest

See also:

  • #15 and #159 - implement dependency analysis
  • #216 - specify more kinds of dependencies in .cabal files
  • #177 - check for required directories

03/25/08 10:50:54 changed by duncan

I don't think the dependency analysis tickets are relevant here. Just knowing the required C headers and C libs and the include and library search paths is enough information to do the checks. It's just the same check that autoconf does and we can do it in a similar way.

I'm not sure that being able to specify the foreign package dependencies would help here as we don't have a platform independent way of checking for them anyway. Those are more hints for package managers I'd say.

So we should look up exactly how autoconf does these checks. My understanding is:

  • for headers it makes a small .c file that #includes the header and calls gcc/cpp to process the file. It passes the extra include search dirs with the -I flag.
  • for libs it makes a small .o file and calls gcc/ld with the -l and -L flags.

If they fail then it means we cannot find the header/lib in question.

04/24/08 03:20:59 changed by duncan

  • milestone set to Cabal-1.6.

06/09/08 11:53:17 changed by duncan

  • priority changed from normal to high.
  • difficulty changed from normal to easy (<4 hours).

08/25/08 12:28:49 changed by guest

  • cc set to gwern0@gmail.com.