compiling on solaris 9

Simon Marlow simonmarhaskell at
Mon Sep 17 08:03:31 EDT 2007

skaller wrote:
> On Sat, 2007-09-15 at 11:09 +0200, Sven Panne wrote:
>> On Friday 14 September 2007 16:33, Robert Andersson wrote:
>>> stdint.h seems to be unavailable on solaris 9. Looking at the
>>> rts/posix/OSMem.c file we find
>>>   /* no C99 header stdint.h on OpenBSD? */
>>>   #if defined(openbsd_HOST_OS)
>>>   typedef unsigned long my_uintptr_t;
>>>   #else
>>>   #include <stdint.h>
>>>   typedef uintptr_t my_uintptr_t;
>>>   #endif
>> Uh, oh... Using long doesn't look very 64bit-safe (it could be int, long, long 
>> long, who knows?). IIRC some systems without <stdint.h> provide at least 
>> <inttypes.h>, so we should perhaps use this as a fallback?
> The RIGHT way to do this is rather messy .. but there is only
> one right way to do it.
> 1. Measure the size (and alignment, while at it) of all the
> integer types. (trial execute and run).

We already do this.  Incedentally, the GHC RTS does provide a full 
complement of explicitly-sized types: Stg{Int,Word}{8,16,32,64} which are 
correct on all the platforms we currently support.  The header that defines 
them currently makes some assumptions (e.g. char is 8 bits), but that's 
only because we're a bit lazy; it wouldn't be hard to fix it if we need to 
port to a platform on which it isn't true.

I've just fixed OSMem.c to use StgWord (the pointer-sized integral type) 
instead of my_uintptr_t, I'm validating the fix now.


More information about the Glasgow-haskell-users mailing list