Opened 8 years ago

Closed 8 years ago

#53602 closed defect (duplicate)

libassuan 2.4.3_1 won't build on PPC Tiger, Mac OS X 10.4.11, because 'INADDR_LOOPBACK' undeclared

Reported by: ballapete (Peter "Pete" Dyballa) Owned by:
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc:
Port: libassuan

Description

libtool: compile:  /opt/local/bin/gcc-apple-4.2 -DHAVE_CONFIG_H -I. -I.. -I.. -I/opt/local/include -I/opt/local/include -pipe -Os -arch ppc -Wall -Wcast-align -Wshadow -Wstrict-prototypes -Wpointer-arith -MT libassuan_la-assuan-socket.lo -MD -MP -MF .deps/libassuan_la-assuan-socket.Tpo -c assuan-socket.c  -fno-common -DPIC -o .libs/libassuan_la-assuan-socket.o
assuan-socket.c: In function 'socks5_connect':
assuan-socket.c:732: error: 'INADDR_LOOPBACK' undeclared (first use in this function)
assuan-socket.c:732: error: (Each undeclared identifier is reported only once
assuan-socket.c:732: error: for each function it appears in.)
make[3]: *** [libassuan_la-assuan-socket.lo] Error 1
make[3]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_devel_libassuan/libassuan/work/libassuan-2.4.3/src'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_devel_libassuan/libassuan/work/libassuan-2.4.3/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_devel_libassuan/libassuan/work/libassuan-2.4.3'
make: *** [all] Error 2
make: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_devel_libassuan/libassuan/work/libassuan-2.4.3'
Command failed:  cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_devel_libassuan/libassuan/work/libassuan-2.4.3" && /usr/bin/make -w all 

Attachments (2)

main.log (40.8 KB) - added by ballapete (Peter "Pete" Dyballa) 8 years ago.
main.log from Tiger
src_assuan-socket_INADDR_LOOPBACK.patch (476 bytes) - added by ballapete (Peter "Pete" Dyballa) 8 years ago.
patch to make libassuan build on Tiger

Download all attachments as: .zip

Change History (6)

Changed 8 years ago by ballapete (Peter "Pete" Dyballa)

Attachment: main.log added

main.log from Tiger

comment:1 Changed 8 years ago by ballapete (Peter "Pete" Dyballa)

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 */
}}}

Changed 8 years ago by ballapete (Peter "Pete" Dyballa)

patch to make libassuan build on Tiger

comment:2 Changed 8 years ago by ballapete (Peter "Pete" Dyballa)

With the uploaded patch file libassuan built.

comment:3 Changed 8 years ago by kencu (Ken)

This can be closed as a duplicate of 51708. We established the fix last summer for this, but the maintainer has declined to implement that for now as it is felt it should be implemented upstream.

The previous ticket has a fix and patch applied already.

Last edited 8 years ago by kencu (Ken) (previous) (diff)

comment:4 Changed 8 years ago by mf2k (Frank Schima)

Resolution: duplicate
Status: newclosed
Note: See TracTickets for help on using tickets.