#2897: HsFFI.h is not in the default include path for hsc2hs ---------------------------+------------------------------------------------ Reporter: cjs | Owner: Type: bug | Status: new Priority: highest | Milestone: 7.4.1 Component: hsc2hs | Version: 6.10.1 Resolution: | Keywords: Testcase: | Blockedby: Difficulty: Unknown | Os: Unknown/Multiple Blocking: | Architecture: Unknown/Multiple Failure: None/Unknown | ---------------------------+------------------------------------------------
Comment(by duncan): I suggest we go back to having the standard template `#include HsFFI.h` first. The point is: * hsc2hs is a generic tool that can be used for different Haskell implementations * The output of hsc2hs is however not independent of the Haskell implementation. This is because each Haskell implementation has its own C environment, and hsc2hs must use that same environment or it will produce incorrect results. * The HsFFI.h is a reasonable way for each Haskell implementation to set up its C environment. Therefore, when using hsc2hs, the user (or build tool) needs to tell hsc2hs which Haskell implementation they are using, by pointing hsc2hs to that implementation's HsFFI.h file. So running `hsc2hs foo.hsc` on it's own ''should'' fail. That is the right thing to do. There is not enough information from that invocation to produce correct results. It should not guess, that will also produce incorrect results. However it should fail in a comprehensible way and provide the user with an easy way to do the basic thing: 1. search the given -I dirs for HsFFI.h. 2. if it's not found, complain that the user needs to tell it which Haskell implementation to use (because the results depend on the C environment of that implementation). Tell the user they can either specify the -I dir for their impl, or they can use the --ghc `flag`. 3. if the `--ghc` flag is given, hsc2hs calls `ghc-pkg field rts include- dirs`, using the `ghc-pkg` on the $PATH, to find the include dir for HsFFI.h. No support for other ghc instances/versions, just the one on the $PATH. All non-trivial uses should work by specifying the appropriate -I dir for the Haskell impl instance. This combination means that people who really want to invoke hsc2hs manually can do so by giving the --ghc flag. Everyone else can continue to have other build tools call hsc2hs, and pass in the appropriate -I flags for the Haskell impl that they are using. This makes it a relatively lightweight solution, hsc2hs doesn't need to know much about lots of different Haskell implementations, just enough to satisfy casual users. -- Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2897#comment:16> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler _______________________________________________ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs