NetBSD Problem Report #39522

From www@NetBSD.org  Fri Sep 12 02:33:01 2008
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by narn.NetBSD.org (Postfix) with ESMTP id ADF6863B92A
	for <gnats-bugs@gnats.netbsd.org>; Fri, 12 Sep 2008 02:33:01 +0000 (UTC)
Message-Id: <20080912023301.6293563B853@narn.NetBSD.org>
Date: Fri, 12 Sep 2008 02:33:01 +0000 (UTC)
From: abutter.gao@gmail.com
Reply-To: abutter.gao@gmail.com
To: gnats-bugs@NetBSD.org
Subject: Turning on make's debugging info will change the building options
X-Send-Pr-Version: www-1.0

>Number:         39522
>Category:       misc
>Synopsis:       Turning on make's debugging info will change the building options
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    misc-bug-people
>State:          feedback
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Sep 12 02:35:00 +0000 2008
>Closed-Date:    
>Last-Modified:  Fri May 19 20:14:31 +0000 2023
>Originator:     Gao Ya'nan
>Release:        NetBSD-current and NetBSD-4.0
>Organization:
>Environment:
NetBSD abutter.foo.org 4.0 NetBSD 4.0 (GENERIC) #0: Sun Dec 16 00:20:10 PST 2007  builds@wb34:/home/builds/ab/netbsd-4-0-RELEASE/i386/200712160005Z-obj/home/builds/ab/netbsd-4-0-RELEASE/src/sys/arch/i386/compile/GENERIC i386

>Description:
As a newbie on BSD make, I turn on the make's debugging info to get what happend. 

so I copied build.sh to mybuild.sh and added some code to send the debugging flag to make.

When I used mybuild.sh to make tools, some error occured. I checked the output and found that make lost some options.

The good and bad ones are below:
-----------------------------------------------------------------------

The good one:
===> mybuild.sh command: ./mybuild.sh -O ../obj-x86/obj -T ../obj-x86/tools -U -u tools kernel=GENERIC

#    create  binstall/xinstall.d
/usr/src/../obj-x86/tools/bin/nbhost-mkdep -f xinstall.d --     -I/usr/src/../obj-x86/obj/tools/compat -I/usr/src/../obj-x86/obj/tools/compat/include  -I/usr/src/tools/binstall/../compat -DHAVE_NBTOOL_CONFIG_H=1  -D_FILE_OFFSET_BITS=64  -I/usr/src/tools/binstall/../compat/sys -DTARGET_STRIP=\"/usr/src/../obj-x86/tools/bin/i386--netbsdelf-strip\" -I/usr/src/bin/ls -I/usr/src/usr.sbin/mtree  /usr/src/tools/binstall/../../usr.bin/xinstall/xinstall.c

-----------------------------------------------------------------------

Turn on the debugging info:
===> mybuild.sh command: ./mybuild.sh -f p -O ../obj-x86/obj -T ../obj-x86/tools -U -u tools kernel=GENERIC

#    create  binstall/xinstall.d
/usr/src/../obj-x86/tools/bin/nbhost-mkdep -f xinstall.d --       -I/usr/src/tools/binstall/../compat/sys -DTARGET_STRIP=\"/usr/src/../obj-x86/tools/bin/i386--netbsdelf-strip\" -I/usr/src/bin/ls -I/usr/src/usr.sbin/mtree  /usr/src/tools/binstall/../../usr.bin/xinstall/xinstall.c
In file included from /usr/src/tools/binstall/../../usr.bin/xinstall/xinstall.c:75:
/usr/src/tools/binstall/../compat/sys/sha1.h:4:27: error: nbtool_config.h: No such file or directory
---------------------------------------------------------------------

So I think turning on make's debugging info will change the building options
>How-To-Repeat:
Apply the patch below and run ./mybuild.sh -f p -O ../obj-x86/obj -T ../obj-x86/tools -U -u tools

--- ./build.sh	2007-11-27 05:40:55.000000000 +0800
+++ ./mybuild.sh	2008-01-07 20:43:49.000000000 +0800
@@ -492,6 +492,7 @@
     -E          Set "expert" mode; disables various safety checks.
                 Should not be used without expert knowledge of the build system.
     -h          Print this help message.
+    -f flag     Send debugging flag to make; see make(1) -d.
     -j njob     Run up to njob jobs in parallel; see make(1) -j.
     -M obj      Set obj root directory to obj; sets MAKEOBJDIRPREFIX.
                 Unsets MAKEOBJDIR.
@@ -526,7 +527,7 @@

 parseoptions()
 {
-	opts='a:B:bC:D:dEhi:j:k:M:m:N:nO:oR:rT:tUuV:w:xX:Z:'
+	opts='a:B:bC:D:dEf:hi:j:k:M:m:N:nO:oR:rT:tUuV:w:xX:Z:'
 	opt_a=no

 	if type getopts >/dev/null 2>&1; then
@@ -588,6 +589,11 @@
 			do_expertmode=true
 			;;

+		-f)
+			eval ${optargcmd}
+			debugflag="-d ${OPTARG}"
+			;;
+
 		-i)
 			usage "'-i idir' has been replaced by 'install=idir'"
 			;;
@@ -1003,17 +1009,17 @@
 buildtools()
 {
 	if [ "${MKOBJDIRS}" != "no" ]; then
-		${runcmd} "${makewrapper}" ${parallel} obj-tools ||
+		${runcmd} "${makewrapper}" ${parallel} ${debugflag} obj-tools ||
 		    bomb "Failed to make obj-tools"
 	fi
 	${runcmd} cd tools
 	if [ "${MKUPDATE}" = "no" ]; then
-		${runcmd} "${makewrapper}" ${parallel} cleandir ||
+		${runcmd} "${makewrapper}" ${parallel} ${debugflag} cleandir ||
 		    bomb "Failed to make cleandir tools"
 	fi
-	${runcmd} "${makewrapper}" ${parallel} dependall ||
+	${runcmd} "${makewrapper}" ${parallel} ${debugflag} dependall ||
 	    bomb "Failed to make dependall tools"
-	${runcmd} "${makewrapper}" ${parallel} install ||
+	${runcmd} "${makewrapper}" ${parallel} ${debugflag} install ||
 	    bomb "Failed to make install tools"
 	statusmsg "Tools built to ${TOOLDIR}"
 	${runcmd} cd "${TOP}"
@@ -1030,7 +1036,7 @@
 		KERNSRCDIR="$(getmakevar KERNSRCDIR)"
 		KERNARCHDIR="$(getmakevar KERNARCHDIR)"
 		${runcmd} cd "${KERNSRCDIR}/${KERNARCHDIR}/compile"
-		${runcmd} "${makewrapper}" ${parallel} obj ||
+		${runcmd} "${makewrapper}" ${parallel} ${debugflag} obj ||
 		    bomb "Failed to make obj in ${KERNSRCDIR}/${KERNARCHDIR}/compile"
 		${runcmd} cd "${TOP}"
 	fi
@@ -1068,7 +1074,7 @@
 	    bomb "Cannot mkdir: ${kernelbuildpath}"
 	if [ "${MKUPDATE}" = "no" ]; then
 		${runcmd} cd "${kernelbuildpath}"
-		${runcmd} "${makewrapper}" ${parallel} cleandir ||
+		${runcmd} "${makewrapper}" ${parallel} ${debugflag} cleandir ||
 		    bomb "Failed to make cleandir in ${kernelbuildpath}"
 		${runcmd} cd "${TOP}"
 	fi
@@ -1076,9 +1082,9 @@
 		-s "${TOP}/sys" "${kernelconfpath}" ||
 	    bomb "${toolprefix}config failed for ${kernelconf}"
 	${runcmd} cd "${kernelbuildpath}"
-	${runcmd} "${makewrapper}" ${parallel} depend ||
+	${runcmd} "${makewrapper}" ${parallel} ${debugflag} depend ||
 	    bomb "Failed to make depend in ${kernelbuildpath}"
-	${runcmd} "${makewrapper}" ${parallel} all ||
+	${runcmd} "${makewrapper}" ${parallel} ${debugflag} all ||
 	    bomb "Failed to make all in ${kernelbuildpath}"
 	${runcmd} cd "${TOP}"

@@ -1150,19 +1156,19 @@

 		sets)
 			statusmsg "Building sets from pre-populated ${DESTDIR}"
-			${runcmd} "${makewrapper}" ${parallel} ${op} ||
+			${runcmd} "${makewrapper}" ${parallel} ${debugflag} ${op} ||
 			    bomb "Failed to make ${op}"
 			statusmsg "Successful make ${op}"
 			;;

 		obj|build|distribution|release|sourcesets|syspkgs|params)
-			${runcmd} "${makewrapper}" ${parallel} ${op} ||
+			${runcmd} "${makewrapper}" ${parallel} ${debugflag} ${op} ||
 			    bomb "Failed to make ${op}"
 			statusmsg "Successful make ${op}"
 			;;

 		iso-image|iso-image-source)
-			${runcmd} "${makewrapper}" ${parallel} \
+			${runcmd} "${makewrapper}" ${parallel} ${debugflag} \
 			    CDEXTRA=$iso_dir ${op} ||
 			    bomb "Failed to make ${op}"
 			statusmsg "Successful make ${op}"

>Fix:
I didn't find it yet.

>Release-Note:

>Audit-Trail:

State-Changed-From-To: open->feedback
State-Changed-By: lukem@NetBSD.org
State-Changed-When: Fri, 19 May 2023 20:14:31 +0000
State-Changed-Why:
I modified a local copy of build.sh so that the makewrapper
invoked make with "-d p", and successfuly used build.sh tools
(with a 48 MiB build log, versus 134 KiB build log without -d p).

I'm not convinced that we need another option to build.sh to pass
through debug options to make; just use build.sh to create makewrapper
and invoke that wrapper with the appropriate options and make targets.

Back to the ticket's original bug; do you experience build problems
when you have enabled make -d p, building -current?


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: gnats-precook-prs,v 1.4 2018/12/21 14:20:20 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.