Bug 171704

Summary: [patch] hastd(8) fails to build
Product: Base System Reporter: Schaich, Alonso <alonsoschaich>
Component: binAssignee: Antoine Brodin <antoine>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Unspecified   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff
none
hastd.patch none

Description Schaich, Alonso 2012-09-17 11:20:08 UTC
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.

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:
How-To-Repeat: cd to source dir
make -C sbin/hastd
Comment 1 Schaich, Alonso 2012-09-17 11:30:33 UTC
Patch file in the report lacks slash character in the include.
Comment 2 Antoine Brodin freebsd_committer freebsd_triage 2013-05-18 17:03:18 UTC
State Changed
From-To: open->closed

This patch is not needed. 
If you use buildworld,  the right includes will be picked up from 
${WORLDTMP}/usr/include. 


Comment 3 Antoine Brodin freebsd_committer freebsd_triage 2013-05-18 17:03:18 UTC
Responsible Changed
From-To: freebsd-bugs->antoine

Take in case of feedback.