NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: toolchain/49535: Examples in BUILDING don't work as-is



The following reply was made to PR toolchain/49535; it has been noted by GNATS.

From: Alan Barrett <apb%cequrux.com@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: 
Subject: Re: toolchain/49535: Examples in BUILDING don't work as-is
Date: Sun, 4 Jan 2015 16:59:12 +0200

 On Sun, 04 Jan 2015, Andreas Gustafsson wrote:
 >    1.   % ./build.sh [options] tools kernel=GENERIC
 
 >>Fix:
 >
 >First of all, presumably the shell prompt in Example 1 should be
 >changed from "%" to "#" to indicate that the command is to be run as
 >root, because unprivileged builds are covered separately in example
 >number 2.
 
 No, let's rather add "-U" to the example.  We should not encourage
 builds as root.
 
 >As for the lack of a /usr/obj, there are many ways that could be
 >fixed, but I have no idea which one is correct.  I can think of
 >at least four:
 >
 >1. If /usr/obj is supposed to exist in a fresh install, it should be
 >added to the release.
 >
 >2. If you are supposed to specify a -O or -M option to build.sh to
 >force the object directory to be created, the example should contain
 >such an option.
 >
 >3. If you are supposed to manually mkdir /usr/obj, the example should
 >include that command.
 >
 >4. If build.sh is supposed to create the object directory
 >automatically, it should be changed to do so.
 
 build.sh does attempt to create the top-level object directory.
 See this code:
 
 1693     if [ -n "$TOP_obj" ]; then
 1694             ${runcmd} mkdir -p "${TOP_obj}" ||
 1695                 bomb "Can't create top level object directory" \
 1696                             "${TOP_obj}"
 1697     else
 1698             ${runcmd} "${make}" -m ${TOP}/share/mk obj NOSUBDIR= ||
 1699                 bomb "Can't create top level object directory" \
 1700                             "using make obj"
 1701     fi
 
 There are many ways to choose the object directory name, using 
 various combinations of environment variables, mk.conf settings, 
 build.sh command line options, bsd.obj.mk rules, and built-in 
 defaults in make itself.  build.sh attempts to follow the same 
 rules that would be used if you ran make directly, but the rules 
 are so complex that it could make a mistake in some cases.
 
 The error message you saw "Can't create ... using make obj" 
 appears only if build.sh's attempts to guess the correct directoy 
 name are unsuccessful (the $TOP_obj variable is not set), and 
 make(1) is also unable to create the directory.
 
 In this case, the src directory was /usr/src, and you expected the obj
 directory to be /usr/obj, but build.sh did not make that guess.  I have
 no idea why "make -m /usr/src/share/mk obj NOSUBDIR=" was unable to
 create the directory.  Let's try to figure that out first.
 
 --apb (Alan Barrett)
 


Home | Main Index | Thread Index | Old Index