
Hello, I'm using Haskell Platform 2011.2.0.1 on MacOS (Snow Leapard). hsc2hs converts (#const sizeof(struct stat)) (#peek struct stat, st_mtimespec) to 108 36 but the correct values are 144 32. Is this a bug of hsc2hs? gcc-4.0 says sizeof (struct stat) is 108 while gcc-4.2 (default) says that is 144. --Kazu

hsc2hs converts (#const sizeof(struct stat)) (#peek struct stat, st_mtimespec) to 108 36 but the correct values are 144 32.
Is this a bug of hsc2hs?
Not directly. hsc2hs calls the C compiler to determine these numbers. It seems it is calling gcc-4.0 rather than gcc-4.2. It might be a bug that it is calling the wrong compiler, but that might just be misconfiguration in your environment, or in the Haskell Platform.
gcc-4.0 says sizeof (struct stat) is 108 while gcc-4.2 (default) says that is 144.

On 13/05/2011 08:20, Malcolm Wallace wrote:
hsc2hs converts (#const sizeof(struct stat)) (#peek struct stat, st_mtimespec) to 108 36 but the correct values are 144 32.
Is this a bug of hsc2hs?
Not directly. hsc2hs calls the C compiler to determine these numbers. It seems it is calling gcc-4.0 rather than gcc-4.2. It might be a bug that it is calling the wrong compiler, but that might just be misconfiguration in your environment, or in the Haskell Platform.
gcc-4.0 says sizeof (struct stat) is 108 while gcc-4.2 (default) says that is 144.
It presumably depends on whether you're using the 32 or 64-bit version of GHC. Which is it? Cheers, Simon

Hello,
Not directly. hsc2hs calls the C compiler to determine these numbers. It seems it is calling gcc-4.0 rather than gcc-4.2. It might be a bug that it is calling the wrong compiler, but that might just be misconfiguration in your environment, or in the Haskell Platform.
gcc-4.0 says sizeof (struct stat) is 108 while gcc-4.2 (default) says that is 144.
It presumably depends on whether you're using the 32 or 64-bit version of GHC. Which is it?
% file /Library/Frameworks/GHC.framework/Versions/7.0.3-i386/usr/lib/ghc-7.0.3/ghc /Library/Frameworks/GHC.framework/Versions/7.0.3-i386/usr/lib/ghc-7.0.3/ghc: Mach-O executable i386 So, it's 32bit. (If 64bit, "file" displays "64bit".) --Kazu

On 17/05/2011 03:10, Kazu Yamamoto (山本和彦) wrote:
Hello,
Not directly. hsc2hs calls the C compiler to determine these numbers. It seems it is calling gcc-4.0 rather than gcc-4.2. It might be a bug that it is calling the wrong compiler, but that might just be misconfiguration in your environment, or in the Haskell Platform.
gcc-4.0 says sizeof (struct stat) is 108 while gcc-4.2 (default) says that is 144.
It presumably depends on whether you're using the 32 or 64-bit version of GHC. Which is it?
% file /Library/Frameworks/GHC.framework/Versions/7.0.3-i386/usr/lib/ghc-7.0.3/ghc /Library/Frameworks/GHC.framework/Versions/7.0.3-i386/usr/lib/ghc-7.0.3/ghc: Mach-O executable i386
So, it's 32bit. (If 64bit, "file" displays "64bit".)
Ok, you are using GHC 32-bit on a system that normally compiles for 64-bit by default. That's fine, and it should work, but you might need to be careful when combining code compiled by gcc with code compiled by GHC. In particular, you should use gcc -m32. Cheers, Simon
participants (3)
-
Kazu Yamamoto
-
Malcolm Wallace
-
Simon Marlow