Subject: kern/4361: libkern.[ao] gets built to wrong place?
To: None <gnats-bugs@gnats.netbsd.org>
From: None <hsu@clinet.fi>
List: netbsd-bugs
Date: 10/27/1997 08:38:12
>Number:         4361
>Category:       kern
>Synopsis:       libkern.[ao] gets built to wrong place?
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    kern-bug-people (Kernel Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Oct 26 22:50:00 1997
>Last-Modified:
>Originator:     hsu@clinet.fi
>Organization:
Clinet Ltd
>Release:        sups from last week (at least)
>Environment:
	
System: NetBSD proxy2.clinet.fi 1.3_ALPHA NetBSD 1.3_ALPHA (CLINETALPHA) #19: Thu Oct 23 22:40:22 EEST 1997 root@proxy2.clinet.fi:/usr/src/sys/arch/alpha/compile/CLINETALPHA alpha

>Description:

make build fails with the following:

cc -Wall -Werror -mno-fp-regs -g -pipe -g -I. -I/usr/src/sys/arch/alpha/stand/boot/..
/.. -I/usr/src/sys/arch/alpha/stand/boot/../../../.. -DALPHA_BOOT_ECOFF -DALPHA_BOOT_
ELF -I/usr/src/sys/arch/alpha/stand/boot -DPRIMARY_LOAD_ADDRESS="0x20000000" -DSECOND
ARY_LOAD_ADDRESS="0x20004000" -nostdinc -idirafter /usr/build/usr/include  -D_ZLIB_PR
IVATE -nostdinc -idirafter /usr/build/usr/include -c /usr/src/sys/lib/libz/inftrees.c
cc -Wall -Werror -mno-fp-regs -g -pipe -g -I. -I/usr/src/sys/arch/alpha/stand/boot/..
/.. -I/usr/src/sys/arch/alpha/stand/boot/../../../.. -DALPHA_BOOT_ECOFF -DALPHA_BOOT_
ELF -I/usr/src/sys/arch/alpha/stand/boot -DPRIMARY_LOAD_ADDRESS="0x20000000" -DSECOND
ARY_LOAD_ADDRESS="0x20004000" -nostdinc -idirafter /usr/build/usr/include  -D_ZLIB_PR
IVATE -nostdinc -idirafter /usr/build/usr/include -c /usr/src/sys/lib/libz/infutil.c
building standard z library
ranlib libz.a
making sure the kern library is up to date...
`libkern.a' is up to date.
sh /usr/src/sys/arch/alpha/stand/boot/newvers.sh /usr/src/sys/arch/alpha/stand/boot/v
ersion
cc -Wall -Werror -mno-fp-regs -g -pipe -g  -I/usr/src/sys/arch/alpha/stand/boot/../..
 -I/usr/src/sys/arch/alpha/stand/boot/../../../..  -DALPHA_BOOT_ECOFF -DALPHA_BOOT_EL
F -I/usr/src/sys/arch/alpha/stand/boot -DPRIMARY_LOAD_ADDRESS="0x20000000" -DSECONDAR
Y_LOAD_ADDRESS="0x20004000" -nostdinc -idirafter /usr/build/usr/include -c vers.c
ld -Ttext 20004000 -N -e start -o boot.sym  start.o boot.o loadfile.o disk.o conf.o p
rom.o prom_disp.o OSFpal.o devopen.o filesystem.o prom_swpal.o vers.o /usr/src/sys/ar
ch/alpha/stand/boot/lib/sa/libsa.a /usr/src/sys/arch/alpha/stand/boot/lib/z/libz.a /u
sr/src/sys/arch/alpha/stand/boot/lib/sa/libsa.a /usr/src/sys/arch/alpha/stand/boot/li
b/kern/libkern.o
ld: cannot open /usr/src/sys/arch/alpha/stand/boot/lib/kern/libkern.o: No such file o
r directory
*** Error code 1

Stop.

The problem seems to be that libkern.[ao] is built to wrong place:

(/usr/src/sys/lib/libkern/Makefile.inc)

#       Configuration variables (default values are below):
#
#       S       must be set to the top of the 'sys' tree.
#       KERNDST may be set to the location of the directory where library
#               objects are to be built.  Defaults to ${.OBJDIR}/lib/kern.
#       KERN_AS may be set to 'obj' to build a object from the library's
#               object files.  (Otherwise, a library will be built.)
#               Defaults to 'library'.
#       KERNMISCCPPFLAGS
#               Miscellaneous cpp flags to be passed to the library's Makefile
#               when building.
#       KERNMISCMAKEFLAGS
#               Miscellaneous flags to be passed to the library's Makefile when
#               building.  See library's Makefile for more details about
#               supported flags and their default values.

# Default values:
KERNDST?=       ${.OBJDIR}/lib/kern
KERN_AS?=       library

KERNDIR=        $S/lib/libkern
.if (${KERN_AS} == "obj")
KERNLIB=        ${KERNDST}/libkern.o
KERNLIB_PROF=   ${KERNDST}/libkern.po
.else
KERNLIB=        ${KERNDST}/libkern.a
KERNLIB_PROF=   ${KERNDST}/libkern_p.a
.endif

The Makefile generates the libkern.[ao] to KERNDIR, while Makefiles using this
seem to expect it to be built to KERNDST derived from .OBJDIR.
I'm not quite sure how the Makefiles should be here.

>How-To-Repeat:

try make build or making kernels.  It might work for DESTDIR=/, but I do not dare
to try it before I can get it built with something else as DESTDIR.

>Fix:

>Audit-Trail:
>Unformatted: