Bug 38538

Summary: make buildworld fails if you have an empty <MAKEOBJDIRPREFIX> directory
Product: Base System Reporter: Oliver Lehmann <lehmann>
Component: miscAssignee: ru <ru>
Status: Closed FIXED    
Severity: Affects Only Me CC: lehmann
Priority: Normal    
Version: 4.5-STABLE   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description Oliver Lehmann 2002-05-25 12:00:06 UTC
        I just removed everything which lies under /usr/obj. Then i ran the
        following commands in /usr/src
make clean
make cleandepend
find ./ -name "*.o" |xargs rm
        (make world is creating object files under /usr/src. These fact prohibits
         using the same repository on another architecture.)
        Now i ran make buildworld und it stops at:

cc -O -pipe      -static -o yacc closure.o error.o lalr.o lr0.o main.o mkpar.o o
utput.o reader.o skeleton.o symtab.o verbose.o warshall.o
sh /usr/src/tools/install.sh -c -o root  -g wheel -m 555   yyfix.sh  /usr/obj/i3
86/usr/bin/yyfix
install: /usr/obj/i386/usr/bin/yyfix: No such file or directory
*** Error code 71

Stop in /usr/src/usr.bin/yacc.

        There are no directories created before install.sh is called. Thats why
        install is predicted to fail.

Fix: Fix the Makefiles

        i created a patch, but it does not work for all cases.

it works for:
 install sourcefile1 sourcefile2 sourcefilen directory
 install sourcefile directory/
 install sourcefile targetfile

but it dows not work for e.g.:
 sh /usr/src/tools/install.sh -c -s -o root -g wheel -m 555   size /usr/obj/i386/usr/libexec/elf

because, install.sh take the "targt-directory" (/usr/obj/i386/usr/libexec/elf)
as a "target file" (there is no / at the end of the directory).

How-To-Repeat:         just remove /usr/obj/* and run make buildworld in /usr/src
Comment 1 ru freebsd_committer 2002-05-25 12:13:40 UTC
On Sat, May 25, 2002 at 12:53:41PM +0200, Oliver Lehmann wrote:
> 
>         I just removed everything which lies under /usr/obj. Then i ran the
>         following commands in /usr/src
> make clean
> make cleandepend
> find ./ -name "*.o" |xargs rm
>         (make world is creating object files under /usr/src. These fact prohibits
>          using the same repository on another architecture.)
>         Now i ran make buildworld und it stops at:
> 
> cc -O -pipe      -static -o yacc closure.o error.o lalr.o lr0.o main.o mkpar.o o
> utput.o reader.o skeleton.o symtab.o verbose.o warshall.o
> sh /usr/src/tools/install.sh -c -o root  -g wheel -m 555   yyfix.sh  /usr/obj/i3
> 86/usr/bin/yyfix
> install: /usr/obj/i386/usr/bin/yyfix: No such file or directory
> *** Error code 71
> 
> Stop in /usr/src/usr.bin/yacc.
> 
>         There are no directories created before install.sh is called. Thats why
>         install is predicted to fail.
> 
I think you've screwed something on your side.  What does the following command
tell you?

cd /usr/src; make -f Makefile.inc1 -V WORLDTMP -V MAKEOBJDIRPREFIX

It should show you something like this:

/usr/obj/usr/src/i386
/usr/obj


Cheers,
-- 
Ruslan Ermilov		Sysadmin and DBA,
ru@sunbay.com		Sunbay Software AG,
ru@FreeBSD.org		FreeBSD committer,
+380.652.512.251	Simferopol, Ukraine

http://www.FreeBSD.org	The Power To Serve
http://www.oracle.com	Enabling The Information Age
Comment 2 Oliver Lehmann 2002-05-25 12:19:53 UTC
Hi Ruslan,

On Sat, 25 May 2002 14:13:40 +0300
Ruslan Ermilov <ru@FreeBSD.ORG> wrote:

> I think you've screwed something on your side.  What does the following
> command tell you?
> 
> cd /usr/src; make -f Makefile.inc1 -V WORLDTMP -V MAKEOBJDIRPREFIX
> 
> It should show you something like this:
> 
> /usr/obj/usr/src/i386
> /usr/obj
> 
root@nudel src> cd /usr/src; make -f Makefile.inc1 -V WORLDTMP -V
MAKEOBJDIRPREFIX
/usr/obj/i386/usr/src/i386
/usr/obj/i386

root@nudel src> cat /etc/make.conf 
MAKEOBJDIRPREFIX=/usr/obj/i386
WRKDIRPREFIX=/usr/obj/i386

  Greetings, Oliver

-- 
:======>   Oliver Lehmann   <======:     clear perl code  is better than
:====>  lehmann@ans-netz.de   <====:      unclear awk code; but NOTHING
:===>   http://www.pofo.de/    <===:    comes close to  unclear perl code
:=>   http://wishlist.pofo.de/   <=:     (taken from  comp.lang.awk FAQ)
Comment 3 ru freebsd_committer 2002-05-25 13:12:43 UTC
On Sat, May 25, 2002 at 01:19:53PM +0200, Oliver Lehmann wrote:
> Hi Ruslan,
> 
> On Sat, 25 May 2002 14:13:40 +0300
> Ruslan Ermilov <ru@FreeBSD.ORG> wrote:
> 
> > I think you've screwed something on your side.  What does the following
> > command tell you?
> > 
> > cd /usr/src; make -f Makefile.inc1 -V WORLDTMP -V MAKEOBJDIRPREFIX
> > 
> > It should show you something like this:
> > 
> > /usr/obj/usr/src/i386
> > /usr/obj
> > 
> root@nudel src> cd /usr/src; make -f Makefile.inc1 -V WORLDTMP -V
> MAKEOBJDIRPREFIX
> /usr/obj/i386/usr/src/i386
> /usr/obj/i386
> 
> root@nudel src> cat /etc/make.conf 
> MAKEOBJDIRPREFIX=/usr/obj/i386
> WRKDIRPREFIX=/usr/obj/i386
> 

Doh, we badly need to put this into a FAQ:

MAKEOBJDIRPREFIX is an environment variable, and only works right
if set as an environment variable.  It's documented in make(1) as
an environment variable, it's not listed in make.conf(5), and it's
warned about in bsd.obj.mk.

I have a patch that allows for MAKEOBJDIR[PREFIX] to be used as a
command line variable, but still no joy for setting it in /etc/make.conf.

The reasoning behind this is that make(1) uses these variables
internally, to chdir(2) into the object directory, and this happens
before it has a chance to even read /etc/make.conf.

I will close this PR.


Cheers,
-- 
Ruslan Ermilov		Sysadmin and DBA,
ru@sunbay.com		Sunbay Software AG,
ru@FreeBSD.org		FreeBSD committer,
+380.652.512.251	Simferopol, Ukraine

http://www.FreeBSD.org	The Power To Serve
http://www.oracle.com	Enabling The Information Age
Comment 4 ru freebsd_committer 2002-05-25 13:13:09 UTC
State Changed
From-To: open->closed

MAKEOBJDIRPREFIX  Specifies somewhere other than /usr/obj to root the object 
tree.  Note: MAKEOBJDIRPREFIX is an *enviroment* variable 
and works properly only if set as an enviroment variable, 
not as a global or command line variable! 

E.g. use `env MAKEOBJDIRPREFIX=/somewhere/obj make' 


Comment 5 ru freebsd_committer 2002-05-25 13:13:09 UTC
Responsible Changed
From-To: freebsd-bugs->ru