[Numpy-discussion] Endianness not detected in OS X Lion

Nicola nvitacolonna at gmail.com
Wed Oct 15 14:36:17 EDT 2014


In article <543EAC76.7070104 at googlemail.com>,
 Julian Taylor <jtaylor.debian at googlemail.com> wrote:

> On 15.10.2014 16:21, Nicola wrote:
> > Hi,
> > I am trying to install numpy 1.9.0 on OS X Lion 10.7.5 and I get the 
> > same error as reported in this old thread:
> > 
> >     http://thread.gmane.org/gmane.comp.python.numeric.general/47711/
> > 
> ...
> >    ^
> > 
> > no matter whether I use the system's clang or gcc 4.9 (installed with 
> > Homebrew). Is there a workaround for this?
> > 
> 
> hi,
> you probably have an importable endian.h in your path (e.g.
> /usr/include)

That is the case. And endian.h does not seem to define __BYTE_ORDER, 
__LITTLE_ENDIAN and __BIG_ENDIAN, but BYTE_ORDER (__DARWIN_BYTE_ORDER), 
LITTLE_ENDIAN (__DARWIN_LITTLE_ENDIAN) and BIG_ENDIAN 
(__DARWIN_BIG_ENDIAN). I was able to get a successful build by applying 
this patch:

diff --git a/numpy/core/include/numpy/npy_endian.h 
b/numpy/core/include/numpy/npy_endian.h
index 3ba03d0..6684a89 100644
--- a/numpy/core/include/numpy/npy_endian.h
+++ b/numpy/core/include/numpy/npy_endian.h
@@ -10,9 +10,9 @@
     /* Use endian.h if available */
     #include <endian.h>
 
-    #define NPY_BYTE_ORDER __BYTE_ORDER
-    #define NPY_LITTLE_ENDIAN __LITTLE_ENDIAN
-    #define NPY_BIG_ENDIAN __BIG_ENDIAN
+    #define NPY_BYTE_ORDER __DARWIN_BYTE_ORDER
+    #define NPY_LITTLE_ENDIAN __DARWIN_LITTLE_ENDIAN
+    #define NPY_BIG_ENDIAN __DARWIN_BIG_ENDIAN
 #else
     /* Set endianness info using target CPU */
     #include "npy_cpu.h"

> The issue should be fixed in current git master, can you give it a try?
> might be worthwhile to backport the fix to 1.9.1

I confirm that the current master builds just fine.

Thanks!
Nicola




More information about the NumPy-Discussion mailing list