Subject: kernel build annoyance part II
To: None <current-users@netbsd.org>
From: Andrew Gillham <gillhaa@ghost.whirlpool.com>
List: current-users
Date: 04/17/1999 13:27:58
Ok, I think I have found why the kernel make goes awry, but I don't
know how to fix it.  At the 'make depend' stage, something like
this happens:
depending the compat library objects
mkdep -a -I../../. -I../../../../../../arch -I../../../../../.. -nostdinc -DLKM -DDIAGNOSTIC -DNS -DMAXUSERS=32 -D_KERNEL -Di386 /usr/src/sys/compat/common/compat_exec.c /usr/src/sys/compat/common/compat_util.c /usr/src/sys/compat/common/kern_exit_43.c /usr/src/sys/compat/common/kern_info_43.c /usr/src/sys/compat/common/kern_resource_43.c /usr/src/sys/compat/common/kern_sig_43.c /usr/src/sys/compat/common/tty_43.c /usr/src/sys/compat/common/uipc_syscalls_43.c /usr/src/sys/compat/common/vfs_syscalls_43.c /usr/src/sys/compat/common/vm_43.c /usr/src/sys/compat/common/kern_info_09.c /usr/src/sys/compat/common/kern_xxx_12.c /usr/src/sys/compat/common/vfs_syscalls_12.c /usr/src/sys/compat/common/vm_12.c /usr/src/sys/compat/common/kern_sig_13.c /usr/src/sys/compat/common/kern_ipc_10.c

Looking for 'net/' in the resulting lib/compat/.depend we see this:
 ../../../../../../sys/mount.h ../../../../../../net/radix.h \
 ../../../../../../sys/mount.h ../../../../../../net/radix.h \
 ../../../../../../net/radix.h ../../../../../../sys/syscallargs.h
 ../../opt_multiprocessor.h ../../../../../../net/radix.h \
 ../../../../../../sys/mount.h ../../../../../../net/radix.h \
 ../../opt_multiprocessor.h ../../../../../../net/radix.h \
 ../../../../../../net/radix.h ../../../../../../sys/syscallargs.h
 ../../../../../../sys/mount.h ../../../../../../net/radix.h \
 ../../../../../../net/radix.h ../../../../../../sys/socket.h \
 ../../../../../../net/radix.h ../../../../../../sys/socket.h \
 ../../../../../../net/radix.h ../../../../../../sys/socket.h \
 ../../opt_multiprocessor.h ../../../../../../net/radix.h \
 ../../../../../../net/radix.h ../../../../../../sys/socket.h \
 ../../opt_multiprocessor.h ../../../../../../net/radix.h \

So my guess is that for 'depend' make is doing things relative to
/usr/src/sys/arch/compile/XXXXX/lib/compat, so the 6th previous is
actually /usr/src, so the file is then '/usr/src/net/radix.h' as
expected.  When it comes time to build libcompat.a, make checks files
but it is now relative to /usr/src/sys/compat/common, so the .depend
information is now completely wrong.  '/' is the 5th previous (therefore
the 6th), and the correct file is only '../../net/radix.h' now.

I don't know very much about make, so I couldn't guess what would
be the correct fix.  IMHO tho, it needs to be fixed. 
There are several directories searched off of '/', but on my machine
only /net is even noticed.  So far I see:
	/sys	usually exists as a symlink
	/lib	normally doesn't exist, might exist locally.
	/vm	normally doesn't exist, might exist locally.
	/uvm	normally doesn't exist, might exist locally.
	/net	normally doesn't exist, might exist locally.
	/compat	normally doesn't exist, might exist locally.

All of the 'defopt' file dependencies appear to be broken for this
directory also.  It appears the libkern has the same problem, it
just doesn't access 'net/radix.h' so I have never noticed it.

-Andrew
-- 
-----------------------------------------------------------------
Andrew Gillham                            | This space left blank
gillham@whirlpool.com                     | inadvertently.
I speak for myself, not for my employer.  | Contact the publisher.