Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 10 Mar 2002 21:12:37 +0100 (CET)
From:      BOUWSMA Beery <freebsd-user@netscum.dyndns.dk>
To:        Ruslan Ermilov <ru@freebsd.org>
Cc:        freebsd-stable@freebsd.org
Subject:   Re: buildworld with ro /usr/src broken
Message-ID:  <200203102012.g2AKCbZ00762@beerswilling.netscum.dyndns.dk>
References:  <20020209130437.GA15287@myhakas.estpak.ee> <200202091743.g19HhIm00362@beerswilling.netscum.dyndns.dk> <20020227111914.GB30220@sunbay.com> <20020227155244.A24137@newtrinity.default-network.net> <20020227204012.GA99496@sunbay.com>

next in thread | previous in thread | raw e-mail | index | archive | help
[replies sent directly to me may timeout and bounce, since I'm not
 online as often as I should be, but I'll check the list archives]


> > > MAKEOBJDIR[PREFIX] only work right if set as environment variables.

> > > I have an uncommitted patch that makes it possible to set them on
> > > make(1)'s command line but still no joy in attempting to set them
> > > in /etc/make.conf.  I bear in mind adding a patch to Makefile.inc1
> > > too that would prevent people from attempting to set MAKEOBJDIRPREFIX
> > > in /etc/make.conf.

Bah.  You're no fun.

Hmmm, so why then am I now buildworld'ing -current (and have been for
the past almost five hours) with a read-only /usr/src
# touch /usr/src/foo
touch: /usr/src/foo: Read-only file system
using only the commandline `time nice make buildworld' with the
object tree being put in
bash-2.05a$ ls -lart /usr/obj/5.0-CURRENT/usr/src/
total 42
drwxr-xr-x    3 root  wheel   512 Jan 11 06:58 ..
drwxr-xr-x    4 root  wheel   512 Jan 25 15:33 gnu
drwxr-xr-x    6 root  wheel   512 Jan 25 15:34 secure
drwxr-xr-x    5 root  wheel   512 Jan 25 18:38 sys
drwxr-xr-x    3 root  wheel   512 Mar  6 13:28 i386
drwxr-xr-x   55 root  wheel  1024 Mar  6 14:06 lib
drwxr-xr-x   35 root  wheel   512 Mar  6 14:06 bin
drwxr-xr-x   41 root  wheel  1024 Mar  6 14:07 games
drwxr-xr-x   32 root  wheel  1024 Mar  6 14:09 libexec
drwxr-xr-x   86 root  wheel  2048 Mar  6 14:10 sbin
drwxr-xr-x   16 root  wheel   512 Mar  6 14:11 share
drwxr-xr-x  207 root  wheel  6656 Mar  6 14:14 usr.bin
drwxr-xr-x  158 root  wheel  5632 Mar  6 14:16 usr.sbin
drwxr-xr-x    3 root  wheel   512 Mar  6 14:16 etc
drwxr-xr-x   16 root  wheel   512 Mar  6 14:16 .
drwxr-xr-x    4 root  wheel   512 Mar  6 15:34 include

And I've been building both -stable and -current this way
in subdirectories of /usr/obj for months, with read-only src,
since figuring how to force it to work?


> > I don't want to doubt your expertise but
> > `cd /usr/src && make MAKEOBJDIRPREFIX=/tmp/obj buildworld`
> > works for ages for me, same for installworld.

(This is no doubt because /usr/src is read-write for this
particular user and receives the changes that break buildworld
in the read-only case)



> Run the following commands in sequence to see what I'm talking about:

> rm -rf /tmp/obj
> cd /usr/src/bin/cat
> make MAKEOBJDIRPREFIX=/tmp/obj obj
> make MAKEOBJDIRPREFIX=/tmp/obj all

Okay, here's what I see, /usr/src read-only.

bash-2.05a$ make MAKEOBJDIRPREFIX=/tmp/obj obj
/tmp/obj/usr/src/bin/cat created for /usr/src/bin/cat
bash-2.05a$ make MAKEOBJDIRPREFIX=/tmp/obj all
cc -O -pipe  -Wall -Wformat   -Werror -Wall -Wno-uninitialized -Wnon-const-forma
t -Wno-format-extra-args -Werror  -c cat.c
Assembler messages:
FATAL: can't create cat.o: Permission denied


> ls -l /tmp/usr/usr/src/bin/cat
(s,usr,obj, of course)
As expected, with my read-only source (and working as a normal luser
too), the attempt fails.


> Try setting MAKEOBJDIRPREFIX in environment then.

Here's what I have that's of interest in my /etc/make.conf, for
both -current and -stable (NetBSD allows me to define BSDOBJDIR to
get somewhat similar results)...

RELNAME!=       /usr/bin/uname -r
MAKEOBJDIRPREFIX?=      /usr/obj/${RELNAME}

You're right, though, that not all targets will work with this.
Here's what I get with the `all' target:

[17:13:36]root@dastardly.newsbastards.org:/usr/src/bin/cat{506}# rmdir !$
rmdir /usr/obj/5.0-CURRENT/usr/src/bin/cat/
[17:13:55]root@dastardly.newsbastards.org:/usr/src/bin/cat{507}# make obj
/usr/obj/5.0-CURRENT/usr/src/bin/cat created for /usr/src/bin/cat

[17:27:08]root@dastardly.newsbastards.org:/usr/src/bin/cat{545}# make all
cc -O -pipe  -Wall -Wformat   -Werror -Wall -Wno-uninitialized -Wnon-const-forma
t -Wno-format-extra-args -Werror  -c cat.c
Assembler messages:
FATAL: can't create cat.o: Read-only file system
cat.c:312: output pipe has been closed
*** Error code 1

Stop in /usr/src/bin/cat.


I played around a bit with the -f and -m `make' options to see if I
could get this working based on my /etc/make.conf contents, but no
real joy was to be found.  In a case like this, or, say, when I had
to rebuild one of the kernel modules with a patch, I needed to use
the `env ...' form of the command.


However, as part of a `buildworld' or `buildkernel' or `installworld'
run, I do get things put in the proper place, rather than building
them in /usr/src proper; later once the build has gotten around to
this directory:

[01:37:51]root@dastardly.newsbastards.org:/usr/src/bin/cat{557}# ls -lart /usr/
obj/5.0-CURRENT/usr/src/bin/cat/
total 98
drwxr-xr-x  35 root  wheel    512 Mar  6 17:13 ..
-rw-r--r--   1 root  wheel   1990 Mar  6 21:05 .depend
-rw-r--r--   1 root  wheel   5452 Mar  6 22:29 cat.o
-rwxr-xr-x   1 root  wheel  82283 Mar  6 22:29 cat
drwxr-xr-x   2 root  wheel    512 Mar  6 22:29 .
-rw-r--r--   1 root  wheel   2428 Mar  6 22:29 cat.1.gz

So I'll agree that the /etc/make.conf solution isn't perfect and
breaks with some things less than a full world, but so far it's
performed adequately, the read-only status of /usr/src being a
safety net that I'll probably be losing now that I've gotten a
union mount atop it to work with `make', containing my local hacks.


I don't know if it would be of interest, but as I noted, the
NetBSD build process appears to make use of a `BSDOBJDIR' variable
that one can set in their mk.conf file, which as far as I can see
gets massaged into a number of other variables that are used,
though I haven't traced differences between their MAKEOBJDIRPREFIX
and that here.

However, I haven't checked whether that is affected when one uses
less than the `build' target for the world as with FreeBSD.  And,
since part of their `build' process is to create obj links within
the /usr/src tree, I really can't mount it read-only to see clear
failures, so it may well be that BSDOBJDIR only is used for the
creation of these obj links, making it less useful as a model for
FreeBSD.  See, I'm talking about things I know nothing about again.


thanks
barry bouwsma


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200203102012.g2AKCbZ00762>