[MacPorts] #45570: gpsd @3.11: driver_rtcm2.c:125:2: error: #error Unknown endianness!

MacPorts noreply at macports.org
Thu Apr 30 03:16:14 PDT 2015

#45570: gpsd @3.11: driver_rtcm2.c:125:2: error: #error Unknown endianness!
  Reporter:  ryandesign@…  |      Owner:  ryandesign@…
      Type:  defect        |     Status:  closed
  Priority:  Normal        |  Milestone:
 Component:  ports         |    Version:  2.3.2
Resolution:  fixed         |   Keywords:  tiger leopard
      Port:  gpsd          |

Comment (by ryandesign@…):

 I may as well reproduce here what I sent to the developer, in case anyone
 is interested:


 The problem is that on 10.5 only the following are defined:

 $ cpp -E -dM < /dev/null | grep -E '(BYTE|ENDIAN)'
 #define __BIG_ENDIAN__ 1
 #define _BIG_ENDIAN 1

 That's on a PowerPC Mac; on an Intel Mac, presumably `__LITTLE_ENDIAN__`
 and `_LITTLE_ENDIAN` would both be defined to `1`.

 This runs afoul of the code in gpsd's driver_rtcm2.c which first does

 * BSD uses _BYTE_ORDER, and Linux uses __BYTE_ORDER.
 #if !defined( __BYTE_ORDER) && defined(_BYTE_ORDER)
 #if !defined( __BIG_ENDIAN) && defined(_BIG_ENDIAN)
 #if !defined( __LITTLE_ENDIAN) && defined(_LITTLE_ENDIAN)

 And then does this:

 * Darwin (Mac OS X) uses special defines.
 #if !defined( __BYTE_ORDER) && defined(__DARWIN_BYTE_ORDER)
 #if !defined( __BIG_ENDIAN) && defined(__DARWIN_BIG_ENDIAN)
 #if !defined( __LITTLE_ENDIAN) && defined(__DARWIN_LITTLE_ENDIAN)

 On 10.5, in the first block, on PowerPC, `__BIG_ENDIAN` gets set to
 `_BIG_ENDIAN`, i.e. `1` (or on Intel, `__LITTLE_ENDIAN` gets set to
 `_LITTLE_ENDIAN`, i.e. `1`), and `1` doesn't match either of the possible
 values of `__BYTE_ORDER` == `__DARWIN_BYTE_ORDER` (which is either
 `__DARWIN_BIG_ENDIAN` == `4321` or `__DARWIN_LITTLE_ENDIAN` == `1234`),
 which is where the error trips:

 #error Unknown endianness!
 #endif /* __BYTE_ORDER */

 Assuming the BSD block is correct for BSD, the solution I propose is to
 reverse the order of these two blocks, putting the Darwin block before the
 BSD one. This allows the build to succeed on 10.5 at least.

Ticket URL: <https://trac.macports.org/ticket/45570#comment:5>
MacPorts <https://www.macports.org/>
Ports system for OS X

More information about the macports-tickets mailing list