Subject: ./build.sh -j 2 sets errors on amd64
To: NetBSD current <current-users@netbsd.org>
From: Nicolas Joly <njoly@pasteur.fr>
List: current-users
Date: 03/16/2005 18:34:04
Hi,

I noticed that `./build.sh -j 2 sets' generates some error messages on
my NetBSD/amd64 workstation. The same command without `-j' flag works
fine.

njoly@lanfeust [NetBSD/src]> ./build.sh -Uu -m amd64 -j 2 sets
===> build.sh command: ./build.sh -Uu -m amd64 -j 2 sets
===> build.sh started: Wed Mar 16 18:09:23 CET 2005
[...]
cd /local/src/NetBSD/src/distrib/sets &&  DESTDIR=/local/src/NetBSD/dest/amd64  MACHINE=amd64 MACHINE_ARCH=x86_64  CKSUM=/local/src/NetBSD/tool/amd64/bin/nbcksum MAKE=/local/src/NetBSD/tool/amd64/bin/nbmake MTREE=/local/src/NetBSD/tool/amd64/bin/nbmtree  MKTEMP=/local/src/NetBSD/tool/amd64/bin/nbmktemp PAX=/local/src/NetBSD/tool/amd64/bin/nbpax HOST_SH=sh  sh ./maketars -d /local/src/NetBSD/dest/amd64 -M /local/src/NetBSD/dest/amd64/METALOG  -N /local/src/NetBSD/src/etc -t /local/src/NetBSD/rel/amd64/binary/sets base  || rm -f /local/src/NetBSD/rel/amd64/binary/sets/base.tgz
nbmake: Child (13922) not in table?
[: all: unexpected operator
[: all: unexpected operator
[: all: unexpected operator
[: all: unexpected operator
base.tgz is up to date
[...]

I tracked the `unexpected operator' part to
`distrib/sets/sets.subr::arch_to_cpu()' function:

arch_to_cpu()
{
        MACHINE_ARCH=${1} ${MAKE:-make} -f- all <<EOMAKE
.include <bsd.own.mk>   
all:    
        @echo \${MACHINE_CPU}
EOMAKE  
}

For parallel build, MAKEFLAGS variable has the `-j N' flags set, that
will be used by all other make invocations ...

But, in our case, this will produce extra output; setting MACHINE_ARCH
to an incorrect value : `--- all ---\nx86_64' !

njoly@lanfeust [~/tmp]> make -j 2 all
--- all ---
x86_64

As a small work around, i added `-j 1' to the make command (Don't know
if it is the right fix).

Does it need a PR ?

-- 
Nicolas Joly

Biological Software and Databanks.
Institut Pasteur, Paris.