[Bug 2407] New: platform.h fails to detect endianess on Mac OS X 10.6

bugzilla at busybox.net bugzilla at busybox.net
Mon Aug 16 00:57:05 UTC 2010


https://bugs.busybox.net/show_bug.cgi?id=2407

           Summary: platform.h fails to detect endianess on Mac OS X 10.6
           Product: Busybox
           Version: 1.17.x
          Platform: Macintosh
        OS/Version: Mac OS
            Status: NEW
          Severity: minor
          Priority: P5
         Component: Other
        AssignedTo: unassigned at busybox.net
        ReportedBy: openwrt-devel at roback.cc
                CC: busybox-cvs at busybox.net
   Estimated Hours: 0.0


Recently, from 1.16.2 to 1.17.1 include/platform.h changed its endianess
detection and it broke compilation on Mac OS X. It seems this broke OpenBSD as
well:

http://lists.busybox.net/pipermail/busybox/2010-August/073031.html

I would suspect it probably breaks NetBSD also. The patch provided in the
mailing list does not work for Mac OS X. If __APPLE__ is treated like
__FreeBSD__ everything compiles fine. For example,


--- a/include/platform.h    2010-07-05 20:25:54.000000000 -0600
+++ b/include/platform.h    2010-08-15 18:21:44.000000000 -0600
@@ -154,14 +154,14 @@
 # include <sex.h>
 # define __BIG_ENDIAN__ (BYTE_ORDER == BIG_ENDIAN)
 # define __BYTE_ORDER BYTE_ORDER
-#elif defined __FreeBSD__
+#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) ||
defined(__APPLE__)
 # include <sys/resource.h>    /* rlimit */
 # include <machine/endian.h>
 # define bswap_64 __bswap64
 # define bswap_32 __bswap32
 # define bswap_16 __bswap16
 # define __BIG_ENDIAN__ (_BYTE_ORDER == _BIG_ENDIAN)
-#elif !defined __APPLE__
+#else
 # include <byteswap.h>
 # include <endian.h>
 #endif

This worked for me for Mac OS X and OpenBSD.. I'd suspect it fixes NetBSD also,
but its untested.

-- 
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


More information about the busybox-cvs mailing list