Subject: Re: netbsd-4 userland compile fail w/o INET6
To: Raymond Keller <rsk+port-amd64=netbsd.org@misinformation.org>
From: Greg Troxel <gdt@ir.bbn.com>
List: current-users
Date: 03/28/2007 08:18:48
Raymond Keller <rsk+port-amd64=netbsd.org@misinformation.org> writes:

> Is this a good place to ask?

current-users is better place; this is almost not about amd64.

> Anyone able to compile userland on amd64 with recent netbsd-4 source
> and MKINET6=no?
>
> I tried building a recent checkout of netbsd-4, but got this:
>
>> /usr/obj/destdir.amd64/usr/include/arpa/inet.h:89: error: conflicting types for 'inet_ntop'
>> /usr/src/gnu/dist/postfix/src/util/sys_defs.h:1142: error: previous declaration of 'inet_ntop' was here
>> 
>> *** Failed target:  cidr_match.o
>
> So I grabbed a source set from here and attempted it again, with the
> same result:
>   ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-daily/netbsd-4/200703260002Z/source/sets/

Probably there are some ifdefs to make this work conditionally, and
they aren't right.  So you'll have to dig in to the files in question
and figure out why and fix them.

Running find on the sources, this is about postfix, and it seems to
have code to deal with systems that don't support v6, which gets
invoked if the v6 headers aren't visible.

I think the problem is that postfix checks for v6 (and has been told
no) in src/gnu/usr.sbin/postfix/Makefile:

  # IPv6 support.
  .if ${MKINET6} == "no"
  CPPFLAGS+=	-DNO_IPV6
  .endif

Then, it assumes that inet_ntop is not declared and has a local
definition.

But, NetBSD with MKINET6=no still defines modern procedures like
inet_ntop, so there's a conflict.


Try applying this patch (not tested) in src/gnu/dist/postfix/src/util/:

--- sys_defs.h.~1.21.~	2007-01-29 15:46:54.000000000 -0500
+++ sys_defs.h	2007-03-28 08:17:42.000000000 -0400
@@ -1132,6 +1132,11 @@ extern int dup2_pass_on_exec(int oldd, i
 #error "define USE_STATFS or USE_STATVFS"
 #endif
 
+/*
+ * NetBSD always has inet_ntop and getaddrinfo, even without Ipv6.
+ */
+#if 0
+
  /*
   * Defaults for systems that pre-date IPv6 support.
   */
@@ -1143,6 +1148,7 @@ extern const char *inet_ntop(int, const 
 extern int inet_pton(int, const char *, void *);
 
 #endif
+#endif /* 0 */
 
  /*
   * Defaults for all systems.

-- 
    Greg Troxel <gdt@ir.bbn.com>