Subject: toolchain/20869: crossbuild fails: when building a miniroot image, makeobsolete gets called without $MAKE set
To: None <gnats-bugs@gnats.netbsd.org>
From: None <imp@netbsd.org>
List: netbsd-bugs
Date: 03/23/2003 22:22:01
>Number:         20869
>Category:       toolchain
>Synopsis:       crossbuild fails: when building a miniroot image, makeobsolete gets called without $MAKE set
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    toolchain-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Mar 23 22:23:00 PST 2003
>Closed-Date:
>Last-Modified:
>Originator:     Warner Losh
>Release:        Current
>Organization:
>Environment:
FreeBSD paco-paco.village.org 5.0-CURRENT FreeBSD 5.0-CURRENT #1: Wed Feb 26 16:57:36 MST 2003     imp@paco-paco.village.org:/paco/imp/p4/src/sys/i386/compile/PACO  i386

>Description:
When builing releases on a FreeBSD machine, the following errors occur:
ARCHDIR=/paco/imp/N/distrib/miniroot/../hpcmips/miniroot  DISTRIBREV=16Q  DISTRIBVER=1.6Q  KERNOBJDIR=/usr/home/imp/H/obj/paco/imp/N/sys/arch/hpcmips/compile NETBSDSRCDIR=/paco/imp/N  CRUNCHBIN=instbin  CURDIR=/paco/imp/N/distrib/miniroot  DESTDIR=/usr/home/imp/H/destdir  DISTRIBDIR=/paco/imp/N/distrib  MACHINE=hpcmips  MACHINE_ARCH=mipsel  OBJDIR=/usr/home/imp/H/obj/paco/imp/N/distrib/miniroot TARGETDIR=/usr/home/imp/H/obj/paco/imp/N/distrib/miniroot/work awk -f /paco/imp/N/distrib/common/parselist.awk -v mode=populate /paco/imp/N/distrib/miniroot/list /paco/imp/N/distrib/miniroot/../hpcmips/miniroot/list /paco/imp/N/distrib/common/list.sysinst | sh -e   && touch work.built
"/paco/imp/N/share/mk/bsd.own.mk", line 7: Need an operator
"/paco/imp/N/share/mk/bsd.own.mk", line 133: Malformed conditional (${USETOOLS_BINUTILS:Uyes} == "yes")
"/paco/imp/N/share/mk/bsd.own.mk", line 133: Need an operator
"/paco/imp/N/share/mk/bsd.own.mk", line 145: Malformed conditional (${USETOOLS_GCC:Uyes} == "yes")
"/paco/imp/N/share/mk/bsd.own.mk", line 145: Need an operator
"/paco/imp/N/share/mk/bsd.own.mk", line 203: if-less endif
"/paco/imp/N/share/mk/bsd.own.mk", line 203: Need an operator
"/paco/imp/N/share/mk/bsd.own.mk", line 510: if-less endif
"/paco/imp/N/share/mk/bsd.own.mk", line 510: Need an operator
make: fatal errors encountered -- cannot continue
"/paco/imp/N/share/mk/bsd.own.mk", line 7: Need an operator
"/paco/imp/N/share/mk/bsd.own.mk", line 133: Malformed conditional (${USETOOLS_BINUTILS:Uyes} == "yes")
"/paco/imp/N/share/mk/bsd.own.mk", line 133: Need an operator
"/paco/imp/N/share/mk/bsd.own.mk", line 145: Malformed conditional (${USETOOLS_GCC:Uyes} == "yes")
"/paco/imp/N/share/mk/bsd.own.mk", line 145: Need an operator
"/paco/imp/N/share/mk/bsd.own.mk", line 203: if-less endif
"/paco/imp/N/share/mk/bsd.own.mk", line 203: Need an operator
"/paco/imp/N/share/mk/bsd.own.mk", line 510: if-less endif
"/paco/imp/N/share/mk/bsd.own.mk", line 510: Need an operator
make: fatal errors encountered -- cannot continue

This is because MAKE isn't set.  Since MAKE isn't set when makeobsolete is run, the host's make is used.  Since FreeBSD's make doesn't grok
the constructs in NetBSD's bsd.own.mk, you get the above errors.

>How-To-Repeat:
I use the following script to build:
#!/bin/sh
HOME=/usr/home/imp
cd $HOME/N
d=`date +%Y%m%d`
dest=/usr/home/imp/H
log="$HOME/netbsd-$d.log"
echo building to $log
./build.sh -u -D $dest/destdir -M $dest/obj -U -R $dest/release-$d -m hpcmips \
        -T $dest/tools > $log 2>&1

and running it is all that's required.

>Fix:
The following patch fixes the problem for me.  I'd just commit the
change, but I want to make sure that it is a good change before I do
because there are lots of different architectures that I don't test.

Index: Makefile.image
===================================================================
RCS file: /u/misc/imp/NetBSD-cvs/main/src/distrib/common/Makefile.image,v
retrieving revision 1.20
diff -u -r1.20 Makefile.image
--- Makefile.image      11 Mar 2003 07:18:38 -0000      1.20
+++ Makefile.image      24 Mar 2003 06:01:15 -0000
@@ -45,7 +45,8 @@
        -rm -rf ${WORKDIR} ${WORKBUILT}
        mkdir -m 755 ${WORKDIR}
        ${MTREE} -def ${WORKSPEC} -p ${WORKDIR}/ -UW
-       ${PARSELIST} -v mode=populate ${LISTS} | sh -e ${POPULATE_DEBUG} \
+       ${PARSELIST} -v mode=populate ${LISTS} | \
+       MAKE=${MAKE} sh -e ${POPULATE_DEBUG} \
        && touch ${WORKBUILT}
 
 CLEANFILES+=   ${WORKBUILT}

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