Subject: kern/1363: libkern Makefile is broken: .PATH directives out of order
To: None <gnats-bugs@gnats.netbsd.org>
From: None <jonathan@NetBSD.ORG>
List: netbsd-bugs
Date: 08/16/1995 19:15:51
>Number: 1363
>Category: kern
>Synopsis: libkern Makefile is broken: .PATH directives out of order
>Confidential: no
>Severity: critical
>Priority: high
>Responsible: kern-bug-people (Kernel Bug People)
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Aug 16 22:20:04 1995
>Last-Modified:
>Originator: Jonathan Stone
>Organization:
Stanford Distributed Systems Group
>Release: NetBSD-current from July 27 through August 16
>Environment:
System: NetBSD Reno.Stanford.EDU 1.0A NetBSD 1.0A (NEWCONF) #544: Wed Aug 16 18:35:49 PDT 1995 jonathan@Reno.Stanford.EDU:/greyhawk/n1/src/NetBSD/src/sys/arch/pmax/compile/NEWCONF pmax
>Description:
The order of .PATH directives in libkern's Makefile
is simply *wrong*. The .PATH directive for libc source
directories precedes the .PATH directive for the libkern
directory itself. This causes make(1) to prefer possible
sources found in the libc/ tree to source files with
the same name from the libkern source tree.
That means that (for example), on a port with no port-specific
definition of random(), the libc version gets used, not
the libkern.c version!!
>How-To-Repeat:
Configure a kernel for a pmax using newconf.
Do "make depend", Compile and link (possibly after
fixing other bugs; YMMV.)
Notice that random.o tries to pull in stdio symbols from
libc into the kernel.
>Fix:
I don't believe hard-coding an *absolute* pathname in
libkern/arch/mips is an acceptable alternative.
Instead, apply the following patch. (It's been
working for me with port-pmax since June 27.)
If this patch breaks other ports, it means they have a
source-file in /sys/libkern which was being hidden
by a file with the same basename in the libc source tree,
which I'd argue is a bug in its own right, and should be
fixed.
*** Makefile.DIST Mon Jun 26 00:11:11 1995
--- Makefile Tue Jun 27 15:07:03 1995
***************
*** 12,23 ****
LIBC= ${DIR}/../../../lib/libc
.PATH: ${LIBC}/string ${LIBC}/arch/${MACHINE_ARCH}/string
.PATH: ${LIBC}/net ${LIBC}/arch/${MACHINE_ARCH}/net
.PATH: ${LIBC}/gen ${LIBC}/arch/${MACHINE_ARCH}/gen
.PATH: ${LIBC}/stdlib ${LIBC}/arch/${MACHINE_ARCH}/stdlib
.PATH: ${LIBC}/sys ${LIBC}/arch/${MACHINE_ARCH}/sys
- .PATH: ${DIR}
AINC+= -I${LIBC}/arch/${MACHINE_ARCH}
CC = ${KERNCC}
--- 12,23 ----
LIBC= ${DIR}/../../../lib/libc
+ .PATH: ${DIR}
.PATH: ${LIBC}/string ${LIBC}/arch/${MACHINE_ARCH}/string
.PATH: ${LIBC}/net ${LIBC}/arch/${MACHINE_ARCH}/net
.PATH: ${LIBC}/gen ${LIBC}/arch/${MACHINE_ARCH}/gen
.PATH: ${LIBC}/stdlib ${LIBC}/arch/${MACHINE_ARCH}/stdlib
.PATH: ${LIBC}/sys ${LIBC}/arch/${MACHINE_ARCH}/sys
AINC+= -I${LIBC}/arch/${MACHINE_ARCH}
CC = ${KERNCC}
>Audit-Trail:
>Unformatted: