HEAD does not validate on OS X

Manuel M T Chakravarty chak at cse.unsw.edu.au
Tue Mar 17 06:28:06 EDT 2009


Simon Marlow:
> Bryan O'Sullivan wrote:
>> On Sat, Mar 14, 2009 at 5:32 PM, Manuel M T Chakravarty <chak at cse.unsw.edu.au 
>>  <mailto:chak at cse.unsw.edu.au>> wrote:
>>    Compiling the latest HEAD on OS X, I get
>>    RtsFlags.c: In function 'setupRtsFlags':
>>    RtsFlags.c:1150:0:
>>        error: '_SC_NPROCESSORS_CONF' undeclared (first use in this
>>    function)
>> Hmm. That should be using _SC_NPROCESSORS_ONLN, but it's a System V  
>> extension that isn't supported by OS X. You'll have to  
>> conditionally use sysctlbyname("hw.availcpu",...) if HW_AVAILCPU is  
>> defined when <sys/sysctl.h> is included.
>
> Right, I used _SC_NPROCESSORS_CONF in the hope that it might be more  
> portable.  Also, the ticket claimed that it would work on Mac OS X,
>
> http://hackage.haskell.org/trac/ghc/ticket/1741

Right.  The Apple man pages claim the same

   http://developer.apple.com/documentation/Darwin/Reference/ManPages/man3/sysconf.3.html

It also says that _SC_NPROCESSORS_ONLN is supported as well.

So, I had a look at unistd.h on Mac OS X.  It has

> #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
> #define	_SC_NPROCESSORS_CONF		57
> #define	_SC_NPROCESSORS_ONLN		58
> #endif /* !_POSIX_C_SOURCE || _DARWIN_C_SOURCE */

I guess we have _POSIX_C_SOURCE defined and _DARWIN_C_SOURCE not  
defined.

Manuel



More information about the Cvs-ghc mailing list