Bug 5183

Summary: broken build with -j>1
Product: frysk Reporter: Sami Wagiaalla <swagiaal>
Component: generalAssignee: Andrew Cagney <cagney>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: unspecified   
Target Milestone: ---   
Host: Target:
Build: Last reconfirmed:
Bug Depends on:    
Bug Blocks: 3620    

Description Sami Wagiaalla 2007-10-15 19:03:34 UTC
I get the following error:

Applying fixes ...
+ sed -f frysk/expr/antlr.tmp/CExprEvaluator.sed
frysk/expr/antlr.tmp/CExprEvaluator.gen
sed: file frysk/expr/antlr.tmp/CExprEvaluator.sed line 48: unterminated `s' command
make[1]: *** [frysk/expr/Completer.antlered] Error 1
make[1]: Leaving directory `/notnfs/swagiaal/frysks/frysk.patches/frysk-core'
make: *** [all-recursive] Error 1


If i type make it goes away, but make -j3 consistently fails
Comment 1 Petr Machata 2007-10-16 12:54:46 UTC
The problem seems to be with two .g.antlered implicit rules being run in
parallel, which step on each other's .antlr-fixes temporary files.  In this
particular case, this is caused by missing rule:
frysk/expr/CExprEvaluator.antlered: frysk/expr/Completer.antlered

Makefile rules are generated from importVocab directives in .g files by way of
Makefile.gen.sh, so frysk really tries to give make proper parallelization
hints.  So the real problem is with temporary file handling.

I believe what happens is that antlr-warnings.awk produces  e.g.
CExprEvaluator.antlr-fixes, when suddently the other make invocation removes it
via 'rm -f $$d/*.antlr-fixes'.  So the file being just built is removed, and
misses its beginning.  Later on, there's 'for fix in $$d/*.antlr-fixes', which
picks both files, the "healthy" one as well as the truncated one, and tries to
use them as a sed source.  For that reason both parallel make branches fail.
Comment 2 Andrew Cagney 2008-06-11 20:09:31 UTC
commit adb971cd44b8398b4f64cecb699ff2c3be8620aa
Author: Andrew Cagney <cagney@redhat.com>
Date:   Wed Nov 14 21:03:56 2007 -0500

    Run each antlr in a separate directory (fix a parallel make problem).
    
    frysk-common/ChangeLog
    2007-11-14  Andrew Cagney  <cagney@redhat.com>
    
        * Makefile.rules (.g.antlred): Rename .g.antlered; use a tmp
        directory named according to the target.
        (javah-built): Delete.
        (ANTLR): Define.
        * Makefile.gen.sh: Rename .antlered to .antlred.  Include
        *TokenTypes.txt in list of generated files.
    
    frysk-core/ChangeLog
    2007-11-14  Andrew Cagney  <cagney@redhat.com>
    
        * Makefile.am (ANTLR): Delete.