NetBSD Problem Report #47188

From sjg@crufty.net  Tue Nov 13 07:55:30 2012
Return-Path: <sjg@crufty.net>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	by www.NetBSD.org (Postfix) with ESMTP id 56CF963E4AB
	for <gnats-bugs@gnats.NetBSD.org>; Tue, 13 Nov 2012 07:55:30 +0000 (UTC)
Message-Id: <20121113075528.E4F8A1C7220@bad.crufty.net>
Date: Mon, 12 Nov 2012 23:55:28 -0800 (PST)
From: sjg@crufty.net
Reply-To: sjg@crufty.net
To: gnats-bugs@gnats.NetBSD.org
Subject: MKTOOLS=no broken
X-Send-Pr-Version: 3.95

>Number:         47188
>Category:       toolchain
>Synopsis:       MKTOOLS=no broken when TOOLDIR is elsewhere
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    apb
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Nov 13 08:00:01 +0000 2012
>Closed-Date:    Sun Dec 02 04:42:20 +0000 2012
>Last-Modified:  Sun Dec 02 13:05:02 +0000 2012
>Originator:     Simon J. Gerraty
>Release:        NetBSD 6.0
>Organization:
Zen Programming...
>Environment:


System: NetBSD frodo.jnpr.net 5.99.55 NetBSD 5.99.55 (JNPR) #1: Fri Oct 14 15:46:25 PDT 2011  sjg@frodo.jnpr.net:/h/obj/NetBSD/current/amd64/obj/h/NetBSD/current/src/sys/arch/amd64/compile/JNPR amd64
Architecture: amd64
Machine: amd64
>Description:

Having run:

TOOLDIR=/var/obj/NetBSD/current/tools/NetBSD-5.99.55-x86_64 \
sh -x ./build.sh -m amd64 -M /var/obj/NetBSD/current/amd64/obj tools

and then running:

TOOLDIR=/var/obj/NetBSD/current/tools/NetBSD-5.99.55-x86_64 MKTOOLS=no \
sh -x ./build.sh -u -U -m amd64 -M /var/obj/NetBSD/current/amd64/obj \
-D /var/obj/NetBSD/current/amd64/destdir \
-R /var/obj/NetBSD/current/amd64/release release

fails in:

dependall ===> external/gpl3/gcc/usr.bin/backend
#      link  backend/gengenrtl
cc -O -I. -I/h/NetBSD/current/src/external/gpl3/gcc/usr.bin/backend/../gcc/arch/
x86_64 -DIN_GCC -DHAVE_CONFIG_H -I/h/NetBSD/current/src/external/gpl3/gcc/dist/g
cc -I/h/NetBSD/current/src/external/gpl3/gcc/dist/gcc/. -I/h/NetBSD/current/src/
external/gpl3/gcc/dist/gcc/../include -I/h/NetBSD/current/src/external/gpl3/gcc/
dist/gcc/../libcpp/include -I/h/NetBSD/current/src/external/gpl3/gcc/dist/gcc/..
/libdecnumber -I/h/NetBSD/current/src/external/gpl3/gcc/dist/gcc/../libdecnumber
/dpd -I/usr/include/libelf -DGENERATOR_FILE -I/h/NetBSD/current/src/external/gpl
3/gcc/usr.bin/backend/..  -o gengenrtl gengenrtl.lo build-errors.lo -L/var/obj/N
etBSD/current/amd64/obj/h/NetBSD/current/src/tools/compat -lnbcompat /var/obj/Ne
tBSD/current/amd64/obj/h/NetBSD/current/src/external/gpl3/gcc/usr.bin/host-libib
erty/libiberty/libiberty.a
ld: cannot find -lnbcompat

this would appear to be because although an objdir is created for tools/compat
obj ===> tools/compat
nothing else is done there

>How-To-Repeat:

>Fix:

Discussion on IRC suggested that tools/compat should install libnbcompat.a
into $TOOLDIR/lib

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: toolchain-manager->apb
Responsible-Changed-By: apb@NetBSD.org
Responsible-Changed-When: Tue, 13 Nov 2012 08:13:24 +0000
Responsible-Changed-Why:
Take


From: Alan Barrett <apb@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: toolchain/47188: MKTOOLS=no broken
Date: Thu, 15 Nov 2012 11:17:34 +0200

 On Tue, 13 Nov 2012, sjg@crufty.net wrote:
 >Having run:
 >
 >TOOLDIR=/var/obj/NetBSD/current/tools/NetBSD-5.99.55-x86_64 \
 >sh -x ./build.sh -m amd64 -M /var/obj/NetBSD/current/amd64/obj tools
 >
 >and then running:
 >
 >TOOLDIR=/var/obj/NetBSD/current/tools/NetBSD-5.99.55-x86_64 MKTOOLS=no \
 >sh -x ./build.sh -u -U -m amd64 -M /var/obj/NetBSD/current/amd64/obj \
 >-D /var/obj/NetBSD/current/amd64/destdir \
 >-R /var/obj/NetBSD/current/amd64/release release
 >
 >fails [...]

 I think there's a mistake in the above instructions.  I think that the
 problem manifests only when the two build.sh invocations use different
 obj directories, but the above instructions use the same -M option both
 times.

 I can replicate this problem if I pass different "-M <objdir>"
 options, but the same TOOLDIR value, to the two build.sh
 invocations, and if I use MKTOOLS=no the second time.

 --apb (Alan Barrett)

From: "Simon J. Gerraty" <sjg@crufty.net>
To: gnats-bugs@NetBSD.org
Cc: apb@NetBSD.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Subject: Re: toolchain/47188: MKTOOLS=no broken
Date: Sat, 17 Nov 2012 15:43:12 -0800

 On Thu, 15 Nov 2012 09:20:05 +0000 (UTC), Alan Barrett writes:
 > >TOOLDIR=/var/obj/NetBSD/current/tools/NetBSD-5.99.55-x86_64 \
 > >sh -x ./build.sh -m amd64 -M /var/obj/NetBSD/current/amd64/obj tools
 > >
 > >and then running:
 > >
 > >TOOLDIR=/var/obj/NetBSD/current/tools/NetBSD-5.99.55-x86_64 MKTOOLS=no \
 > >sh -x ./build.sh -u -U -m amd64 -M /var/obj/NetBSD/current/amd64/obj \
 > >-D /var/obj/NetBSD/current/amd64/destdir \
 > >-R /var/obj/NetBSD/current/amd64/release release
 > >
 > >fails [...]
 > 
 > I think there's a mistake in the above instructions.  I think that the
 > problem manifests only when the two build.sh invocations use different
 > obj directories, but the above instructions use the same -M option both
 > times.

 The above were cut/pasted from the logs of the tools vs release builds
 For the release build it also does:

 rm -rf /var/obj/NetBSD/current/amd64/destdir
 rm -rf /var/obj/NetBSD/current/amd64/release
 mkdir -p /var/obj/NetBSD/current/amd64/obj \
 /var/obj/NetBSD/current/amd64/destdir \
 /var/obj/NetBSD/current/amd64/release


 before running the above.

 It is quite possible that I did an rm -rf /var/obj/NetBSD/current/amd64
 at some point after the initial failure.

 That would then be equivalent to two different obj trees.

 Thanks
 --sjg

From: Alan Barrett <apb@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: toolchain/47188: MKTOOLS=no broken
Date: Sun, 18 Nov 2012 10:31:57 +0200

 On Sat, 17 Nov 2012, Simon J. Gerraty wrote:
 >It is quite possible that I did an rm -rf /var/obj/NetBSD/current/amd64
 >at some point after the initial failure.
 >
 >That would then be equivalent to two different obj trees.

 Yes, that would explain it.

 I intend to address this by adding a make install target to tools/compat
 that copies the necessary files to ${TOOLDIR}.

 --apb (Alan Barrett)

From: Alan Barrett <apb@cequrux.com>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: toolchain/47188: MKTOOLS=no broken
Date: Wed, 21 Nov 2012 09:41:52 +0200

 --4Ckj6UjgE2iN1+kY
 Content-Type: text/plain; charset=us-ascii; format=flowed
 Content-Disposition: inline

 Please try the attached patch.  It does the following:

 * tools/Makefile produces an error if TOOLDIR is not defined.  This
   change is independent of the others.

 * tools/Makefile builds host-mkdep, compat, and binstall in that order,
   before installing any of them.  It installs them in any order relative
   to each other.  The .WAIT points that used to be between these three
   tools are replaced by .ORDER and dependencies.

 * tools/compat/Makefile will install the library in
   ${TOOLDIR}/lib/libnbcompat.a, install the include files in
   ${TOOLDIR}/include/compat/**, and install defs.mk in
   ${TOOLDIR}/share/compat/defs.mk.  Previously, nothing from
   tools/compat was installed under TOOLDIR.

 * tools/compat/Makefile is adjusted to use an uninstalled copy of
   host-mkdep from the .OBJDIR of tools/host-mkdep, and an uninstalled
   copy of the install program from the .OBJDIR of tools/binstall.
   This allows it to be built after tools/host-mkdep is built but
   before tools/host-mkdep is installed; and to be installed after
   tools/binstall is built but before tools/binstall is installed.

 * tools/binstall/Makefile is adjusted to use an uninstalled copy of
   host-mkdep from the .OBJDIR of tools/host-mkdep.  It was already
   using an uninstalled copy of the compat library and headers from
   the .OBJDIR of tools/compat, but the way this is done has changed
   slightly.  This allows it to be built after tools/host-mkdep and
   tools/compat are built, but before they are installed; and to be
   installed after tools/binstall is built but before tools/binstall is
   installed.

 * tools/host-mkdep/Makefile is adjusted to look more like the Makefiles
   for other tools.  In particular, its install target uses the install
   program, instead of using "cp" commands.  In order for this to work
   after tools/binstall has been built but before tools/binstall has been
   installed, tools/host-mkdep uses the uninstalled copy of the install
   program from the the .OBJDIR of tools/binstall.

 * Everything else that uses libnbcompat and the associated header files
   is changed to use the versions that are installed under TOOLDIR.  This
   includes tools/Makefile.host, tools/*/Makefile, and a few Makefiles
   outside the tools directory.

 This has been tested via

 	build.sh -T TOOLDIR -O OBJDIR tools
 	rm -rf OBJDIR
 	build.sh -T TOOLDIR -O OBJDIR -V MKTOOLS=no build

 --apb (Alan Barrett)

 --4Ckj6UjgE2iN1+kY
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename="pr47188.diff"

 Index: bin/sh/Makefile
 ===================================================================
 --- bin/sh/Makefile	23 Aug 2011 10:47:06 -0000	1.98
 +++ bin/sh/Makefile	20 Nov 2012 21:24:16 -0000
 @@ -74,8 +74,7 @@ nodes.c nodes.h: mknodes.sh nodetypes no
  	[ -f nodes.h ]

  .if ${USETOOLS} == "yes"
 -COMPATOBJDIR!=	cd ${NETBSDSRCDIR}/tools/compat && ${PRINTOBJDIR}
 -NBCOMPATLIB=	-L${COMPATOBJDIR} -lnbcompat
 +NBCOMPATLIB=   -L${TOOLDIR}/lib -lnbcompat
  .endif

  .if make(install)
 Index: distrib/cdrom/macppc_installboot/Makefile
 ===================================================================
 --- distrib/cdrom/macppc_installboot/Makefile	25 Mar 2009 15:26:49 -0000	1.8
 +++ distrib/cdrom/macppc_installboot/Makefile	20 Nov 2012 21:24:18 -0000
 @@ -24,9 +24,7 @@ cleaninc:
  .include <bsd.own.mk>

  .ifndef NOCOMPATLIB
 -COMPATOBJ!=	cd ${NETBSDSRCDIR}/tools/compat && ${PRINTOBJDIR}
 -.-include	"${COMPATOBJ}/defs.mk"
 -HOST_CPPFLAGS+=	-I${NETBSDSRCDIR}/tools/compat
 +.-include	"${TOOLDIR}/share/compat/defs.mk"
  .endif

  .include <bsd.hostprog.mk>
 Index: distrib/cdrom/macppc_mkboothfs/Makefile
 ===================================================================
 --- distrib/cdrom/macppc_mkboothfs/Makefile	30 Mar 2009 11:22:46 -0000	1.4
 +++ distrib/cdrom/macppc_mkboothfs/Makefile	20 Nov 2012 21:24:18 -0000
 @@ -9,9 +9,7 @@ CLEANFILES+=	boothfs
  .include <bsd.own.mk>

  .ifndef NOCOMPATLIB
 -COMPATOBJ!=	cd ${NETBSDSRCDIR}/tools/compat && ${PRINTOBJDIR}
 -.-include       "${COMPATOBJ}/defs.mk"
 -HOST_CPPFLAGS+=	-I${NETBSDSRCDIR}/tools/compat
 +.-include	"${TOOLDIR}/share/compat/defs.mk"
  .endif


 Index: external/gpl3/gcc/usr.bin/Makefile.inc
 ===================================================================
 --- external/gpl3/gcc/usr.bin/Makefile.inc	18 Sep 2012 07:05:15 -0000	1.11
 +++ external/gpl3/gcc/usr.bin/Makefile.inc	20 Nov 2012 21:24:16 -0000
 @@ -24,8 +24,7 @@ CPPFLAGS+=	-I.
  DPSRCS+= gmp.h mpfr.h mpf2mpfr.h mpc.h mpc-log.h

  .if ${USETOOLS} == "yes"
 -COMPATOBJDIR!=	cd ${NETBSDSRCDIR}/tools/compat && ${PRINTOBJDIR}
 -NBCOMPATLIB=	-L${COMPATOBJDIR} -lnbcompat
 +NBCOMPATLIB=   -L${TOOLDIR}/lib -lnbcompat
  .endif

  GNUHOSTDIST=	${DIST}
 Index: gnu/usr.bin/gcc4/Makefile.inc
 ===================================================================
 --- gnu/usr.bin/gcc4/Makefile.inc	30 May 2011 14:41:26 -0000	1.5
 +++ gnu/usr.bin/gcc4/Makefile.inc	20 Nov 2012 21:24:16 -0000
 @@ -11,8 +11,7 @@ CPPFLAGS+=	-DLOCALEDIR=\"/usr/share/loca
  HOST_CPPFLAGS+=	-I${.CURDIR}/..

  .if ${USETOOLS} == "yes"
 -COMPATOBJDIR!=	cd ${NETBSDSRCDIR}/tools/compat && ${PRINTOBJDIR}
 -NBCOMPATLIB=	-L${COMPATOBJDIR} -lnbcompat
 +NBCOMPATLIB=   -L${TOOLDIR}/lib -lnbcompat
  .endif

  GNUHOSTDIST=	${DIST}
 Index: tools/Makefile
 ===================================================================
 --- tools/Makefile	15 Nov 2012 23:51:54 -0000	1.159
 +++ tools/Makefile	20 Nov 2012 22:43:57 -0000
 @@ -6,6 +6,17 @@
  # plain make.
  .MAIN: build_install

 +# TOOLDIR must be valid, unless MKTOOLS=no
 +.if ${MKTOOLS:Uyes} != "no"
 +.if "${TOOLDIR}" == ""
 +.error "TOOLDIR is undefined or empty"
 +.elif "${TOOLDIR}:tW:M/*" == ""
 +.error "TOOLDIR is not an absolute path: ${TOOLDIR}"
 +#.elif !exists(TOOLDIR) # XXX .exists fails for directories
 +#.error "TOOLDIR does not exist: ${TOOLDIR}"
 +.endif
 +.endif # MKTOOLS != no
 +
  .if defined(HAVE_GCC) || defined(HAVE_PCC)
  TOOLCHAIN_BITS= gmake .WAIT
  .endif
 @@ -50,7 +61,7 @@ DTRACE_BITS=
  .if ${MKDTRACE} != "no"
  DTRACE_BITS+= .WAIT libelf
  DTRACE_BITS+= .WAIT libdwarf
 -DTRACE_BITS+= .WAIT libctf 
 +DTRACE_BITS+= .WAIT libctf
  DTRACE_BITS+= .WAIT ctfconvert ctfmerge
  .endif

 @@ -59,9 +70,28 @@ LINT_BITS=
  LINT_BITS= lint lint2
  .endif

 +# All of host-mkdep, compat, and binstall are needed before anything
 +# else.  Within this group, they must be built in a specific order, and
 +# all of them must be built before any of them is installed.  They may
 +# be installed in any order.  This can't be expressed using the .WAIT
 +# notation inside the SUBDIR list.
 +#
 +# XXX .ORDER does not work when multiple targets are passed on the
 +# make command line without "-j", so use dependencies in addition to .ORDER.
 +#
 +.ORDER: dependall-host-mkdep dependall-compat dependall-binstall
 +.if make(dependall-host-mkdep) && make(dependall-compat)
 +dependall-compat: dependall-host-mkdep
 +.endif
 +.if make(dependall-compat) && make(dependall-binstall)
 +dependall-binstall: dependall-compat
 +.endif
 +
  # Dependencies in SUBDIR below ordered to maximize parallel ability.
 -SUBDIR=	host-mkdep .WAIT compat .WAIT \
 -	binstall .WAIT mktemp .WAIT sed .WAIT \
 +# See above for special treatment for host-mkdep, compat, and binstall.
 +#
 +SUBDIR=	host-mkdep compat binstall \
 +	.WAIT mktemp .WAIT sed .WAIT \
  		cap_mkdb crunchgen ctags genassym gencat hexdump join \
  		${LINT_BITS} \
  		lorder makewhatis mkdep mtree nbperf .WAIT rpcgen tsort \
 @@ -172,12 +202,15 @@ check_MKTOOLS: .PHONY .NOTMAIN
  .endif

  .if ${MKTOOLS:Uyes} == "no" || ${USETOOLS} != "yes"	# {
 +
 +SUBDIR= # empty
 +
  realall realdepend install: check_MKTOOLS

 -.for dir in ${SUBDIR:N.WAIT}
 -all-${dir} depend-${dir} dependall-${dir} install-${dir}:
 -	@true
 -.endfor
 +##.for dir in ${SUBDIR:N.WAIT}
 +##all-${dir} depend-${dir} dependall-${dir} install-${dir}:
 +##	@true
 +##.endfor
  .endif							# }

  .include <bsd.subdir.mk>
 Index: tools/Makefile.host
 ===================================================================
 --- tools/Makefile.host	10 Apr 2011 16:52:36 -0000	1.28
 +++ tools/Makefile.host	20 Nov 2012 21:41:50 -0000
 @@ -7,8 +7,8 @@ NOMAN=		# defined
  .include <bsd.own.mk>

  .ifndef NOCOMPATLIB
 -COMPATOBJ!=	cd ${.CURDIR}/../compat && ${PRINTOBJDIR}
 -.-include	"${COMPATOBJ}/defs.mk"
 +# Use TOOLDIR copy of libnbcompat and associated *.h files
 +.-include	"${TOOLDIR}/share/compat/defs.mk"
  .endif

  # Resolve pathnames in variables.
 Index: tools/binstall/Makefile
 ===================================================================
 --- tools/binstall/Makefile	3 Jul 2007 16:29:24 -0000	1.7
 +++ tools/binstall/Makefile	20 Nov 2012 21:24:10 -0000
 @@ -5,6 +5,21 @@ HOST_SRCDIR=	usr.bin/xinstall
  CPPFLAGS+=	-I${.CURDIR}/../compat/sys
  CPPFLAGS+=	-DTARGET_STRIP=\"${STRIP}\"

 +# Prevent Makefile.host from trying to use the version of libnbcompat
 +# from ${TOOLDIR}.
 +NOCOMPATLIB=
 +
  .include "${.CURDIR}/../Makefile.host"

 +# Use uninstalled copy of host-mkdep
 +HOST_MKDEP_OBJ!= cd ${.CURDIR}/../host-mkdep && ${PRINTOBJDIR}
 +HOST_MKDEP=	${HOST_MKDEP_OBJ}/host-mkdep
 +MKDEP=		${HOST_MKDEP}
 +
 +# Use uninstalled copy of libnbcompat and associated *.h files
 +COMPATLIB_UNINSTALLED= yes
 +COMPATOBJ!=	cd ${NETBSDSRCDIR}/tools/compat && ${PRINTOBJDIR}
 +.-include	"${COMPATOBJ}/defs.mk"
 +
 +# Use uninstalled copy of the install program
  INSTALL=	./xinstall
 Index: tools/compat/Makefile
 ===================================================================
 --- tools/compat/Makefile	4 Jun 2012 19:06:45 -0000	1.59
 +++ tools/compat/Makefile	20 Nov 2012 21:41:27 -0000
 @@ -55,6 +55,7 @@ CPPFLAGS+=	-I. -I./include -I${.CURDIR} 

  DPSRCS+=	defs.mk
  CLEANFILES+=	config.log config.status configure.lineno *.stamp
 +CLEANDIRFILES+=	defs.mk config.cache confdefs.h

  # Get components of Berkeley DB.
  _CURDIR:=	${.CURDIR}
 @@ -72,22 +73,72 @@ config.cache: include/.stamp configure n
  defs.mk: config.cache
  	@touch ${.TARGET}

 -# Run "${TOOLDIR}/bin/nbmake-${MACHINE} regen" by hand after editing
 -# configure.ac.  See more detailed instructions in configure.ac.
 -regen:
 -	cd ${.CURDIR} && ${TOOLDIR}/bin/${_TOOL_PREFIX}autoconf
 -	cd ${.CURDIR} && ${TOOLDIR}/bin/${_TOOL_PREFIX}autoheader
 -
  include/.stamp:
 -	mkdir -p include/sys include/machine include/rpc include/arpa
 +	mkdir -p ${INCSUBDIRS:@d@ include/$d @}
  	@touch ${.TARGET}

 -cleandir:
 -	-rm -f nbtool_config.h confdefs.h defs.mk
 -	-rm -r -f include
 -	-rm -f config.cache
 +INCFILES=	nbtool_config.h
 +INCSUBDIRS=	sys machine rpc arpa
 +CLEANDIRFILES+= ${INCFILES}
 +
 +# CLEANDIRFILES may not contain directory names
 +cleandir:	cleandir.include
 +cleandir.include: .PHONY
 +		rm -rf include
 +
 +# Install rules
 +
 +HOST_LIBDIR=	${TOOLDIR}/lib
 +HOST_INCSDIR=	${TOOLDIR}/include
 +HOST_SHAREDIR= ${TOOLDIR}/share
 +
 +install:	.PHONY install.lib install.includes install.defs.mk
 +
 +# Install lib${HOSTLIB}.a in ${TOOLDIR}/lib
 +install.lib: .PHONY ${HOST_LIBDIR}/lib${HOSTLIB}.a
 +${HOST_LIBDIR}/lib${HOSTLIB}.a: lib${HOSTLIB}.a
 +	${_MKTARGET_INSTALL}
 +	${HOST_INSTALL_DIR} ${HOST_LIBDIR}
 +	${HOST_INSTALL_FILE} -m ${LIBMODE} ${.ALLSRC} ${.TARGET}
 +
 +# Install include files in ${TOOLDIR}/include/compat
 +install.includes: .PHONY
 +	${_MKMSG_INSTALL} "${HOST_INCSDIR}/*"
 +	${HOST_INSTALL_DIR} ${HOST_INCSDIR}
 +	${HOST_INSTALL_DIR} ${HOST_INCSDIR}/compat
 +	${HOST_INSTALL_FILE} ${INCFILES} ${HOST_INCSDIR}/compat/
 +.for _d in ${INCSUBDIRS}
 +	${HOST_INSTALL_DIR} ${HOST_INCSDIR}/compat/${_d}
 +	touch include/${_d}/dummy # ensure dir is not empty
 +	${HOST_INSTALL_FILE} include/${_d}/* ${HOST_INCSDIR}/compat/${_d}/
 +.endfor
 +
 +# Install defs.mk in ${TOOLDIR}/share/compat
 +install.defs.mk: .PHONY ${HOST_SHAREDIR}/compat/defs.mk
 +${HOST_SHAREDIR}/compat/defs.mk: defs.mk
 +	${_MKTARGET_INSTALL}
 +	${HOST_INSTALL_DIR} ${HOST_SHAREDIR}
 +	${HOST_INSTALL_DIR} ${HOST_SHAREDIR}/compat
 +	${HOST_INSTALL_FILE} ${.ALLSRC} ${.TARGET}
 +
 +# bsd.hostlib.mk wants HOST_CPPFLAGS, not CPPFLAGS

  HOST_CPPFLAGS:=	${CPPFLAGS}
  CPPFLAGS:=	# empty

  .include <bsd.hostlib.mk>
 +
 +# Use uninstalled copy of host-mkdep
 +HOST_MKDEP_OBJ!= cd ${.CURDIR}/../host-mkdep && ${PRINTOBJDIR}
 +HOST_MKDEP=	${HOST_MKDEP_OBJ}/host-mkdep
 +MKDEP=		${HOST_MKDEP}
 +
 +# Use uninstalled copy of the install program
 +INSTALL_OBJ!=	cd ${NETBSDSRCDIR}/tools/binstall && ${PRINTOBJDIR}
 +INSTALL=	${INSTALL_OBJ}/xinstall
 +
 +# Run "${TOOLDIR}/bin/nbmake-${MACHINE} regen" by hand after editing
 +# configure.ac.  See more detailed instructions in configure.ac.
 +regen:
 +	cd ${.CURDIR} && ${TOOLDIR}/bin/${_TOOL_PREFIX}autoconf
 +	cd ${.CURDIR} && ${TOOLDIR}/bin/${_TOOL_PREFIX}autoheader
 Index: tools/compat/defs.mk.in
 ===================================================================
 --- tools/compat/defs.mk.in	14 Aug 2011 20:22:42 -0000	1.10
 +++ tools/compat/defs.mk.in	20 Nov 2012 21:24:19 -0000
 @@ -1,8 +1,72 @@
  #	$NetBSD: defs.mk.in,v 1.10 2011/08/14 20:22:42 apb Exp $
 +#
 +# Makefile fragment for building with libnbcompat and associated
 +# include files.  It can also be used for building just with
 +# the include files, without the library.
 +#
 +# This can be used when the library and include files have been installed
 +# into TOOLDIR (by "make install" in the src/tools/compat directory),
 +# or when they have not been installed into TOOLDIR but reside
 +# in the .OBJDIR associated with src/tools/compat.
 +#
 +# Variables:
 +#
 +# COMPATLIB_UNINSTALLED:
 +#		If "yes", then use the files from the .OBJDIR of
 +#		NETBSDSRCDIR/tools/compat.  Otherwise, use the files
 +#		from TOOLDIR.
 +#
 +# COMPATLIB_NO_LIB:
 +#		If "yes" then do not use the library (but still use
 +#		the include files).
 +#
 +# Examples:
 +#
 +# * Use uninstalled copy of libnbcompat and associated *.h files:
 +#
 +#	COMPATLIB_UNINSTALLED= yes
 +#	COMPATOBJ!=	cd ${NETBSDSRCDIR}/tools/compat && ${PRINTOBJDIR}
 +#	.-include	"${COMPATOBJ}/defs.mk"
 +#
 +# * Use TOOLDIR copy of libnbcompat and associated *.h files:
 +#
 +#	.-include	"${TOOLDIR}/share/compat/defs.mk"
 +#
 +# * Use TOOLDIR copy of compat *.h files, but do not use libnbcompat.a:
 +#
 +#	COMPATLIB_NO_LIB= yes
 +#	.-include	"${TOOLDIR}/share/compat/defs.mk"
 +#
 +# The use of ".-include" instead of ".include" above is because it's
 +# expected that the file might not exist during "make obj" or "make clean".
 +#
 +
 +.include <bsd.own.mk>
 +
 +# Use the installed (TOOLDIR) version of the library and headers by default
 +COMPATLIB_UNINSTALLED ?= no
 +# Use library and includes by default.
 +COMPATLIB_NO_LIB ?= no

 +.if "${COMPATLIB_UNINSTALLED}" == "yes"
 +# The library lives in the .OBJDIR.
 +#
 +# Some include files live directly in the .OBJDIR, while others
 +# live in subdirectories of .OBJDIR/include.
 +#
  COMPATOBJ:=	${.PARSEDIR}
 -HOSTEXEEXT=	@EXEEXT@
 +COMPATLIBDIR=	${COMPATOBJ}
 +COMPATINCFLAGS=	-I${COMPATOBJ} -I${COMPATOBJ}/include
 +.else
 +# The library lives in TOOLDIR/lib.
 +#
 +# All include files live in TOOLDIR/include/comnpat, and its subdirectories.
 +#
 +COMPATLIBDIR=	${TOOLDIR}/lib
 +COMPATINCFLAGS=	-I${TOOLDIR}/include/compat
 +.endif

 +HOSTEXEEXT=	@EXEEXT@
  HOST_BSHELL=	@BSHELL@

  BUILD_OSTYPE!=  uname -s
 @@ -12,11 +76,12 @@ BUILD_OSTYPE!=  uname -s
  HOST_CPPFLAGS+=	-no-cpp-precomp
  .endif

 -HOST_CPPFLAGS+=	-I${COMPATOBJ} -I${COMPATOBJ}/include \
 -		-I${.CURDIR}/../compat -DHAVE_NBTOOL_CONFIG_H=1 \
 -		-D_FILE_OFFSET_BITS=64
 +HOST_CPPFLAGS+=	${COMPATINCFLAGS} -I${NETBSDSRCDIR}/tools/compat \
 +		-DHAVE_NBTOOL_CONFIG_H=1 -D_FILE_OFFSET_BITS=64

 -DPADD+=		${COMPATOBJ}/libnbcompat.a
 -LDADD+=		-L${COMPATOBJ} -lnbcompat @LIBS@
 +.if "${COMPATLIB_NO_LIB}" != "yes"
 +DPADD+=		${COMPATLIBDIR}/libnbcompat.a
 +LDADD+=		-L${COMPATLIBDIR} -lnbcompat @LIBS@
 +.endif # ! COMPATLIB_NO_LIB

  HAVE_PTHREAD_H=	@HAVE_PTHREAD_H@
 Index: tools/genassym/Makefile
 ===================================================================
 --- tools/genassym/Makefile	25 Oct 2008 22:15:28 -0000	1.5
 +++ tools/genassym/Makefile	20 Nov 2012 21:24:14 -0000
 @@ -4,9 +4,7 @@

  .PATH.sh:	${.CURDIR}/../../usr.bin/genassym

 -COMPATOBJ!=	cd ${.CURDIR}/../compat && ${PRINTOBJDIR}
 -.-include	"${COMPATOBJ}/defs.mk"
 -
 +.-include	"${TOOLDIR}/share/compat/defs.mk"

  TIMESTAMP=	${TOOLDIR}/bin/${_TOOL_PREFIX}genassym

 Index: tools/groff/Makefile
 ===================================================================
 --- tools/groff/Makefile	25 Oct 2008 22:15:28 -0000	1.29
 +++ tools/groff/Makefile	20 Nov 2012 21:24:14 -0000
 @@ -29,10 +29,9 @@ _post_conf: .USE


  .include "${.CURDIR}/../Makefile.gnuhost"
 -COMPATOBJ!=	cd ${.CURDIR}/../compat && ${PRINTOBJDIR}
 -.-include	"${COMPATOBJ}/defs.mk"
 +.-include "${TOOLDIR}/share/compat/defs.mk"

 -.PATH:		${.CURDIR}/../../share/tmac ${.CURDIR}/../../gnu/usr.bin/groff/tmac
 +.PATH:	${.CURDIR}/../../share/tmac ${.CURDIR}/../../gnu/usr.bin/groff/tmac

  _installtmac: .USE
  .if ${MKUPDATE} != "no"
 Index: tools/host-mkdep/Makefile
 ===================================================================
 --- tools/host-mkdep/Makefile	19 Oct 2008 22:05:23 -0000	1.10
 +++ tools/host-mkdep/Makefile	20 Nov 2012 21:24:04 -0000
 @@ -1,27 +1,48 @@
  #	$NetBSD: Makefile,v 1.10 2008/10/19 22:05:23 apb Exp $

 -TIMESTAMP=	${TOOLDIR}/bin/${_TOOL_PREFIX}host-mkdep
 +HOSTPROG= 	host-mkdep
 +HOSTPROGNAME=	${_TOOL_PREFIX}host-mkdep
 +HOST_BINDIR=	${TOOLDIR}/bin
 +
 +NOMAN=	# defined
 +SRCS=	# empty

  CLEANFILES+=	config.cache config.log config.status host-mkdep

  .include <bsd.hostprog.mk>

 -# When host-mkdep is built, TOOL_AWK is not yet available, so we do not
 -# pass AWK=${TOOL_AWK:Q} to configure; we allow configure to find awk
 -# for itself (or complain if it can't find awk).
 +# XXX: The configure script needs to use awk, but we can't pass
 +# AWK=${TOOL_AWK:Q} in CONFIGURE_ENV, because TOOL_AWK is not yet
 +# available at the time that host-mkdep is built.  The configure script
 +# will try to find some other version of awk.
 +#
 +CONFIGURE_ENV=	CC=${HOST_CC:Q}

  realall: host-mkdep
  host-mkdep: configure host-mkdep.in
  	-rm -f $@
 -	CC=${HOST_CC:Q} ${HOST_SH} ${.CURDIR}/configure --cache-file=config.cache
 +	${CONFIGURE_ENV} \
 +	    ${HOST_SH} ${.CURDIR}/configure --cache-file=config.cache
  	chmod +x $@

 -# This is the only program that comes before binstall.
 -install: ${TIMESTAMP}
 -${TIMESTAMP}: host-mkdep
 -	mkdir -p ${TOOLDIR}/bin
 -	cp host-mkdep $@
 -	chmod +x $@
 +# Use uninstalled copy of the install program
 +INSTALL_OBJ!=	cd ${NETBSDSRCDIR}/tools/binstall && ${PRINTOBJDIR}
 +INSTALL=	${INSTALL_OBJ}/xinstall
 +
 +# Install rule, copied from src/tools/Makefile.host.
 +# We can't include Makefile.host because there is no HOST_SRCDIR
 +# corresponding to host-mkdep.
 +#
 +realinstall: install.host
 +install.host: ${HOST_BINDIR}/${HOSTPROGNAME}
 +${HOST_BINDIR}/${HOSTPROGNAME}:: ${HOSTPROG}
 +	${_MKTARGET_INSTALL}
 +	mkdir -p ${HOST_BINDIR}
 +	${HOST_INSTALL_FILE} -m ${BINMODE} ${HOSTPROG}${HOSTEXEEXT} ${.TARGET}
 +
 +.if ${MKUPDATE} == "no"
 +.PHONY:		${HOST_BINDIR}/${HOSTPROGNAME}
 +.endif

  # Run by hand, then "configure" script committed:
  regen:
 Index: tools/libctf/Makefile
 ===================================================================
 --- tools/libctf/Makefile	17 Apr 2011 12:52:26 -0000	1.3
 +++ tools/libctf/Makefile	20 Nov 2012 21:24:14 -0000
 @@ -23,8 +23,8 @@ LIBELF_DIR=	${.CURDIR}/../../external/bs
  CPPFLAGS+=	-DCTF_OLD_VERSIONS

  .ifndef NOCOMPATLIB
 -COMPATOBJ!=     cd ${.CURDIR}/../compat && ${PRINTOBJDIR}
 -CPPFLAGS+=	-I${COMPATOBJ}
 +COMPATLIB_NO_LIB= yes # only the include files, not the library
 +.-include	"${TOOLDIR}/share/compat/defs.mk"
  .endif

  CPPFLAGS+=	-I${.CURDIR}/../compat \
 Index: tools/libdwarf/Makefile
 ===================================================================
 --- tools/libdwarf/Makefile	17 Apr 2011 12:52:26 -0000	1.3
 +++ tools/libdwarf/Makefile	20 Nov 2012 21:24:14 -0000
 @@ -25,8 +25,8 @@ INCS=		dwarf.h libdwarf.h
  INCSDIR=	/usr/include

  .ifndef NOCOMPATLIB
 -COMPATOBJ!=     cd ${.CURDIR}/../compat && ${PRINTOBJDIR}
 -CPPFLAGS+=	-I${COMPATOBJ}
 +COMPATLIB_NO_LIB= yes # only the include files, not the library
 +.-include	"${TOOLDIR}/share/compat/defs.mk"
  .endif

  CPPFLAGS+=	-I${.CURDIR}/../compat -I${LIBDWARF_DIR} -I${LIBELF_DIR}
 Index: tools/libelf/Makefile
 ===================================================================
 --- tools/libelf/Makefile	17 Apr 2011 12:52:26 -0000	1.5
 +++ tools/libelf/Makefile	20 Nov 2012 21:24:14 -0000
 @@ -67,8 +67,8 @@ CPPFLAGS+=	-no-cpp-precomp

  CPPFLAGS+=	-DHAVE_NBTOOL_CONFIG_H=1 -D_FILE_OFFSET_BITS=64
  .ifndef NOCOMPATLIB
 -COMPATOBJ!=     cd ${.CURDIR}/../compat && ${PRINTOBJDIR}
 -CPPFLAGS+=	-I${COMPATOBJ}
 +COMPATLIB_NO_LIB= yes # only the include files, not the library
 +.-include	"${TOOLDIR}/share/compat/defs.mk"
  .endif

  .PATH:		${LIBELF_DIR}
 Index: tools/lorder/Makefile
 ===================================================================
 --- tools/lorder/Makefile	25 Oct 2008 22:15:28 -0000	1.11
 +++ tools/lorder/Makefile	20 Nov 2012 21:24:14 -0000
 @@ -2,8 +2,7 @@

  .include <bsd.own.mk>

 -COMPATOBJ!=	cd ${.CURDIR}/../compat && ${PRINTOBJDIR}
 -.-include	"${COMPATOBJ}/defs.mk"
 +.-include	"${TOOLDIR}/share/compat/defs.mk"

  TIMESTAMP=	${TOOLDIR}/bin/${_TOOL_PREFIX}lorder


 --4Ckj6UjgE2iN1+kY--

From: "Simon J. Gerraty" <sjg@crufty.net>
To: gnats-bugs@NetBSD.org
Cc: apb@NetBSD.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Subject: Re: toolchain/47188: MKTOOLS=no broken
Date: Wed, 21 Nov 2012 22:42:24 -0800

 > Please try the attached patch.  It does the following:

 Thanks, 1st attempt to build tools with:

 mkdir -p /var/obj/NetBSD/current/amd64/obj \
 /var/obj/NetBSD/current/amd64/destdir \
  /var/obj/NetBSD/current/amd64/release \
  /var/obj/NetBSD/current/tools/NetBSD-6.99.15-x86_64
 TOOLDIR=/var/obj/NetBSD/current/tools/NetBSD-6.99.15-x86_64 MKTOOLS=
 sh -x ./build.sh -j 3 -m amd64 -O /var/obj/NetBSD/current/amd64/obj \
 -D/var/obj/NetBSD/current/amd64/destdir \
 -R /var/obj/NetBSD/current/amd64/release tools

 got as far as:

 /var/obj/NetBSD/current/tools/NetBSD-6.99.15-x86_64/bin/nbhost-mkdep -d
 -f .depend -s .lo\ .ln
 sh: /var/obj/NetBSD/current/tools/NetBSD-6.99.15-x86_64/bin/nbhost-mkdep: not found
 *** [.depend] Error code 127
 nbmake: stopped in /h/NetBSD/current/src/tools/host-mkdep
 1 error

 I blew it all away and tried without -j3 - same result.

 I'm not sure how 'make depend' should work in that dir - since its the
 tool that 'make depend' relies on.
 bsd.dep.mk does not look like does any tests for !target etc, so one
 cannot just create a dummy target - which suggests I'm missing
 something...

From: Alan Barrett <apb@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: toolchain/47188: MKTOOLS=no broken
Date: Fri, 23 Nov 2012 12:45:12 +0300

 On Wed, 21 Nov 2012, Simon J. Gerraty wrote:
 >Thanks, 1st attempt to build tools with: [...]
 >got as far as:
 >
 >/var/obj/NetBSD/current/tools/NetBSD-6.99.15-x86_64/bin/nbhost-mkdep -d
 >-f .depend -s .lo\ .ln
 >sh: /var/obj/NetBSD/current/tools/NetBSD-6.99.15-x86_64/bin/nbhost-mkdep: not found
 >*** [.depend] Error code 127
 >nbmake: stopped in /h/NetBSD/current/src/tools/host-mkdep
 >1 error

 I think you may be missing revision 1.75 of
 src/share/mk/bsd.dep.mk, which added some
 "defined(SRCS) && !empty(SRCS)" tests.

 --apb (Alan Barrett)

From: "Simon J. Gerraty" <sjg@crufty.net>
To: gnats-bugs@NetBSD.org
Cc: apb@NetBSD.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Subject: Re: toolchain/47188: MKTOOLS=no broken
Date: Fri, 23 Nov 2012 09:34:26 -0800

 On Fri, 23 Nov 2012 09:50:06 +0000 (UTC), Alan Barrett writes:
 > I think you may be missing revision 1.75 of
 > src/share/mk/bsd.dep.mk, which added some
 > "defined(SRCS) && !empty(SRCS)" tests.

 Yes, updated share/mk but still die in 

 dependall ===> mktemp
 --- mktemp.d ---
 #    create  mktemp/mktemp.d
 /var/obj/NetBSD/current/tools/NetBSD-6.99.15-x86_64/bin/nbhost-mkdep -f
 mktemp.d
  --
  /h/NetBSD/current/src/tools/mktemp/../../usr.bin/mktemp/mktemp.c
 sh:
 /var/obj/NetBSD/current/tools/NetBSD-6.99.15-x86_64/bin/nbhost-mkdep:
 not fo
 und
 *** [mktemp.d] Error code 127

 Same result without -j3
 I guess I should go find an updated known to build date.

From: Alan Barrett <apb@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: toolchain/47188: MKTOOLS=no broken
Date: Fri, 23 Nov 2012 21:48:24 +0300

 On Fri, 23 Nov 2012, Simon J. Gerraty wrote:
 >Yes, updated share/mk but still die in
 >
 >dependall ===> mktemp
 >--- mktemp.d ---
 >#    create  mktemp/mktemp.d
 >/var/obj/NetBSD/current/tools/NetBSD-6.99.15-x86_64/bin/nbhost-mkdep -f
 >mktemp.d
 > --
 > /h/NetBSD/current/src/tools/mktemp/../../usr.bin/mktemp/mktemp.c
 >sh:
 >/var/obj/NetBSD/current/tools/NetBSD-6.99.15-x86_64/bin/nbhost-mkdep:
 >not fo
 >und
 >*** [mktemp.d] Error code 127

 Now it looks as though you do have joerg's recent changes to
 tools/Makefile, but don't have the changes to build.sh that were
 committed at the same time.  tools/Makefile now expects build.sh
 to invoke "make build_install", not "make dependall".  The logic
 to install some things before building other things is now in
 bsd.buildinstall.mk instead of in tools/Makefile, and it works only
 for "make build_install", not for "make dependall".

 --apb (Alan Barrett)

From: "Simon J. Gerraty" <sjg@crufty.net>
To: gnats-bugs@NetBSD.org
Cc: apb@NetBSD.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Subject: Re: toolchain/47188: MKTOOLS=no broken
Date: Fri, 23 Nov 2012 14:05:08 -0800

 On Fri, 23 Nov 2012 18:50:09 +0000 (UTC), Alan Barrett writes:
 >The following reply was made to PR toolchain/47188; it has been noted by GNATS
 >.
 >
 >From: Alan Barrett <apb@netbsd.org>
 >To: gnats-bugs@NetBSD.org
 >Cc: 
 >Subject: Re: toolchain/47188: MKTOOLS=no broken
 >Date: Fri, 23 Nov 2012 21:48:24 +0300
 >
 > On Fri, 23 Nov 2012, Simon J. Gerraty wrote:
 > >Yes, updated share/mk but still die in
 > >
 > >dependall ===> mktemp
 > >--- mktemp.d ---
 > >#    create  mktemp/mktemp.d
 > >/var/obj/NetBSD/current/tools/NetBSD-6.99.15-x86_64/bin/nbhost-mkdep -f
 > >mktemp.d
 > > --
 > > /h/NetBSD/current/src/tools/mktemp/../../usr.bin/mktemp/mktemp.c
 > >sh:
 > >/var/obj/NetBSD/current/tools/NetBSD-6.99.15-x86_64/bin/nbhost-mkdep:
 > >not fo
 > >und
 > >*** [mktemp.d] Error code 127
 > 
 > Now it looks as though you do have joerg's recent changes to

 Yes, I've updated my tree to 2012-11-21 08:10 UTC which is the last
 successful daily for both amd64 and i386 it seems.

 The tools built ok, starting release build.

From: "Simon J. Gerraty" <sjg@crufty.net>
To: gnats-bugs@NetBSD.org
Cc: apb@NetBSD.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Subject: Re: toolchain/47188: MKTOOLS=no broken
Date: Fri, 23 Nov 2012 21:30:06 -0800

 > The tools built ok, starting release build.

 Which also finished ok (with obj tree removed in between).

 Thanks
 --sjg


State-Changed-From-To: open->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Sun, 02 Dec 2012 04:42:20 +0000
State-Changed-Why:
Caused by inconsistent updates to the source tree; now resolved.


From: "Alan Barrett" <apb@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/47188 CVS commit: src
Date: Sun, 2 Dec 2012 12:55:28 +0000

 Module Name:	src
 Committed By:	apb
 Date:		Sun Dec  2 12:55:27 UTC 2012

 Modified Files:
 	src/bin/sh: Makefile
 	src/distrib/cdrom/macppc_installboot: Makefile
 	src/distrib/cdrom/macppc_mkboothfs: Makefile
 	src/external/gpl3/gcc/usr.bin: Makefile.inc
 	src/gnu/usr.bin/gcc4: Makefile.inc

 Log Message:
 Adjust everything under src (but outside src/tools) to use
 the TOOLDIR version of libnbcompat, associated include files,
 and associated defs.mk file, instead of the version from the
 .OBJDIR of src/tools/compat.  This should fix PR 47188.


 To generate a diff of this commit:
 cvs rdiff -u -r1.98 -r1.99 src/bin/sh/Makefile
 cvs rdiff -u -r1.8 -r1.9 src/distrib/cdrom/macppc_installboot/Makefile
 cvs rdiff -u -r1.4 -r1.5 src/distrib/cdrom/macppc_mkboothfs/Makefile
 cvs rdiff -u -r1.11 -r1.12 src/external/gpl3/gcc/usr.bin/Makefile.inc
 cvs rdiff -u -r1.5 -r1.6 src/gnu/usr.bin/gcc4/Makefile.inc

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Alan Barrett" <apb@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/47188 CVS commit: src/tools/compat
Date: Sun, 2 Dec 2012 13:05:14 +0000

 Module Name:	src
 Committed By:	apb
 Date:		Sun Dec  2 13:05:14 UTC 2012

 Modified Files:
 	src/tools/compat: defs.mk.in

 Log Message:
 Change the default value of COMPATLIB_UNINSTALLED to no, now that
 all users of comapt/defs.mk have been adjusted.  This is the last
 commit related to fixing PR 47188.


 To generate a diff of this commit:
 cvs rdiff -u -r1.11 -r1.12 src/tools/compat/defs.mk.in

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.