bugmake - Bugs: bug #3330, gmake -j2 does very different...

 
 

bug #3330: gmake -j2 does very different things to gmake -j1

Submitter:  Icarus Sparry <icarus>
Submitted:  Fri 25 Apr 2003 06:37:49 PM UTC
   
 
Severity:  3 - Normal Item Group:  Bug
Status:  Fixed Privacy:  Public
Assigned to:  psmith Open/Closed:  Closed
Component Version:  3.80 Operating System:  POSIX-Based
Fixed Release:  3.82 Triage Status:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Wed 15 Aug 2007 01:57:23 PM UTC, comment #4: 

OK, committed a fix for this (and bug #15919), plus test cases.  Thanks to Icarus for all his work on this.

Paul D. Smith <psmith>
Group administrator
Sun 12 Nov 2006 05:48:08 PM UTC, comment #3: 

see bug #15919 for a fix

Icarus Sparry <icarus>
Fri 30 May 2003 04:12:55 PM UTC, comment #2: 

Here is an even simpler Makefile which shows the problem. It is a stripped down version of the original I submitted, and makes little sense in terms of what it echos
-----------------------------------------
binary: binary.tmp
        @cp $^ $@ ; echo Install $@

.INTERMEDIATE: binary.tmp
binary.tmp:     lib
        @touch $@ ; echo Link new binary in temp place

lib:    obj
        @if [ ! -e $@ ] ; then touch $@ ; fi ; echo $@ is up to date

obj:
        @touch $@ ; echo Compile language file
-------------------------------------------------
run make once, to build 'binary' 'lib' and 'obj'. Then touch 'obj'. If you run 'make' again it echos "lib is up to date", but if you run "make -j2" it echos "lib is up to date", "Link new binary in temp place", "Install binary" and make itself prints "rm binary.tmp".

This problem appears to be related to the line "must_make=noexist;" around line 410 of remake.c. When an 'intermediate' file does not exist, but the rules for it's dependencies are still being run, it is too early to decide that the file must be created. If the rules end up not updating the dependencies, then you do not need to create a missing 'intermediate'.

This case is never encountered in the '-j1' case, as all rules are run to completion before make considers the file, so it never has a file in the "dependencies are being run" (cs_deps_running) state.

Icarus Sparry <icarus>
Mon 05 May 2003 05:03:35 PM UTC, comment #1: 

This appears to be related to the '.INTERMEDIATE' statement. If this is removed, (so binary.tmp continues to exist after make has completed), then things work as I would expect.

Icarus Sparry <icarus>
Fri 25 Apr 2003 06:37:49 PM UTC, original submission:  

The enclosed makefile makes use of a number of Gmake facilities which should cut down on the amount built.
If one runs gmake, then it correctly builds and installs 'binary'. If you then touch 'language' and run gmake -j1 and gmake -j2 you get very different results
11:28:46 0 $ Gmake -r -j1
Run YACC and see if anything has changed
11:28:56 0 $ Gmake -r -j2
Run YACC and see if anything has changed
Link new binary
Install binary
rm binary.tmp

Am I misunderstanding something?

The objectives are
1) To preserve the existing binary if something goes wrong in the build.
2) To not rebuild the binary only because a shared library
implementation file (.c) changes. If an interface file changes (.h) that is a different matter.
3) Some files are automatically generated, if they are the same as previous ones then reuse previous object files.

Icarus Sparry <icarus>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #406:  Makefile added by icarus (572B - text/plain)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by psmith (Posted a comment)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2010-07-28 psmith Fixed Release4.0 3.82
    2007-08-15 psmith StatusNone Fixed
        Assigned toNone psmith
        Open/ClosedOpen Closed
        Fixed ReleaseNone 4.0
    2005-09-16 icarus Carbon-Copy- Added icarus

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code