[MacPorts] #53602: libassuan 2.4.3_1 won't build on PPC Tiger, Mac OS X 10.4.11, because 'INADDR_LOOPBACK' undeclared

MacPorts noreply at macports.org
Sun Feb 19 11:59:30 UTC 2017


#53602: libassuan 2.4.3_1 won't build on PPC Tiger, Mac OS X 10.4.11, because
'INADDR_LOOPBACK' undeclared
------------------------+-----------------
  Reporter:  ballapete  |      Owner:
      Type:  defect     |     Status:  new
  Priority:  Normal     |  Milestone:
 Component:  ports      |    Version:
Resolution:             |   Keywords:
      Port:  libassuan  |
------------------------+-----------------

Comment (by ballapete):

 IMO the error should not happen … The source file has:

 {{{
    21   #ifdef HAVE_CONFIG_H
    22   #include <config.h>
    23   #endif
    24
    25   #include <stdio.h>
    26   #include <stdlib.h>
    27   #ifdef HAVE_W32_SYSTEM
    28   # define WIN32_LEAN_AND_MEAN
    29   # include <windows.h>
    30   # include <wincrypt.h>
    31   #ifndef HAVE_W32CE_SYSTEM
    32   # include <io.h>
    33   #endif
    34   #else
    35   # include <sys/types.h>
    36   # include <sys/socket.h>
    37   # include <netinet/in.h>
    38   # include <arpa/inet.h>
    39   #endif
 }}

 `HAVE_W32_SYSTEM` is not defined, so finally `/usr/include/netinet/in.h`
 is included, which has, on line #336:`#define  INADDR_LOOPBACK
 (u_int32_t)0x7f000001`. It is inside a block:

 {{{
    58   #ifndef _NETINET_IN_H_
    59   #define _NETINET_IN_H_
    60   #include <sys/appleapiopts.h>
    61   #include <sys/_types.h>
    62
    63   #ifndef _IN_ADDR_T
    64   #define _IN_ADDR_T
    65   typedef __uint32_t      in_addr_t;      /* base type for internet
 address */
    66   #endif
    67
    68   #ifndef _IN_PORT_T
    69   #define _IN_PORT_T
    70   typedef __uint16_t      in_port_t;
    71   #endif
    72
    73   /*
    74    * POSIX 1003.1-2003
    75    * "Inclusion of the <netinet/in.h> header may also make visible
 all
    76    *  symbols from <inttypes.h> and <sys/socket.h>".
    77    */
    78   #include <sys/socket.h>
    79
    80   /*
    81    * The following two #includes insure htonl and family are defined
    82    */
    83   #include <machine/endian.h>
    84   #include <sys/_endian.h>
    85
    86   /*
    87    * Constants and structures defined by the internet system,
    88    * Per RFC 790, September 1981, and numerous additions.
    89    */

   219
   220   /*
   221    * Local port number conventions:

   301   /*
   302    * Definitions of bits in internet address integers.
   303    * On subnets, the decomposition of addresses to host and net
 parts
   304    * is done according to subnet mask, not the masks here.
   305    */
   306   #define INADDR_ANY              (u_int32_t)0x00000000
   307   #define INADDR_BROADCAST        (u_int32_t)0xffffffff   /* must be
 masked */
   308
   309   #ifndef _POSIX_C_SOURCE
   310   #define IN_CLASSA(i)            (((u_int32_t)(i) & 0x80000000) ==
 0)

   335
   336   #define INADDR_LOOPBACK         (u_int32_t)0x7f000001
   337   #define INADDR_NONE             0xffffffff              /* -1
 return */
   338
   339   #define INADDR_UNSPEC_GROUP     (u_int32_t)0xe0000000   /*
 224.0.0.0 */
   340   #define INADDR_ALLHOSTS_GROUP   (u_int32_t)0xe0000001   /*
 224.0.0.1 */
   341   #define INADDR_ALLRTRS_GROUP    (u_int32_t)0xe0000002   /*
 224.0.0.2 */
   342   #define INADDR_MAX_LOCAL_GROUP  (u_int32_t)0xe00000ff   /*
 224.0.0.255 */
   343
   344   #ifdef __APPLE__
   345   #define IN_LINKLOCALNETNUM      (u_int32_t)0xA9FE0000 /*
 169.254.0.0 */
   346   #define IN_LINKLOCAL(i)         (((u_int32_t)(i) & IN_CLASSB_NET)
 == IN_LINKLOCALNETNUM)
   347   #endif
   348
   349   #define IN_LOOPBACKNET          127                     /*
 official! */
   350   #endif  /* !_POSIX_C_SOURCE */
 }}}

 But the C header files included do not follow this:

 {{{
 . ../config.h
 . /usr/include/stdio.h
 .. /usr/include/_types.h
 ... /usr/include/sys/_types.h
 .... /usr/include/sys/cdefs.h
 .... /usr/include/machine/_types.h
 ..... /usr/include/ppc/_types.h
 . /usr/include/stdlib.h
 .. /usr/include/sys/wait.h
 ... /usr/include/sys/signal.h
 .... /usr/include/sys/appleapiopts.h
 .... /usr/include/machine/signal.h
 ..... /usr/include/ppc/signal.h
 ... /usr/include/sys/resource.h
 . /usr/include/sys/types.h
 .. /usr/include/machine/types.h
 ... /usr/include/ppc/types.h
 .... /usr/include/ppc/_types.h
 .. /usr/include/machine/endian.h
 ... /usr/include/ppc/endian.h
 . /usr/include/sys/socket.h
 .. /usr/include/machine/param.h
 ... /usr/include/ppc/param.h
 . /usr/include/netinet/in.h
 .. /usr/include/sys/_endian.h
 ... /opt/local/lib/apple-gcc42/gcc/powerpc-apple-
 darwin8/4.2.4/include/stdint.h
 ... /usr/include/libkern/OSByteOrder.h
 .... /usr/include/libkern/ppc/OSByteOrder.h
 .. /usr/include/netinet6/in6.h
 . /usr/include/arpa/inet.h
 .. /usr/include/sys/param.h
 ... /usr/include/sys/syslimits.h
 ... /opt/local/lib/apple-gcc42/gcc/powerpc-apple-
 darwin8/4.2.4/include/limits.h
 .... /opt/local/lib/apple-gcc42/gcc/powerpc-apple-
 darwin8/4.2.4/include/syslimits.h
 .... /usr/include/limits.h
 ..... /usr/include/machine/limits.h
 ...... /usr/include/ppc/limits.h
 ....... /usr/include/ppc/_limits.h
 . /usr/include/errno.h
 .. /usr/include/sys/errno.h
 . /usr/include/sys/stat.h
 . /usr/include/fcntl.h
 .. /usr/include/sys/fcntl.h
 . /usr/include/assert.h
 . assuan-defs.h
 .. /usr/include/sys/un.h
 .. /usr/include/unistd.h
 ... /usr/include/sys/unistd.h
 .. assuan.h
 ... /opt/local/lib/apple-gcc42/gcc/powerpc-apple-
 darwin8/4.2.4/include/stdarg.h
 ... /opt/local/include/gpg-error.h
 .... /opt/local/lib/apple-gcc42/gcc/powerpc-apple-
 darwin8/4.2.4/include/stddef.h
 . debug.h
 .. /usr/include/string.h
 .. /usr/include/inttypes.h
 }}}

 The pre-processed C source code goes like this, near the interesting line:

 {{{
 # 265 "/usr/include/netinet/in.h" 3 4
 #define __DARWIN_IPPORT_RESERVED 1024
 # 297 "/usr/include/netinet/in.h" 3 4
 struct in_addr {
  in_addr_t s_addr;
 };






 #define INADDR_ANY (u_int32_t)0x00000000
 #define INADDR_BROADCAST (u_int32_t)0xffffffff
 # 355 "/usr/include/netinet/in.h" 3 4
 struct sockaddr_in {
  __uint8_t sin_len;
  sa_family_t sin_family;
  in_port_t sin_port;
  struct in_addr sin_addr;
  char sin_zero[8];
 };

 #define INET_ADDRSTRLEN 16
 # 493 "/usr/include/netinet/in.h" 3 4
 }}}

 so it's obviously `_POSIX_C_SOURCE` that would be needed to be defined… Or
 the source would need something like

 {{{
 #if __MAC_OS_X_VERSION_MIN_REQUIRED < 1050
   #define       INADDR_LOOPBACK         (u_int32_t)0x7f000001
 #endif   /* __MAC_OS_X_VERSION_MIN_REQUIRED < 1050 */
 }}}

--
Ticket URL: <https://trac.macports.org/ticket/53602#comment:1>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list