Subject: bin/25958: New #include's in sbin/mknod/mknod.c prevent crossbuild for solaris
To: None <gnats-bugs@gnats.NetBSD.org>
From: None <cross+netbsd@distal.com>
List: netbsd-bugs
Date: 06/17/2004 22:46:33
>Number:         25958
>Category:       bin
>Synopsis:       New #include's in sbin/mknod/mknod.c prevent crossbuild for solaris
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jun 17 22:47:01 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator:     Chris Ross
>Release:        2.0F  (HEAD: 17-June-2004)
>Organization:
>Environment:
SunOS xxxxxxx 5.10 s10_54 sun4u sparc SUNW,Sun-Fire-880

>Description:
The inclusion [today] of #include <sys/sysctl.h> causes the build of tools/mknod/mknod.lo to fail.  This header isn't on all operating systems, Solaris being a noteworthy example.
I also note that the #include <sys/param.h> was recently added, and may also not be the "right thing" on host operating systems when building the cross-built mknod binary for tools/mknod.
Is there some way to check if we're being built to run on a host OS that isn't NetBSD?  Perhaps you could put this/these inside of a #ifdef __NetBSD__ ?

This recent change has made it so that I am completely unable to build on my Solaris machine.

>How-To-Repeat:
Try to build today's netbsd HEAD on a machine without a /usr/include/sys/sysctl.h.
>Fix:
Don't unconditionally include sys/sysctl.h (and also sys/param.h) in sbin/mknod/mknod.c.  Figure out how to include it only if it's a "netbsd" build, rather than a utility TOOL build.
Perhaps put another -DCROSS_TOOL or soemthing in tools/mknod/Makefile, and look for that in sbin/mknod/mknod.c?

>Release-Note:
>Audit-Trail:
>Unformatted: