bugmake - Bugs: bug #19309, parallel make issue with archive...

 
 

bug #19309: parallel make issue with archive members

Submitter:  None
Submitted:  Mon 12 Mar 2007 02:08:59 AM UTC
   
 
Severity:  3 - Normal Item Group:  Bug
Status:  Not A Bug Privacy:  Public
Assigned to:  None Open/Closed:  Closed
Component Version:  3.81 Operating System:  POSIX-Based
Fixed Release:  None Triage Status:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Thu 22 Mar 2007 04:32:29 AM UTC, comment #3: 

Thanks for the explanation.  I guess it is a fluke that it works with -j1, but not with -j2.


Juan <ufnoise>
Thu 22 Mar 2007 01:49:01 AM UTC, comment #2: 

This is not a bug, and is not related to parallel make; you're using VPATH incorrectly.  Paul's Third Rule of Makefiles states that you should never use VPATH to find TARGETS.  VPATH is only usable to find SOURCES.

Read my discussion of VPATH here to learn why your example works the way it does:

http://make.paulandlesley.org/vpath.html

You're also violating Paul's Second Rule of Makefiles, in this rule:

  .cc.o :
$(CXX) $(CXX_FLAGS) $(INCLUDES) -c -o $(DEST)/$@ $<

ANY time you see a rule where it's constructing a target that is not EXACTLY "$@", you know the rule is incorrect.  Here you're building "$(DEST)/$@", not "$@", so your rule is incorrect.

If you rework your example to use VPATH, etc. properly and still see problems, please file a note with this bug and we can re-open it.

Paul D. Smith <psmith>
Group administrator
Thu 22 Mar 2007 12:06:24 AM UTC, comment #1: 

This is a message to see if anyone else has reproduced my issue.

Juan <ufnoise>
Mon 12 Mar 2007 02:08:59 AM UTC, original submission:  

Hello,

I am having issues with parallel make and archive members.  I have a rule which puts all the changed objects in the same archive.  However, it doesn't work with the parallel "make -j2" option.

1. Copy this Makefile into a directory and create some files.
mkdir makeprob
cd makeprob
touch foo1.cc
touch foo2.cc
touch foo3.cc
touch foo4.cc

2. Create destination directory:
mkdir /tmp/dest

3. Do a make -j2 and it works fine:

> make -j2

g++   -c -o /tmp/dest/foo1.o foo1.cc
g++   -c -o /tmp/dest/foo2.o foo2.cc
g++   -c -o /tmp/dest/foo3.o foo3.cc
g++   -c -o /tmp/dest/foo4.o foo4.cc
cd /tmp/dest; \
        ar rv libfoo.a foo1.o foo2.o foo3.o foo4.o;
ar: creating libfoo.a
a - foo1.o
a - foo2.o
a - foo3.o
a - foo4.o

4. touch all the .cc files and do another make -j2 and it does not load the archive work without doing a second make:

> touch *cc
> make -j2

g++   -c -o /tmp/dest/foo1.o foo1.cc
g++   -c -o /tmp/dest/foo2.o foo2.cc
g++   -c -o /tmp/dest/foo3.o foo3.cc
g++   -c -o /tmp/dest/foo4.o foo4.cc
cd /tmp/dest; \
        ar rv libfoo.a ;

> make -j2

cd /tmp/dest; \
        ar rv libfoo.a /tmp/dest/foo1.o /tmp/dest/foo2.o /tmp/dest/foo3.o /tmp/dest/foo4.o;
r - /tmp/dest/foo1.o
r - /tmp/dest/foo2.o
r - /tmp/dest/foo3.o
r - /tmp/dest/foo4.o

5. Do the same procedure with single threaded make and it works fine:

> touch *.cc
> make

g++   -c -o /tmp/dest/foo1.o foo1.cc
g++   -c -o /tmp/dest/foo2.o foo2.cc
g++   -c -o /tmp/dest/foo3.o foo3.cc
g++   -c -o /tmp/dest/foo4.o foo4.cc
cd /tmp/dest; \
        ar rv libfoo.a foo1.o foo2.o foo3.o foo4.o;
r - foo1.o
r - foo2.o
r - foo3.o
r - foo4.o

It is my suspicion this has something to do with vpath and parallel make.  Please let me know if you are able to reproduce this.  This was not an issue before I started using VPATH and a destination directory outside of the source area.  My temporary fix is to change the $? in the archive rule to $(CXX_OBJS).  This is make 3.81 and I am able to reproduce it on both a 32 bit and a 64 bit gentoo system.

I tried the same tests at work and it seems that many of the most recent versions of Make exhibit this issue.

Thanks,
Juan

Anonymous

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #12181:  Makefile added by None (302B - application/octet-stream - Makefile exhibiting issue.)

 

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)
  • -email is unavailable- added by ufnoise (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 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2007-03-22 psmith StatusNone Not A Bug
        Open/ClosedOpen Closed
    2007-03-22 ufnoise Carbon-Copy- Added ufnoise
    2007-03-12 None Attached File- Added Makefile, #12181

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code