I had seen complaints but was unable to reproduce the problem myself.
Nathanael Rensen sent me an email out of the blue with both the likely
culprit as well as a patch to fix.   A few days after receiving this
patch, another person emailed me to ask if I knew why the parallel make
failed.  I forwarded the patch and it was reported back that it worked.

I'd like more confirmation that this solves the problem, so if you can
reproduce it reliably, please test it and let me know.

The patch seems reasonable to me although I am still unable to reproduce
the failure, but was able to successfully build a release with this patch.

OKs? Comments?

----- Forwarded message from Nathanael Rensen <nathanael at 
list.polymorpheus.com> -----

The following old commit to ExtUtils::MakeMaker introduced some odd changes:

https://github.com/Perl-Toolchain-Gang/ExtUtils-MakeMaker/commit/1364164942c0c55b83e3d48869c7a98c39ecd123#diff-6559230980be6af042ac3e6236167ba8

+       $(NOECHO) $(RM_RF) $(BOOTSTRAP)
+       - $(TEST_S) $(BOOTSTRAP) && $(CP) $(BOOTSTRAP) $(INST_BOOT) && \
+       $(CHMOD) $(PERM_RW) $(INST_BOOT)

Why remove $(BOOTSTRAP) and then try to copy it. Is that supposed to be:

+       $(NOECHO) $(RM_RF) $(INST_BOOT)

Also, why does that commit remove the $(INST_DYNAMIC) dependence on
$(BOOTSTRAP)?

-$(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP) 
$(INST_ARCHAUTODIR)$(DFSEP).exists $(EXPORT_LIST) $(PERL_ARCHIVE) 
$(PERL_ARCHIVE_AFTER) $(INST_DYNAMIC_DEP)
+$(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(INST_ARCHAUTODIR)$(DFSEP).exists 
$(EXPORT_LIST) $(PERL_ARCHIVE) $(PERL_ARCHIVE_AFTER) $(INST_DYNAMIC_DEP)

Using a parallel make (on OpenBSD) I find that this results in a race where
the $(BOOTSTRAP) rule is executed in parallel with the $(INST_DYNAMIC) rule
and the $(RM_RF) in the $(INST_DYNAMIC) rule can occur in between the
following commands during the $(BOOTSTRAP) rule:

$(NOECHO) $(TOUCH) %s
$(CHMOD) $(PERM_RW) %s

resulting in a build failure:

Running Mkbootstrap for Compress::Raw::Zlib ()
rm -f ../../lib/auto/Compress/Raw/Zlib/Zlib.so
cc  -shared -fPIC  -fstack-protector Zlib.o  adler32.o  compress.o  crc32.o  
deflate.o  infback.o  inffast.o  inflate.o  inftrees.o  trees.o  uncompr.o  
zutil.o -o ../../lib/auto/Compress/Raw/Zlib/Zlib.so
chmod 755 ../../lib/auto/Compress/Raw/Zlib/Zlib.so
chmod 644 Zlib.bs
/work/OpenBSD/obj/gnu/usr.bin/perl/cpan/Compress-Raw-Zlib/../../miniperl 
"-I../../lib" "-I../../lib" -MExtUtils::Command::MM -e 'cp_nonempty' -- Zlib.bs 
../../lib/auto/Compress/Raw/Zlib/Zlib.bs 644
chmod: Zlib.bs: No such file or directory
*** Error 1 in /work/OpenBSD/obj/gnu/usr.bin/perl/cpan/Compress-Raw-Zlib 
(Makefile:482 'Zlib.bs')
*** Error 1 in target 'Zlib.bs'
Unsuccessful make(cpan/Compress-Raw-Zlib): code=512 at make_ext.pl line 561.


Here's a diff with those two changes applied to current if you agree that it
is the right way forward:

----- End forwarded message -----

I snipped his patch and substituted the one I actually tested.
(which wasn't any different, just applied manually)

Index: gnu/usr.bin/perl/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm
===================================================================
RCS file: 
/cvs/src/gnu/usr.bin/perl/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm,v
retrieving revision 1.5
diff -u -p -u -r1.5 MM_Unix.pm
--- gnu/usr.bin/perl/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm    17 Nov 
2014 20:57:00 -0000      1.5
+++ gnu/usr.bin/perl/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm    1 Jan 
2015 18:06:10 -0000
@@ -911,7 +911,7 @@ OTHERLDFLAGS = '.$ld_opt.$otherldflags.'
 INST_DYNAMIC_DEP = '.$inst_dynamic_dep.'
 INST_DYNAMIC_FIX = '.$ld_fix.'
 
-$(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(INST_ARCHAUTODIR)$(DFSEP).exists 
$(EXPORT_LIST) $(PERL_ARCHIVE) $(PERL_ARCHIVE_AFTER) $(INST_DYNAMIC_DEP)
+$(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP) 
$(INST_ARCHAUTODIR)$(DFSEP).exists $(EXPORT_LIST) $(PERL_ARCHIVE) 
$(PERL_ARCHIVE_AFTER) $(INST_DYNAMIC_DEP)
 ');
     if ($armaybe ne ':'){
        $ldfrom = 'tmp$(LIB_EXT)';
@@ -963,7 +963,7 @@ MAKE
 
     push @m, <<'MAKE';
        $(CHMOD) $(PERM_RWX) $@
-       $(NOECHO) $(RM_RF) $(BOOTSTRAP)
+       $(NOECHO) $(RM_RF) $(INST_BOOT)
        - $(CP_NONEMPTY) $(BOOTSTRAP) $(INST_BOOT) $(PERM_RW)
 MAKE
 

Reply via email to