From nobody@FreeBSD.org  Mon Sep 17 10:17:14 2012
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id B82AF1065670
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 17 Sep 2012 10:17:14 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id 8AA258FC12
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 17 Sep 2012 10:17:14 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.5/8.14.5) with ESMTP id q8HAHEVZ031818
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 17 Sep 2012 10:17:14 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.5/8.14.5/Submit) id q8HAHEUE031802;
	Mon, 17 Sep 2012 10:17:14 GMT
	(envelope-from nobody)
Message-Id: <201209171017.q8HAHEUE031802@red.freebsd.org>
Date: Mon, 17 Sep 2012 10:17:14 GMT
From: "Schaich, Alonso" <alonsoschaich@fastmail.fm>
To: freebsd-gnats-submit@FreeBSD.org
Subject: hastd fails to build
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         171704
>Category:       bin
>Synopsis:       [patch] hastd(8) fails to build
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    antoine
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Sep 17 10:20:08 UTC 2012
>Closed-Date:    Sat May 18 16:05:48 UTC 2013
>Last-Modified:  Sat May 18 16:05:48 UTC 2013
>Originator:     Schaich, Alonso
>Release:        9-STABLE
>Organization:
>Environment:
FreeBSD moonshine.localnet.edu 9.1-PRERELEASE FreeBSD 9.1-PRERELEASE #0: Fri Sep  7 19:23:36 CEST 2012     root@moonshine.localnet.edu:/usr/obj/usr/src/sys/NODEBUG  amd64
>Description:
When buildworld runs into sbin/hastd it fails building primary.c:

clang -O2 -pipe  -I/usr/src/sbin/hastd -DHAVE_CAPSICUM -DPROTO_TCP_DEFAULT_PORT=8457 -DINET -DINET6 -DHAVE_CRYPTO -std=gnu99 -Qunused-arguments -fstack-protector -Wsystem-headers -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls -Wold-style-definition -Wno-pointer-sign -Wno-empty-body -Wno-string-plus-int -Wno-format -c /usr/src/sbin/hastd/primary.c
/usr/src/sbin/hastd/primary.c:553:27: error: variable has incomplete type 'struct g_gate_ctl_modify'
        struct g_gate_ctl_modify ggiomodify;
                                 ^
/usr/src/sbin/hastd/primary.c:553:9: note: forward declaration of 'struct g_gate_ctl_modify'
        struct g_gate_ctl_modify ggiomodify;
               ^
/usr/src/sbin/hastd/primary.c:558:27: error: use of undeclared identifier 'GG_MODIFY_READPROV'
        ggiomodify.gctl_modify = GG_MODIFY_READPROV | GG_MODIFY_READOFFSET;
                                 ^
/usr/src/sbin/hastd/primary.c:558:48: error: use of undeclared identifier 'GG_MODIFY_READOFFSET'
        ggiomodify.gctl_modify = GG_MODIFY_READPROV | GG_MODIFY_READOFFSET;
                                                      ^
/usr/src/sbin/hastd/primary.c:562:29: error: use of undeclared identifier 'G_GATE_CMD_MODIFY'
        if (ioctl(res->hr_ggatefd, G_GATE_CMD_MODIFY, &ggiomodify) == 0)


This happens because primay.c uses g_gate_ctl_modify from geom/gate/g_gate.h - however the build process does not include the "new" (source tree) header but the one installed in /usr/include/geom/gate instead, which does not yet declare g_gate_ctl_modify.
>How-To-Repeat:
cd to source dir
make -C sbin/hastd
>Fix:
Add -I/usr/src/sys to the compiler call (attached patch).

As a workaround, copying sys/geom/gate/g_gate.h from the source tree to /usr/include/geom/gate/g_gate.h works, too.

Patch attached with submission follows:

--- sbin/hastd/Makefile.orig	2012-09-17 12:05:48.834544721 +0200
+++ sbin/hastd/Makefile	2012-09-17 12:13:12.828719385 +0200
@@ -21,6 +21,7 @@
 
 NO_WFORMAT=
 NO_WCAST_ALIGN=
+CFLAGS+=-I${.CURDIR}../../sys
 CFLAGS+=-I${.CURDIR}
 CFLAGS+=-DHAVE_CAPSICUM
 CFLAGS+=-DPROTO_TCP_DEFAULT_PORT=8457


>Release-Note:
>Audit-Trail:

From: Schaich Alonso <alonsoschaich@fastmail.fm>
To: bug-followup@freebsd.org,
 alonsoschaich@fastmail.fm
Cc:  
Subject: Re: misc/171704: hastd fails to build
Date: Mon, 17 Sep 2012 12:30:33 +0200

 --Boundary-00=_JvvVQZChpooG8iu
 Content-Type: Text/Plain;
   charset="us-ascii"
 Content-Transfer-Encoding: 7bit
 
 Patch file in the report lacks slash character in the include.
 
 
 --Boundary-00=_JvvVQZChpooG8iu
 Content-Type: text/x-patch;
   charset="UTF-8";
   name="hastd.patch"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: attachment;
 	filename="hastd.patch"
 
 --- sbin/hastd/Makefile.orig	2012-09-17 12:05:48.834544721 +0200
 +++ sbin/hastd/Makefile	2012-09-17 12:25:32.470570736 +0200
 @@ -21,6 +21,7 @@
  
  NO_WFORMAT=
  NO_WCAST_ALIGN=
 +CFLAGS+=-I${.CURDIR}/../../sys
  CFLAGS+=-I${.CURDIR}
  CFLAGS+=-DHAVE_CAPSICUM
  CFLAGS+=-DPROTO_TCP_DEFAULT_PORT=8457
 
 --Boundary-00=_JvvVQZChpooG8iu--
State-Changed-From-To: open->closed 
State-Changed-By: antoine 
State-Changed-When: Sat May 18 16:03:18 UTC 2013 
State-Changed-Why:  
This patch is not needed. 
If you use buildworld,  the right includes will be picked up from 
${WORLDTMP}/usr/include. 


Responsible-Changed-From-To: freebsd-bugs->antoine 
Responsible-Changed-By: antoine 
Responsible-Changed-When: Sat May 18 16:03:18 UTC 2013 
Responsible-Changed-Why:  
Take in case of feedback. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=171704 
>Unformatted:
