Fri 01 Jun 2007 07:52:33 PM UTC, comment #1:
Hi, its me again. Find below a trivial makefile to recreate this. run 'make setup && make -j2' to get a segfault.
Cheers,
Rasmus
A := $(wildcard *.a)
.PHONY: all
all: $(A:.a=.b)
.PHONY: clean
clean:
rm -f $(A)
.PHONY: setup
setup:
@touch 1.a 2.a 3.a 4.a 5.a 6.a
define d1
@echo lala $(1)
@sleep 1
endef
define d2
@echo tyty $(1)
@sleep 1
endef
%.b : %.a
$(eval CHECKSUM := $(word 1,$(shell cat $^ | sha1sum))) $(if $(wildcard $(CACHEDIR)/$(CHECKSUM)),\
$(call d1,$(CHECKSUM)),\
$(call d2,$(CHECKSUM)))
|
Fri 01 Jun 2007 10:48:41 AM UTC, original submission:
Hello,
At work I have a (proprietary, sorry) makefile where I use an $(eval) construct. It goes like
foo: bar
$(eval CHECKSUM := $(word 1,$(shell cat $^ | sha1sum))) $(if $(wildcard $(CACHEDIR)/$(CHECKSUM)), $(call do-copy,$(CHECKSUM)), $(call do-dct4-selection,$(CHECKSUM)))
This runs nicely with a plain make but if I try make -j2 I get a segfault. I have captured this in gdb, output below
(gdb) bt
#0 eval_buffer (
buffer=0x819abb8 "CHECKSUM := ac2773ef9cb98feab91b3ddfeedc20019d1516c3")
at read.c:430
#1 0x08050012 in func_eval (o=0x819aae9 "[\230[", argv=0x0,
funcname=0x8062e38 "eval") at function.c:1369
#2 0x080506a8 in expand_builtin_function (o=0x819aae9 "[\230[",
argc=135900088, argv=0xfeffa8b0, entry_p=0xffffffca) at function.c:2115
#3 0x08050819 in handle_function (op=0xfeffa944, stringp=0x818ea38)
at function.c:2213
#4 0x0804c630 in variable_expand_string (line=0x0,
string=0x818ea00 "\t$(eval CHECKSUM := $(word 1,$(shell cat $^ | sha1sum))) $(if $(wildcard $(CACHEDIR)/$(CHECKSUM)), $(call do-copy,$(CHECKSUM)), $(call do-dct4-selection,$(CHECKSUM)))", length=-1) at expand.c:253
#5 0x0804c9a6 in variable_expand (
line=0x818ea00 "\t$(eval CHECKSUM := $(word 1,$(shell cat $^ | sha1sum))) $(if $(wildcard $(CACHEDIR)/$(CHECKSUM)), $(call do-copy,$(CHECKSUM)), $(call do-dct4-selection,$(CHECKSUM)))") at expand.c:418
#6 0x0804ca40 in variable_expand_for_file (
line=0xffffffca <Address 0xffffffca out of bounds>, file=0x819abb8)
at expand.c:463
#7 0x0804cc15 in allocated_variable_expand_for_file (
line=0x818ea00 "\t$(eval CHECKSUM := $(word 1,$(shell cat $^ | sha1sum))) $(if $(wildcard $(CACHEDIR)/$(CHECKSUM)), $(call do-copy,$(CHECKSUM)), $(call do-dct4-selection,$(CHECKSUM)))", file=0x80725b8) at expand.c:548
#8 0x08053319 in new_job (file=0x80725b8) at job.c:1600
#9 0x0805c28a in update_file_1 (file=0x80725b8, depth=0) at remake.c:761
#10 0x0805b984 in update_file (file=0x80725b8, depth=0) at remake.c:307
#11 0x0805b63f in update_goal_chain (goals=0x80ba8d8) at remake.c:154
#12 0x080551a2 in main (argc=7, argv=0xfeffc454, envp=0xfeffc474)
at main.c:2198
(gdb) print reading_file
$1 = (const struct floc *) 0x0
line 430 at read.c:
ebuf.floc = *reading_file;
So we try to dereference a NULL pointer here. As stated this is make 3.81.
I hope this is of help, otherwise I'll try to provide more information.
Cheers,
Rasmus
|