Subject: bin/32907: IPF user-land ipsend defines _KERNEL, and fails to build for vax
To: None <gnats-admin@netbsd.org, netbsd-bugs@netbsd.org>
From: None <he@NetBSD.org>
List: netbsd-bugs
Date: 02/22/2006 23:45:00
>Number:         32907
>Category:       bin
>Synopsis:       IPF user-land ipsend defines _KERNEL, and fails to build for vax
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Feb 22 23:45:00 +0000 2006
>Originator:     Havard Eidnes
>Release:        NetBSD-current 20060221
>Organization:
	
>Environment:
	
	
System: NetBSD quattro.urc.uninett.no 2.1.0_STABLE NetBSD 2.1.0_STABLE (GENERIC.MP) #2: Mon Jan 23 14:15:01 CET 2006  he@quattro.urc.uninett.no:/usr/obj/sys/arch/i386/compile/GENERIC.MP i386
Architecture: i386
Machine: i386
>Description:
	(System, Architecture and Machine is my host system.)

	When trying to compile ipsend for vax, it fails with

    compile  ipresend/sock.o
In file included from /u/build/HEAD/dest/vax/usr/include/machine/cpu.h:59,
                 from /u/build/HEAD/dest/vax/usr/include/machine/lock.h:41,
                 from /u/build/HEAD/src/sys/sys/lock.h:87,
                 from /u/build/HEAD/src/sys/sys/file.h:43,
                 from /u/build/HEAD/src/dist/ipf/ipsend/sock.c:32:
/u/build/HEAD/src/sys/sys/device.h:371: parse error before `device_is_active'
cc1: warnings being treated as errors
/u/build/HEAD/src/sys/sys/device.h:371: warning: type defaults to `int' in declaration of `device_is_active'
/u/build/HEAD/src/sys/sys/device.h:371: warning: data definition has no type or storage class

*** Failed target:  sock.o

	I discussed this with Jason, and he said that the problem
	isn't boolean_t as such (it's defined to int under _KERNEL in
	<sys/types.h>).

	However, Jason points out that the real problem is that this
	user-mode program defines _KERNEL, and relies on this bringing
	"struct file" and "struct socket" into scope, so simply
	not defining _KERNEL results in build errors as well.

	<sys/types.h> is also included before _KERNEL is defined, so
	the definition of boolean_t is not present, but putting
	_KERNEL further up front results in this build problem:

    compile  ipsend/sock.o
In file included from /u/build/HEAD/src/dist/ipf/ipsend/sock.c:19:
/u/build/HEAD/src/sys/sys/time.h:187: field `pt_info' has incomplete type
In file included from /u/build/HEAD/src/sys/sys/select.h:66,
                 from /u/build/HEAD/src/sys/sys/socketvar.h:37,
                 from /u/build/HEAD/src/dist/ipf/ipsend/sock.c:41:
/u/build/HEAD/dest/vax/usr/include/time.h:142: conflicting types for `timer_gettime'
/u/build/HEAD/src/sys/sys/time.h:225: previous declaration of `timer_gettime'
/u/build/HEAD/dest/vax/usr/include/time.h:144: conflicting types for `timer_settime'
/u/build/HEAD/src/sys/sys/time.h:224: previous declaration of `timer_settime'
cc1: warnings being treated as errors
/u/build/HEAD/src/dist/ipf/ipsend/sock.c: In function `kmemcpy':
/u/build/HEAD/src/dist/ipf/ipsend/sock.c:115: warning: implicit declaration of function `open'
/u/build/HEAD/src/dist/ipf/ipsend/sock.c: In function `do_socket':
/u/build/HEAD/src/dist/ipf/ipsend/sock.c:369: warning: implicit declaration of function `fcntl'

*** Failed target:  sock.o


	In short, this is a serious mess, and not something which is
	amenable to a simple point fix.

	
>How-To-Repeat:
	Try to (cross-)build NetBSD-current for vax; watch it fail.

>Fix:
	Sorry, none provided, but some apparent false starts above.

>Unformatted: