Re: World broken in stage 1.1

From: Ruslan Ermilov <ru_at_FreeBSD.org>
Date: Wed, 11 Aug 2004 11:03:50 +0300
On Tue, Aug 10, 2004 at 11:59:12PM -0700, Kris Kennaway wrote:
> On Wed, Aug 11, 2004 at 09:12:02AM +0300, Ruslan Ermilov wrote:
> > On Tue, Aug 10, 2004 at 04:10:44PM -0700, Kris Kennaway wrote:
> > > I'm trying to update a current from a few months ago, and it dies almost immediately:
> > > 
> > > Script started on Tue Aug 10 23:06:32 2004
> > > pointyhat# make cleanworld
> > > rm -rf /a/obj/usr/src/*
> > > chflags -R 0 /a/obj/usr/src
> > > rm -rf /a/obj/usr/src/*
> > > pointyhat# make buildworld
> > > 
> > $ hostname
> > pointyhat.freebsd.org
> > $ grep MAKEOBJDIRPREFIX /etc/make.conf
> > MAKEOBJDIRPREFIX=/a/obj/
> > $ grep -A5 '^# MAKEOBJDIRPREFIX' /usr/share/mk/bsd.obj.mk
> > # MAKEOBJDIRPREFIX  Specifies somewhere other than /usr/obj to root the object
> > #               tree.  Note: MAKEOBJDIRPREFIX is an *environment* variable
> > #               and works properly only if set as an environment variable,
> > #               not as a global or command line variable!
> > #
> > #               E.g. use `env MAKEOBJDIRPREFIX=/somewhere/obj make'
> > 
> > Pointy hat to: kris
> 
> Well, happy POLA violation to you too; this worked until now.  Please
> add text to make.conf explaining the new order.
> 
Can you prove that it worked?  I tried to no avail with the old
(August 1 2004, before the changes) make(1) and MAKEOBJDIRPREFIX
set in /etc/make.conf, to try to buildworld, and it always fails.
Do you have a log of a successful buildworld saved somewhere?

It fails for me because MAKEOBJDIRPREFIX from /etc/make.conf (a
global variable) overrides the value of the MAKEOBJDIRPREFIX
environment variable, as documented in make(1), so what's passed
to the "legacy" target in Makefile.inc1 by "buildworld" is happily
ignored.

Here, MAKEOBJDIRPREFIX is set to /home/ru/obj in /etc/make.conf:

: --------------------------------------------------------------
: >>> Rebuilding the temporary build tree
: --------------------------------------------------------------
: rm -rf /home/ru/obj/usr/src5/i386
[...]
: mkdir -p /home/ru/obj/usr/src5/i386/legacy/usr/bin
: mkdir -p /home/ru/obj/usr/src5/i386/legacy/usr/games
: mkdir -p /home/ru/obj/usr/src5/i386/legacy/usr/include/c++/3.3
: mkdir -p /home/ru/obj/usr/src5/i386/legacy/usr/include/sys
: mkdir -p /home/ru/obj/usr/src5/i386/legacy/usr/lib
[...]
: --------------------------------------------------------------
: >>> stage 1.1: legacy release compatibility shims
: --------------------------------------------------------------
: cd /usr/src5; MAKEOBJDIRPREFIX=/home/ru/obj/usr/src5/i386  DESTDIR=  INSTALL="sh /usr/src5/tools/install.sh"  PATH=/home/ru/obj/usr/src5/i386/legacy/usr/sbin:/home/ru/obj/usr/src5/i386/legacy/usr/bin:/home/ru/obj/usr/src5/i386/legacy/usr/games:/sbin:/bin:/usr/sbin:/usr/bin  WORLDTMP=/home/ru/obj/usr/src5/i386  MAKEFLAGS="-m /usr/src5/tools/build/mk  -m /usr/src5/share/mk" /tmp/make/make -f Makefile.inc1  BOOTSTRAPPING=491100  -DNOHTML -DNOINFO -DNOLINT -DNOMAN -DNOPIC -DNOPROFILE  -DNOSHARED -DNO_CPU_CFLAGS -DNO_WARNS legacy
> 
So far so good (though the make's idea of the .OBJDIR would not
match the Makefile.inc1's perspective, should the canonical
/usr/obj exist, but this is harmless at this stage).

Now, buildworld tries to call the "legacy" subtarget with
MAKEOBJDIRPREFIX set in *environment* to the value of
WORLDTMP=${MAKEOBJDIRPREFIX}/usr/src5/i386.

The "legacy" target will then attempts to install headers and
other staff to DESTDIR=${MAKEOBJDIRPREFIX}/legacy:

legacy:
.for _tool in tools/build
        ${_+_}_at_${ECHODIR} "===> ${_tool}"; \
            cd ${.CURDIR}/${_tool}; \
            ${MAKE} DIRPRFX=${_tool}/ obj; \
            ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy includes; \
                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
            ${MAKE} DIRPRFX=${_tool}/ depend; \
            ${MAKE} DIRPRFX=${_tool}/ all; \
            ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX}/legacy install
                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.endfor

If it was /home/ru/obj/usr/src5/i386/legacy/*, created above, if would have worked.
But MAKEOBJDIRPREFIX from /etc/make.conf messes things up, so it attempts to install
to non-existing /home/ru/obj/legacy, and fails:

: ===> tools/build
: /home/ru/obj/usr/src5/tools/build created for /usr/src5/tools/build
: cd /usr/src5/tools/build; /tmp/make/make buildincludes; /tmp/make/make installincludes
: sh /usr/src5/tools/install.sh -C -o root -g wheel -m 444  /usr/src5/tools/build/../../include/getopt.h regex.h /home/ru/obj/legacy/usr/include
                                                                                                                 ^^^^^^^^^^^^^^^^^^^
: usage: install [-bCcpSsv] [-B suffix] [-f flags] [-g group] [-m mode]
:                [-o owner] file1 file2
:        install [-bCcpSsv] [-B suffix] [-f flags] [-g group] [-m mode]
:                [-o owner] file1 ... fileN directory
:        install -d [-v] [-g group] [-m mode] [-o owner] directory ...
: *** Error code 64
: 
: Stop in /usr/src5/tools/build.

Trying to set MAKEOBJDIRPREFIX in /etc/make.conf and attempting to buildworld
RELENG_4 on a 4.x machine similarly fails right away.

The reason I'm writing this email is that I'm really interested in
reproducing the case where it could have possible worked before.  Any help
on your side would be highly appreciated.

The only case that I know of this could have worked (tested) is if make(1)
was instructed to prefer the MAKEOBJDIRPREFIX environment variable over a
global one, with ``make -E MAKEOBJDIRPREFIX''.  Then setting MAKEOBJDIRPREFIX
in /etc/make.conf works.


Cheers,
-- 
Ruslan Ermilov
ru_at_FreeBSD.org
FreeBSD committer

Received on Wed Aug 11 2004 - 06:07:03 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:05 UTC