From: Andrew Walrond Date: 2009-02-11T09:39:01+09:00 Subject: [ruby-core:21974] Re: ruby 1.9.1 parallel make race This is a multi-part message in MIME format. --------------080106060006030401070001 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Andrew Walrond wrote: > > And here is another failure which happened as I was typing: > > mkdir -p ../../.ext/common/ripper > cp ../.././ext/ripper/lib/ripper/core.rb ../../.ext/common/ripper > mkdir: cannot create directory `../../.ext/common/ripper': File exists > > I guess this will be easy enough to fix, if it hasn't been already. I > could get setup with the latest source repo and attempt a patch if it > would be useful; Let me know. > Well, not quite as easy as I thought because all the makefiles are generated by create_makefile in lib/mkmf.rb. But once I got my head around it, one small change to mkmf.rb fixes all the makefiles :) Here's a patch against 1.9.1-p0 (also attached): --- ruby-1.9.1-p0/lib/mkmf.rb 2009-01-28 09:23:46.000000000 +0000 +++ ruby-1.9.1-p0-apw/lib/mkmf.rb 2009-02-10 23:21:51.510922231 +0000 @@ -1703,7 +1703,7 @@ for f in files dest = "#{dir}/#{File.basename(f)}" mfile.print("install-rb#{sfx}: #{dest}\n") - mfile.print("#{dest}: #{f}\n") + mfile.print("#{dest}: #{f} #{dir}\n") mfile.print("\t$(#{$extout ? 'COPY' : 'INSTALL_DATA'}) ") mfile.print("#{fseprepl[f]} $(@D#{sep})\n") if defined?($installed_list) and !$extout (applies successfully against TRUNK also) Sanity check: Looking at the Makefile causing the failure above, a typical copy rule is: $(RUBYLIBDIR)/ripper/core.rb: $(srcdir)/lib/ripper/core.rb $(COPY) $(srcdir)/lib/ripper/core.rb $(@D) and the corresponding mkdir rule is: $(RUBYLIBDIR)/ripper/core.rb: $(srcdir)/lib/ripper/core.rb $(COPY) $(srcdir)/lib/ripper/core.rb $(@D) After my patch, the copy rule becomes: $(RUBYLIBDIR)/ripper/core.rb: $(srcdir)/lib/ripper/core.rb $(RUBYLIBDIR)/ripper $(COPY) $(srcdir)/lib/ripper/core.rb $(@D) and the race is avoided. I've done several make -j4 builds using the patch without failure so far, so it seems to work OK. Hope that's useful Andrew Walrond --------------080106060006030401070001 Content-Type: text/x-patch; name="parallel-make.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="parallel-make.patch" --- ruby-1.9.1-p0/lib/mkmf.rb 2009-01-28 09:23:46.000000000 +0000 +++ ruby-1.9.1-p0-apw/lib/mkmf.rb 2009-02-10 23:21:51.510922231 +0000 @@ -1703,7 +1703,7 @@ for f in files dest = "#{dir}/#{File.basename(f)}" mfile.print("install-rb#{sfx}: #{dest}\n") - mfile.print("#{dest}: #{f}\n") + mfile.print("#{dest}: #{f} #{dir}\n") mfile.print("\t$(#{$extout ? 'COPY' : 'INSTALL_DATA'}) ") mfile.print("#{fseprepl[f]} $(@D#{sep})\n") if defined?($installed_list) and !$extout --------------080106060006030401070001--