Subject: vax cross-build fails in kdump/kdump-ioctl.o
To: None <port-vax@NetBSd.org>
From: Rhialto <rhialto@falu.nl>
List: port-vax
Date: 09/23/2006 01:43:54
I just tried to build for my VAX but it failed. Then I cvs updated, and
tried again, which again failed. Then I tried a crossbuild to i386,
which got past this point. So the problem seems to be VAX-specific.

The end of the build looked like this:

dependall ===> usr.bin/kdump
     create  kdump/kdump-ioctl.c
     create  kdump/kdump-ioctl.d
     create  kdump/.depend
    compile  kdump/kdump.o
    compile  kdump/subr.o
    compile  kdump/setemul.o
    compile  kdump/kdump-ioctl.o
kdump-ioctl.c: In function 'ioctlname':
kdump-ioctl.c:539: error: invalid application of 'sizeof' to incomplete type 'struct prgkbd'
kdump-ioctl.c:678: error: invalid application of 'sizeof' to incomplete type 'struct prg_cursor'
kdump-ioctl.c:721: error: invalid application of 'sizeof' to incomplete type 'struct _vs_event'
kdump-ioctl.c:789: error: invalid application of 'sizeof' to incomplete type 'struct qdmap'
kdump-ioctl.c:890: error: invalid application of 'sizeof' to incomplete type 'struct _vs_cursor'

*** Failed target:  kdump-ioctl.o
*** Failed command: /vol1/rhialto/tools.amd64/bin/vax--netbsdelf-gcc -O2 -Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wno-sign-compare -Wno-traditional -Wreturn-type -Wswitch -Wshadow -Wcast-qual -Wwrite-strings -Werror -I/vol1/rhialto/cvs/src/usr.bin/ktrace -I/vol1/rhialto/cvs/src/sys -nostdinc -isystem /vol1/rhialto/destdir.vax/usr/include -c kdump-ioctl.c
*** Error code 1

Some references I found to one of the structs, prg_cursor, were in
arch/vax/include/qdioctl.h, arch/vax/include/qduser.h
        dev/qbus/qdioctl.h and      dev/qbus/qduser.h
In fact, those files are similar but not identical, which seems odd
and/or wrong.

The kdump-ioctl.c file is generated (by usr.bin/kdump/Makefile.ioctl-c)
it seems that it would need to add one of <arch/vax/include/qduser.h> or
<dev/qbus/qduser.h> to its list of inclusions, somehow. The current
generation of the list of header files to include scans for ioctl
constant definitions, and <vax/qdioctl.h> is picked up that way.

I think, at this point, this is turning into an argument that any header
file which requires another, should include it, rather than depend on
the main source file to include it for them.

So, either qdioctl.h includes qduser.h (and the latter is protected
against multiple inclusion), or as a hack, qduser.h gets the string
_IOR() inserted so it is spuriously picked up by Makefile.ioctl-c.
Which, when I tried it, unfortunately fails with

dependall ===> usr.bin/kdump
     create  kdump/kdump-ioctl.c
/vol1/rhialto/destdir.vax/usr/include/machine/qduser.h:99:28: error: vax/uba/qev
ent.h: No such file or directory
/vol1/rhialto/destdir.vax/usr/include/vax/qduser.h:99:28: error: vax/uba/qevent.
h: No such file or directory
     create  kdump/kdump-ioctl.d
In file included from kdump-ioctl.c:59:
/vol1/rhialto/destdir.vax/usr/include/machine/qduser.h:99:28: error: vax/uba/qev
ent.h: No such file or directory
nbmkdep: compile failed.  

*** Failed target:  kdump-ioctl.d
*** Failed command: CC=/vol1/rhialto/tools.amd64/bin/vax--netbsdelf-gcc /vol1/rh
ialto/tools.amd64/bin/nbmkdep -f kdump-ioctl.d -- -I/vol1/rhialto/cvs/src/usr.bi
n/ktrace -I/vol1/rhialto/cvs/src/sys -nostdinc -isystem /vol1/rhialto/destdir.va
x/usr/include kdump-ioctl.c
*** Error code 1

Stop.
nbmake: stopped in /vol1/rhialto/cvs/src/usr.bin/kdump

Somebody else may find a better solution.

-Olaf.
-- 
___ Olaf 'Rhialto' Seibert      -- You author it, and I'll reader it.
\X/ rhialto/at/xs4all.nl        -- Cetero censeo "authored" delendum esse.