On Wed, 30 Dec 2009, Andy Dougherty wrote:

> On Wed, 30 Dec 2009, Will Coleda wrote:
> 
> 
> > I've created a branch (one_make) to start cleaning up the makefile.
> > I've just now eliminated the compiler.dummy target there, and moved
> > several generated independent makefiles into include'd ones.
> > 

> There seem to be some missing dependencies somewhere:  A parallel build 
> with OpenSolaris distributed make (dmake) gave this error:
> 
> perl tools/build/ops2c.pl CGP --core
> Parrot/OpLib/core.pm did not return a true value at 
> /export/home/doughera/src/parrot/parrot-svn/tools/build/../../lib/Parrot/Ops2c/Utils.pm
>  line 7.
> BEGIN failed--compilation aborted at 
> /export/home/doughera/src/parrot/parrot-svn/tools/build/../../lib/Parrot/Ops2c/Utils.pm
>  line 7.
> Compilation failed in require at tools/build/ops2c.pl line 11.
> BEGIN failed--compilation aborted at tools/build/ops2c.pl line 11.
> *** Error code 255
> dmake: Fatal error: Command failed for target `src/ops/core_ops_cgp.c'

It's a race condition.  It's present in trunk too.  The problem is the 
makefile rule: 

    $(INC_DIR)/oplib/ops.h lib/Parrot/OpLib/core.pm : [etc.]
        $(PERL) $(BUILD_TOOLS_DIR)/ops2pm.pl @no_lines_flag@ $(OPS_FILES)

The single tool, ops2pm.pl, generates two files, ops.h and core.pm.
However, make doesn't know that.  It sees two separate targets and can
consider running ops2pm.pl for each.  Accordingly, ops2pm.pl can get
run twice by a parallel make.  Normally, that's not a problem unless
both instances happen to be running at the same time.  In that case,
the output files can get messed up.  That's what happened to me above.

Here's a simple fix.  It does have one minor problem:  If the user
ignores the instructions at the top of core.pm and edits it anyway,
then the Makefile will not rebuild ops.h, even if it should.

diff -r -u one_make/config/gen/makefiles/root.in 
andy/config/gen/makefiles/root.in
--- one_make/config/gen/makefiles/root.in       2010-01-04 09:38:11.578364739 
-0500
+++ parrot-andy/config/gen/makefiles/root.in    2010-01-04 08:21:34.000000000 
-0500
@@ -1016,7 +1016,10 @@
 #
 ###############################################################################
 
-$(INC_DIR)/oplib/ops.h lib/Parrot/OpLib/core.pm : $(OPS_FILES) 
$(BUILD_TOOLS_DIR)/ops2pm.pl \
+# ops.h is built by ops2pm.pl after it builds core.pm
+$(INC_DIR)/oplib/ops.h:  lib/Parrot/OpLib/core.pm 
+
+lib/Parrot/OpLib/core.pm : $(OPS_FILES) $(BUILD_TOOLS_DIR)/ops2pm.pl \
     lib/Parrot/OpsFile.pm lib/Parrot/Op.pm src/ops/ops.num src/ops/ops.skip
        $(PERL) $(BUILD_TOOLS_DIR)/ops2pm.pl @no_lines_flag@ $(OPS_FILES)
 

-- 
    Andy Dougherty              [email protected]
_______________________________________________
http://lists.parrot.org/mailman/listinfo/parrot-dev

Reply via email to