On Mon, Dec 26, 2005 at 05:19:15PM +0000, Nicholas Clark wrote:
> A parallel make of the disttest target fails with MakeMaker.
> 
> For my empty distribution created with h2xs -n Moo
> 
> $ make -j2  disttest
> rm -rf Moo-0.01
> /home/nicholas/Sandpit/snap5.9.x-26488/bin/perl5.9.3 
> "-MExtUtils::Manifest=manicopy,maniread"  -e "manicopy(maniread(),'Moo-0.01', 
> 'best');"
> mkdir Moo-0.01
> mkdir Moo-0.01/lib
> mkdir Moo-0.01/t
> mkdir Moo-0.01/fallback
> Generating META.yml
> cd Moo-0.01 && /home/nicholas/Sandpit/snap5.9.x-26488/bin/perl5.9.3 
> Makefile.PL
> Checking if your kit is complete...
> Looks good
> Writing Makefile for Moo
> cd Moo-0.01 && make LIBPERL_A="libperl.a" LINKTYPE="dynamic" OPTIMIZE="-Os" 
> PREFIX="/home/nicholas/Sandpit/snap5.9.x-26488" PASTHRU_DEFINE="" 
> PASTHRU_INC=""
> cd: can't cd to Moo-0.01
> cd Moo-0.01 && make test LIBPERL_A="libperl.a" LINKTYPE="dynamic" 
> OPTIMIZE="-Os" PREFIX="/home/nicholas/Sandpit/snap5.9.x-26488" 
> PASTHRU_DEFINE="" PASTHRU_INC=""
> cd: can't cd to Moo-0.01
> *** Error code 2
> 1 error
> 
> 
> (make disttest passes if I don't use -j)
> 
> The disttest target is:
> 
> disttest : distdir
>         cd $(DISTVNAME) && $(ABSPERLRUN) Makefile.PL 
>         cd $(DISTVNAME) && $(MAKE) $(PASTHRU)
>         cd $(DISTVNAME) && $(MAKE) test $(PASTHRU)
> 
> If I change those last two by adding 'pwd &&' at the start, I see:
> 
> pwd && cd Moo-0.01 && make LIBPERL_A="libperl.a" LINKTYPE="dynamic" 
> OPTIMIZE="-Os" PREFIX="/home/nicholas/Sandpit/snap5.9.x-26488" 
> PASTHRU_DEFINE="" PASTHRU_INC=""
> /home/nicholas/Perl/Moo/Moo-0.01
> cd: can't cd to Moo-0.01
> pwd && cd Moo-0.01 && make test LIBPERL_A="libperl.a" LINKTYPE="dynamic" 
> OPTIMIZE="-Os" PREFIX="/home/nicholas/Sandpit/snap5.9.x-26488" 
> PASTHRU_DEFINE="" PASTHRU_INC=""
> /home/nicholas/Perl/Moo/Moo-0.01
> cd: can't cd to Moo-0.01
> 
> 
> Which explains why it's failing, but not why a parallel make does this, nor
> how to tweak things to stop it.
> 

This problems seems to be related solely to BSD-based makes and not GNU make.
On my OpenBSD system, "make -j2 disttest" fails with the default make, but
works fine with a GNU make.  

>From my quick and dirty test, it appears that the cd's in a GNU make are in
effect for the current command, but you are implicitly returned to your
start directory after the completed command.  BSD doesn't return you back to
your starting directory.  Looking at the OpenBSD make(1) manpage, I got a 
hint to the fix.

     -j max_jobs
             Specify the maximum number of jobs that make may have running at
             any one time.  Turns compatibility mode off, unless the -B flag
             is also specified.

So, after running "make -j2 -B disttest" everything compiled just fine.  Check
the FreeBSD make manpage to see if there is a similar "-B" flag.  That 
might be the fix you're looking for.

Steve Peters
[EMAIL PROTECTED]

Reply via email to