Removal of #include <HsFFI.h> from template-hsc.h breaks largefile support on 32bit Linux

Eugene Crosser crosser at
Thu Feb 16 14:25:00 CET 2012

Hello Simon, thanks for your attention :)

On 02/16/2012 04:25 PM, Simon Marlow wrote:

>> I found that earlier versions of hsc2hs included HsFFI.h into the
>> As I understand, this situation means that while the ghc itself and
>> haskell programs compiled by it are largefile-capable, any third party
>> modules that contain .hsc files are not. If I am right, this is probably
>> not a good thing.

> We discovered this during the 7.4 cycle:
> Packages that were relying on `HsFFI.h` to define `_FILE_OFFSET_BITS`
> should no longer do this, instead they should use an appropriate
> autoconf script or some other method.  See the `unix` package for an
> example of how to do this.  It was really a mistake that it worked before.

But that means that the "C build environment" has to be constructed
independently for each module (that needs it), and consequently is not
guaranteed to match the compiler's environment. Would it be better (more
consistent) to propagate GHC's (or other compiler's) environment by
default, along the lines of the comment #16? To cite Duncan, "each
Haskell implementation has its own C environment, and hsc2hs must use
that same environment or it will produce incorrect results."

Just a thought, and, as I said, I am not really qualified to argue...


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 262 bytes
Desc: OpenPGP digital signature
URL: <>

More information about the Glasgow-haskell-users mailing list