Bug 5074

Summary: Missing foo.h: bar.java dependencies in build system
Product: frysk Reporter: Petr Machata <pmachata>
Component: generalAssignee: Andrew Cagney <cagney>
Severity: normal    
Priority: P2    
Version: unspecified   
Target Milestone: ---   
Host: x86_64-unknown-linux-gnu Target: x86_64-unknown-linux-gnu
Build: x86_64-unknown-linux-gnu Last reconfirmed:
Bug Depends on:    
Bug Blocks: 2235    
Attachments: Log file demonstrating the problem.

Description Petr Machata 2007-09-27 23:23:52 UTC
Every once in a while, on a multi-cpu machine, with high -j values, frysk build
mysteriously dies with this synopsis:

<obnoxious gcj command, entwined in shellouts, checks and scripts>
../../frysk-sys/lib/dwfl/DwarfDieFactory.java:76: error: Type ‘DwTag’ not found
in the declaration of the local variable ‘tagEncodings’.
        DwTag[] tagEncodings = DwTag.values();
../../frysk-sys/lib/dwfl/DwarfDieFactory.java:82: error: Type ‘DwTag’ not found
in the declaration of the local variable ‘tag’.
            DwTag tag = tagEncodings[i];
2 errors
make[1]: *** [lib/dwfl/Dwfl.h] Error 1
make[1]: *** Waiting for unfinished jobs....
chmod a-w lib/dwfl/DwTag.tmp
mv -f lib/dwfl/DwTag.tmp lib/dwfl/DwTag.java
make[1]: Leaving directory
make: *** [all-recursive] Error 1

The problem is that for building Dwfl.h, frysk build system first compiles
.class files, and then induces appropriate .h files from them by way of gcjh. 
This is expressed in .java.h implicit rule.  But to build .class files, compiler
needs DwTag.java and other files... and this dependency isn't stated in Makefile.
Comment 1 Petr Machata 2007-09-27 23:27:06 UTC
Created attachment 2024 [details]
Log file demonstrating the problem.
Comment 2 Mark Wielaard 2007-09-28 07:38:06 UTC
Is this on Fedora 7? Then it might be related/the same as bug #4742
Comment 3 Petr Machata 2007-09-28 10:08:20 UTC
RHEL 5, gcc-java-4.1.1-52.
This doesn't seem to be the case however.  Dependency file (Dwfl.Po in this
case) is present, and non-empty, but it only describes dependencies of Dwfl.o,
not Dwfl.h.
Comment 4 Andrew Cagney 2007-10-05 15:57:48 UTC
All the generated java files need to be created; before starting on the .h
files.  Some of the .h source (.java) files may be importing generated .java files.
Comment 5 Andrew Cagney 2007-11-14 22:16:09 UTC
Make generated .h files order-only dependent on generated .java files.

2007-11-14  Andrew Cagney  <cagney@redhat.com>

        * Makefile.rules (built-sources): New.
        ($(SCRIPT_BUILT)): New.
        ($(JAVAH_BUILT)): New.
        ($(ANTLR_BUILT)): New.
        * Makefile.gen.sh (SCRIPT_BUILT): New.
        (JAVAH_BUILT): New.