[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Problem with parallel build
From: |
Vardhan, Sundara (GE Energy) |
Subject: |
RE: Problem with parallel build |
Date: |
Thu, 21 Oct 2010 13:33:44 -0400 |
Hi Michael
During parallel makes if the time of the object files created and the
time archive command is run is within a second then it will fail to
include these object files. The reason I believe is due to a bug in make
rules wherein the time granularity is 1 second. Try to introduce a sleep
of 1 second before executing the archive command.
Hope this helps.
With Regards
Vardhan
-----Original Message-----
From: address@hidden
[mailto:address@hidden On Behalf Of
Michael Ringe
Sent: Thursday, October 21, 2010 8:43 AM
To: address@hidden
Subject: Problem with parallel build
The Makefile shown below sometimes fails to build the main target
(app1).
Can anyone reproduce the error and explain what's wrong or confirm it's
a bug?
All required files are in the attached .tar file. To reproduce the
error, make sure app1.o does not exist, then run "make -j2 app1"
repeatedly.
On my machine (Intel core i5 551, openSuSE 11.3, make 3.81) make fails
after a few retries, because the link command is invoked before app1.o
is compiled.
--Michael
### --- Makefile start ---
AR := ar
CC := gcc
all: app1
# Link apps
app%: app%.o lib.a
${CC} ${@:app%=app%.o} lib.a -o $@
# Link lib.a
LIBSRCS := a b
lib.a: ${LIBSRCS:%=%.o}
${AR} r $@ ${LIBSRCS:%=%.o}
# Compile
%.o: src/%.c
$(CC) -c -o $@ $<
# Dependencies
a.o: a.c lib.h
b.o: b.c lib.h
### --- Makefile end ---