Removal of #include <HsFFI.h> from template-hsc.h breaks largefile support on 32bit Linux
crosser at average.org
Wed Feb 15 13:31:42 CET 2012
I am new here, but I want to report what I suspect may be a problem.
I ran into it while using some third-party package from hackage on a
32bit Linux with ghc 7.4.1. I discovered that off_t fields in the .hsc
files in the package where interpreted as 32bit words. I suspected that
64bit offsets should be used because even 32bit Linux has "largefile"
support with 64bit offsets.
I found that earlier versions of hsc2hs included HsFFI.h into the
generated C code, and HsFFI.h in turn indirectly includes ghcautoconf.h
#define _FILE_OFFSET_BITS 64
in it. So, if I build the .hsc files like this:
hsc2hs -i HsFFI.h filename.hsc
then off_t is 64bit and 64bit file manipulation syscalls are used. I did
not check it but I think that earlier versions of hsc2hs where creating
largefile-aware version of the code by default, because HsFFI.h was
included in the code by default.
This is a simple test program:
==== checktypes.hsc ====
-- run like this: hsc2hs checktypes.hsc && runhaskell checktypes.hs
module Main where
main = do
putStrLn $ show (#size off_t)
$ hsc2hs checktypes.hsc && runhaskell checktypes.hs
$ hsc2hs -i HsFFI.h checktypes.hsc && runhaskell checktypes.hs
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.
Please can some guru take a look at this issue?
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 262 bytes
Desc: OpenPGP digital signature
More information about the Glasgow-haskell-users