From olivleh1@kartoffel.salatschuessel.net  Sat May 25 03:53:48 2002
Return-Path: <olivleh1@kartoffel.salatschuessel.net>
Received: from kartoffel.salatschuessel.net (pD95207C7.dip.t-dialin.net [217.82.7.199])
	by hub.freebsd.org (Postfix) with ESMTP id 9F9B537B404
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 25 May 2002 03:53:45 -0700 (PDT)
Received: (from olivleh1@localhost)
	by kartoffel.salatschuessel.net (8.11.6/8.11.5) id g4PArfm50135;
	Sat, 25 May 2002 12:53:41 +0200 (CEST)
	(envelope-from olivleh1)
Message-Id: <200205251053.g4PArfm50135@kartoffel.salatschuessel.net>
Date: Sat, 25 May 2002 12:53:41 +0200 (CEST)
From: Oliver Lehmann <lehmann@ans-netz.de>
Reply-To: Oliver Lehmann <lehmann@ans-netz.de>
To: FreeBSD-gnats-submit@freebsd.org
Cc: Oliver Lehmann <lehmann@ans-netz.de>
Subject: make buildworld fails if you have an empty <MAKEOBJDIRPREFIX> directory
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         38538
>Category:       misc
>Synopsis:       make buildworld fails if you have an empty <MAKEOBJDIRPREFIX> directory
>Confidential:   no
>Severity:       non-critical
>Priority:       high
>Responsible:    ru
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat May 25 04:00:06 PDT 2002
>Closed-Date:    Sat May 25 05:15:09 PDT 2002
>Last-Modified:  Sat May 25 05:20:11 PDT 2002
>Originator:     Oliver Lehmann
>Release:        FreeBSD 4.5-STABLE i386
>Organization:
>Environment:
System: FreeBSD kartoffel.salatschuessel.net 4.5-STABLE FreeBSD 4.5-STABLE #0: Sun Feb 10 22:28:35 CET 2002 olivleh1@bert.sesamestreet.net:/usr/obj/i386/usr/src/sys/SINA i386


>Description:
        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.

>How-To-Repeat:
        just remove /usr/obj/* and run make buildworld in /usr/src

>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).


--- install.sh.orig	Wed Aug  8 09:42:21 2001
+++ install.sh	Sat May 25 11:52:48 2002
@@ -39,4 +39,14 @@
 done
 
 # the remaining arguments are assumed to be files/dirs only.
+if [ $# -gt 2 ] ; then
+	dir=$(echo $* | sed 's/.* //g')
+else
+	dir=$(echo $* | sed 's/.* \(.*\)\/.*/\1/g')
+fi
+
+if [ ! -d "$dir" ] ; then
+	mkdir -p $dir
+fi
+
 exec install -p $*
>Release-Note:
>Audit-Trail:

From: Ruslan Ermilov <ru@FreeBSD.ORG>
To: Oliver Lehmann <lehmann@ans-netz.de>
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: misc/38538: make buildworld fails if you have an empty <MAKEOBJDIRPREFIX> directory
Date: Sat, 25 May 2002 14:13:40 +0300

 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

From: Oliver Lehmann <lehmann@ans-netz.de>
To: Ruslan Ermilov <ru@FreeBSD.ORG>
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: misc/38538: make buildworld fails if you have an empty <MAKEOBJDIRPREFIX> directory
Date: Sat, 25 May 2002 13:19:53 +0200

 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)
State-Changed-From-To: open->closed 
State-Changed-By: ru 
State-Changed-When: Sat May 25 05:13:09 PDT 2002 
State-Changed-Why:  
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' 


Responsible-Changed-From-To: freebsd-bugs->ru 
Responsible-Changed-By: ru 
Responsible-Changed-When: Sat May 25 05:13:09 PDT 2002 
Responsible-Changed-Why:  

http://www.freebsd.org/cgi/query-pr.cgi?pr=38538 

From: Ruslan Ermilov <ru@FreeBSD.ORG>
To: Oliver Lehmann <lehmann@ans-netz.de>
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: misc/38538: make buildworld fails if you have an empty <MAKEOBJDIRPREFIX> directory
Date: Sat, 25 May 2002 15:12:43 +0300

 --PGNNI9BzQDUtgA2J
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 Content-Transfer-Encoding: quoted-printable
 
 On Sat, May 25, 2002 at 01:19:53PM +0200, Oliver Lehmann wrote:
 > Hi Ruslan,
 >=20
 > On Sat, 25 May 2002 14:13:40 +0300
 > Ruslan Ermilov <ru@FreeBSD.ORG> wrote:
 >=20
 > > I think you've screwed something on your side.  What does the following
 > > command tell you?
 > >=20
 > > cd /usr/src; make -f Makefile.inc1 -V WORLDTMP -V MAKEOBJDIRPREFIX
 > >=20
 > > It should show you something like this:
 > >=20
 > > /usr/obj/usr/src/i386
 > > /usr/obj
 > >=20
 > root@nudel src> cd /usr/src; make -f Makefile.inc1 -V WORLDTMP -V
 > MAKEOBJDIRPREFIX
 > /usr/obj/i386/usr/src/i386
 > /usr/obj/i386
 >=20
 > root@nudel src> cat /etc/make.conf=20
 > MAKEOBJDIRPREFIX=3D/usr/obj/i386
 > WRKDIRPREFIX=3D/usr/obj/i386
 >=20
 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,
 --=20
 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
 
 --PGNNI9BzQDUtgA2J
 Content-Type: application/pgp-signature
 Content-Disposition: inline
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.0.7 (FreeBSD)
 
 iD8DBQE873+7Ukv4P6juNwoRAhklAKCGWYbUOmqceLb/3A+6GzyAoIQW0ACdHbi/
 8UOgbx35X1et/xoR8PzolBs=
 =Fwml
 -----END PGP SIGNATURE-----
 
 --PGNNI9BzQDUtgA2J--
>Unformatted:
