HEAD does not validate on OS X
marlowsd at gmail.com
Tue Mar 17 06:45:16 EDT 2009
Manuel M T Chakravarty wrote:
> 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':
>>> error: '_SC_NPROCESSORS_CONF' undeclared (first use in this
>>> 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,
> Right. The Apple man pages claim the same
> 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.
Aha! The file containing the offending code has #include "PosixSource.h"
at the top, which turns on _POSIX_C_SOURCE. So the patch I'm testing right
now should fix this, because I moved the code to another file that doesn't
have #include "PosixSource.h".
More information about the Cvs-ghc