[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Random Segmentation fault when run with -j n
From: |
Shahzad Muzaffar |
Subject: |
Random Segmentation fault when run with -j n |
Date: |
Sat, 20 Oct 2007 12:23:21 +0200 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.2) Gecko/20040805 Netscape/7.2 |
Hello,
I have this Makefile (attached) and when I run it with -j 8 then I get
random segmentation fault(not always on same point). Running it without
-j option works fine and I do not get segmentation fault all the time
(it is just random). My guess is that as I calculate values for some
variable only on fly so may be when run with -j option, two threads try
to calculate/access the same variable and that causes a crash. If I
force the calculation of those variables before any rule to run then it
works fine. So may be there is some variable locking problem.
Cheers,
--Shahzad
comma:= ,
empty:=
colon:= :
space:= $(epmty) $(empty)
##############################################################################
define set_cached_var_func_arg_
cached_var_func_arg$(cached_var_func_arg_count_$(1))_$(1) := $(2)
cached_var_func_arg_count_$(1) := $(cached_var_func_arg_count_$(1))1
endef
define set_cached_var_
$(eval cached_var_func_arg_count_$(1) :=)
$(foreach arg,$(subst $(comma),$(space),$(cached_var_function_$(1))),$(eval
$(call set_cached_var_func_arg_,$(1),$(arg))))
cached_var_$(1):=$(call
$(cached_var_func_arg_$(1)),$(cached_var_func_arg1_$(1)),$(cached_var_func_arg11_$(1)),$(cached_var_func_arg111_$(1)),$(cached_var_func_arg1111_$(1)),$(cached_var_func_arg11111_$(1)))
endef
define get_cached_var_
$(if $(subst undefined,,$(origin cached_var_$(1))),$(cached_var_$(1)),$(eval
$(call set_cached_var_,$(1)))$(cached_var_$(1)))
endef
define get_uniq_cached_var_
$(if $(subst undefined,,$(origin cached_var_$(1))),$(cached_var_$(1)),$(eval
$(call set_cached_var_,$(1)))$(call Uniq,$(cached_var_$(1))))
endef
##############################################################################
define Uniq
$(eval uniq_string_:=)$(strip $(foreach v,$(1),$(if $(filter
$(v),$(uniq_string_)),,$(eval uniq_string_+=$(v))))$(uniq_string_))
endef
define AddCachedVariable
cached_var_function_$(1) := $(subst $(colon),$(comma),$(2))
ifeq ($$(strip $(3)),)
$(1) = $$(call get_cached_var_,$(1))
else
$(1) = $$(call get_uniq_cached_var_,$(1))
endif
endef
define CalculateToolOrder
$(if $(strip $($(1)_LOC_USE)),$(shell perl \-e '@z=($(2) $(foreach
dep,$(foreach d,$($(1)_LOC_USE),$($d)),$(comma)$($(dep)_ORDER))); @z=sort {$$a
<=> $$b} @z;$$x=$$z[0];$$x--;print "$$x";'),$(2))
endef
define ProductCommonVarsExternal
$$(eval $$(call AddCachedVariable,$(1)_ORDER,CalculateToolOrder:$(1):99999,))
endef
S0/P0_0 := P0_0
P0_0_LOC_USE :=
P0_0_EX_USE :=
ALL_PACKS := P0_0 $(ALL_PACKS)
S0/P0_1 := P0_1
P0_1_LOC_USE := S0/P0_0
P0_1_EX_USE := S0/P0_0
ALL_PACKS := P0_1 $(ALL_PACKS)
S0/P0_2 := P0_2
P0_2_LOC_USE := S0/P0_1 S0/P0_0
P0_2_EX_USE := S0/P0_1 S0/P0_0
ALL_PACKS := P0_2 $(ALL_PACKS)
S0/P0_3 := P0_3
P0_3_LOC_USE := S0/P0_1 S0/P0_0
P0_3_EX_USE := S0/P0_1 S0/P0_0
ALL_PACKS := P0_3 $(ALL_PACKS)
S0/P0_4 := P0_4
P0_4_LOC_USE := S0/P0_1 S0/P0_2
P0_4_EX_USE := S0/P0_1 S0/P0_2
ALL_PACKS := P0_4 $(ALL_PACKS)
S1/P1_0 := P1_0
P1_0_LOC_USE := S0/P0_0 S0/P0_2
P1_0_EX_USE := S0/P0_0 S0/P0_2
ALL_PACKS := P1_0 $(ALL_PACKS)
S1/P1_1 := P1_1
P1_1_LOC_USE := S0/P0_4 S0/P0_0
P1_1_EX_USE := S0/P0_4 S0/P0_0
ALL_PACKS := P1_1 $(ALL_PACKS)
S1/P1_2 := P1_2
P1_2_LOC_USE := S0/P0_3 S0/P0_1
P1_2_EX_USE := S0/P0_3 S0/P0_1
ALL_PACKS := P1_2 $(ALL_PACKS)
S1/P1_3 := P1_3
P1_3_LOC_USE := S0/P0_3 S0/P0_0
P1_3_EX_USE := S0/P0_3 S0/P0_0
ALL_PACKS := P1_3 $(ALL_PACKS)
S1/P1_4 := P1_4
P1_4_LOC_USE := S0/P0_2 S0/P0_0
P1_4_EX_USE := S0/P0_2 S0/P0_0
ALL_PACKS := P1_4 $(ALL_PACKS)
S2/P2_0 := P2_0
P2_0_LOC_USE := S1/P1_0 S1/P1_3
P2_0_EX_USE := S1/P1_0 S1/P1_3
ALL_PACKS := P2_0 $(ALL_PACKS)
S2/P2_1 := P2_1
P2_1_LOC_USE := S0/P0_0 S1/P1_3
P2_1_EX_USE := S0/P0_0 S1/P1_3
ALL_PACKS := P2_1 $(ALL_PACKS)
S2/P2_2 := P2_2
P2_2_LOC_USE := S0/P0_2 S1/P1_1
P2_2_EX_USE := S0/P0_2 S1/P1_1
ALL_PACKS := P2_2 $(ALL_PACKS)
S2/P2_3 := P2_3
P2_3_LOC_USE := S2/P2_1 S1/P1_0
P2_3_EX_USE := S2/P2_1 S1/P1_0
ALL_PACKS := P2_3 $(ALL_PACKS)
S2/P2_4 := P2_4
P2_4_LOC_USE := S1/P1_2 S2/P2_2
P2_4_EX_USE := S1/P1_2 S2/P2_2
ALL_PACKS := P2_4 $(ALL_PACKS)
S3/P3_0 := P3_0
P3_0_LOC_USE := S2/P2_2 S2/P2_0
P3_0_EX_USE := S2/P2_2 S2/P2_0
ALL_PACKS := P3_0 $(ALL_PACKS)
S3/P3_1 := P3_1
P3_1_LOC_USE := S2/P2_1 S0/P0_1
P3_1_EX_USE := S2/P2_1 S0/P0_1
ALL_PACKS := P3_1 $(ALL_PACKS)
S3/P3_2 := P3_2
P3_2_LOC_USE := S0/P0_4 S2/P2_4
P3_2_EX_USE := S0/P0_4 S2/P2_4
ALL_PACKS := P3_2 $(ALL_PACKS)
S3/P3_3 := P3_3
P3_3_LOC_USE := S1/P1_1 S1/P1_0
P3_3_EX_USE := S1/P1_1 S1/P1_0
ALL_PACKS := P3_3 $(ALL_PACKS)
S3/P3_4 := P3_4
P3_4_LOC_USE := S3/P3_2 S2/P2_4
P3_4_EX_USE := S3/P3_2 S2/P2_4
ALL_PACKS := P3_4 $(ALL_PACKS)
S4/P4_0 := P4_0
P4_0_LOC_USE := S0/P0_3 S2/P2_3
P4_0_EX_USE := S0/P0_3 S2/P2_3
ALL_PACKS := P4_0 $(ALL_PACKS)
S4/P4_1 := P4_1
P4_1_LOC_USE := S3/P3_3 S0/P0_2
P4_1_EX_USE := S3/P3_3 S0/P0_2
ALL_PACKS := P4_1 $(ALL_PACKS)
S4/P4_2 := P4_2
P4_2_LOC_USE := S3/P3_3 S0/P0_4
P4_2_EX_USE := S3/P3_3 S0/P0_4
ALL_PACKS := P4_2 $(ALL_PACKS)
S4/P4_3 := P4_3
P4_3_LOC_USE := S2/P2_3 S1/P1_1
P4_3_EX_USE := S2/P2_3 S1/P1_1
ALL_PACKS := P4_3 $(ALL_PACKS)
S4/P4_4 := P4_4
P4_4_LOC_USE := S2/P2_3 S3/P3_2
P4_4_EX_USE := S2/P2_3 S3/P3_2
ALL_PACKS := P4_4 $(ALL_PACKS)
$(foreach p,$(ALL_PACKS),$(eval $(call ProductCommonVarsExternal,$(p))))
all: $(foreach p,$(ALL_PACKS),$(p)_ORDER)
@echo $@
%:
@sleep 1
@echo "$@ = $($@)"
- Random Segmentation fault when run with -j n,
Shahzad Muzaffar <=