[CRIU] [PATCH] make: fix multithreded compilation

Ruslan Kuprieiev kupruser at gmail.com
Tue Jan 20 06:01:06 PST 2015


On 01/20/2015 03:53 PM, Pavel Emelyanov wrote:
> On 01/19/2015 06:38 PM, Ruslan Kuprieiev wrote:
>> Currently we run into lots of race conditions when building in
>> multithreded mode.
>>
>> Reported-by: Mr Jenkins
>> Signed-off-by: Ruslan Kuprieiev <kupruser at gmail.com>
>> ---
>>   Makefile          | 4 +++-
>>   protobuf/Makefile | 2 +-
>>   2 files changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/Makefile b/Makefile
>> index 39433fc..a896e33 100644
>> --- a/Makefile
>> +++ b/Makefile
>> @@ -148,7 +148,9 @@ ifeq ($(GCOV),1)
>>   %.o $(PROGRAM): override CFLAGS += --coverage
>>   endif
>>   
>> -all: config pie $(VERSION_HEADER) $(CRIU-LIB) $(PROGRAM) crit
>> +all: config pie $(VERSION_HEADER) $(CRIU-LIB)
>> +	$(Q) $(MAKE) $(PROGRAM)
>> +	$(Q) $(MAKE) crit
> Is this change really needed? AFAIU the problem is that some .proto
> files depend on opts.proto and in case the former gets compiled
> before the latter we're in trouble. And it doesn't (shouldn't) matter
> whether we compile criu or crit first.

This one, in particular first line, is very needed, as otherwise we get 
race condition.
I accidentally deleted that line in previous patch.

About opts.proto, I don't actually understand, why separately specifying 
opts.pb-c.c
as a dependency works, but it allows, at least for now, fix building in 
multi-threded
mode.

This patch should be considered as, at least, the temporary solution to 
get things back
to work, until we find a way to cleanup everything.

> Cyrill?
>
>>   
>>   protobuf/%::
>>   	$(Q) $(MAKE) $(build)=protobuf $@
>> diff --git a/protobuf/Makefile b/protobuf/Makefile
>> index 0c3196b..9c7a0bb 100644
>> --- a/protobuf/Makefile
>> +++ b/protobuf/Makefile
>> @@ -89,7 +89,7 @@ $(obj)/%.proto.c.d: $(obj)/%.proto | $(obj)/%.proto.d
>>   		-e 's/.*/$(subst .proto,.pb-c.c,$(subst /,\/,$<)):$(subst /,\/,$(obj))\/&/'	| \
>>   		uniq > $@
>>   
>> -$(obj)/%.pb-c.c $(obj)/%.pb-c.h: $(obj)/%.proto $(obj)/%.proto.c.d
>> +$(obj)/%.pb-c.c $(obj)/%.pb-c.h: $(obj)/%.proto $(obj)/%.proto.c.d $(obj)/opts.pb-c.c
>>   	$(E) "  PBCC    " $@
>>   	$(Q) protoc-c --proto_path=$(obj)/ --c_out=$(obj)/ $<
>>   ifeq ($(SRCARCH),arm)
>>



More information about the CRIU mailing list