[ruby-core:125430] [Ruby Bug#22059] make -j problem in dtrace build
Issue #22059 has been reported by wiz (Thomas Klausner). ---------------------------------------- Bug #22059: make -j problem in dtrace build https://bugs.ruby-lang.org/issues/22059 * Author: wiz (Thomas Klausner) * Status: Open * ruby -v: 4.0.3 * Backport: 3.3: UNKNOWN, 3.4: UNKNOWN, 4.0: UNKNOWN ---------------------------------------- When building ruby 4.0.3 on NetBSD (from pkgsrc) in a parallel build (make -j16), I sometimes see build problems like this: ``` processing probes in object files dtrace: target object (probes.o) already exists. Please remove the target dtrace: object and rebuild all the source objects if you wish to run the DTrace dtrace: linking process again linking miniruby ld: probes.o: warning: relocation against `$dtrace1391839.rb_str_resurrect' in read-only section `.SUNW_dof' ld: array.o: in function `empty_ary_alloc': /tmp/lang/ruby40/work/ruby-4.0.3/array.c:716:(.text+0x14e0): undefined reference to `__dtraceenabled_ruby___array__create' ld: /tmp/lang/ruby40/work/ruby-4.0.3/array.c:716:(.text+0x1541): undefined reference to `__dtrace_ruby___array__create' ... ``` (longer log attached) I think the problem is (something like) this: In template/Makefile.in, probes.stamp is: ``` probes.stamp: $(DTRACE_REBUILD_OBJS) $(Q) if test -f $@ -o -f probes.$(OBJEXT); then \ $(RM) $(DTRACE_REBUILD_OBJS) $@; \ $(ECHO0) "rebuilding objects which were modified by \"dtrace -G\""; \ $(MAKE) $(DTRACE_REBUILD_OBJS); \ fi $(Q) touch $@ ``` where DTRACE_REBUILD_OBJS includes probes.o. So if probes.stamp (for example, because probes.o should be built when dtrace is enabled) is triggered, it _deletes_ probes.o and then runs make to generate it. At the same time, e.g. miniruby might be built in another make job. miniruby, in common.mk, depends on ``` miniruby$(EXEEXT): config.status $(NORMALMAINOBJ) $(MINIOBJS) $(COMMONOBJS) $(ARCHFILE) ``` COMMONOBJS, in the same file, includes $(DTRACE_OBJ), which is set to probes.o by configure: ``` build/Makefile:DTRACE_OBJ = probes.$(OBJEXT) ``` so this might also trigger a (re)build of probes.o, and in some cases this breaks the build. libruby also has a dependency chain that includes probes.o (it links OBJS which includes EXPORTOBJS which includes COMMONOBJS). ---Files-------------------------------- install.log (19.1 KB) -- https://bugs.ruby-lang.org/
Issue #22059 has been updated by wiz (Thomas Klausner). File patch-template_Makefile.in added I've committed the attached patch to pkgsrc, which so far seems to fix the problem for me. ---------------------------------------- Bug #22059: make -j problem in dtrace build https://bugs.ruby-lang.org/issues/22059#change-117335 * Author: wiz (Thomas Klausner) * Status: Open * ruby -v: 4.0.3 * Backport: 3.3: UNKNOWN, 3.4: UNKNOWN, 4.0: UNKNOWN ---------------------------------------- When building ruby 4.0.3 on NetBSD (from pkgsrc) in a parallel build (make -j16), I sometimes see build problems like this: ``` processing probes in object files dtrace: target object (probes.o) already exists. Please remove the target dtrace: object and rebuild all the source objects if you wish to run the DTrace dtrace: linking process again linking miniruby ld: probes.o: warning: relocation against `$dtrace1391839.rb_str_resurrect' in read-only section `.SUNW_dof' ld: array.o: in function `empty_ary_alloc': /tmp/lang/ruby40/work/ruby-4.0.3/array.c:716:(.text+0x14e0): undefined reference to `__dtraceenabled_ruby___array__create' ld: /tmp/lang/ruby40/work/ruby-4.0.3/array.c:716:(.text+0x1541): undefined reference to `__dtrace_ruby___array__create' ... ``` (longer log attached) I think the problem is (something like) this: In template/Makefile.in, probes.stamp is: ``` probes.stamp: $(DTRACE_REBUILD_OBJS) $(Q) if test -f $@ -o -f probes.$(OBJEXT); then \ $(RM) $(DTRACE_REBUILD_OBJS) $@; \ $(ECHO0) "rebuilding objects which were modified by \"dtrace -G\""; \ $(MAKE) $(DTRACE_REBUILD_OBJS); \ fi $(Q) touch $@ ``` where DTRACE_REBUILD_OBJS includes probes.o. So if probes.stamp (for example, because probes.o should be built when dtrace is enabled) is triggered, it _deletes_ probes.o and then runs make to generate it. At the same time, e.g. miniruby might be built in another make job. miniruby, in common.mk, depends on ``` miniruby$(EXEEXT): config.status $(NORMALMAINOBJ) $(MINIOBJS) $(COMMONOBJS) $(ARCHFILE) ``` COMMONOBJS, in the same file, includes $(DTRACE_OBJ), which is set to probes.o by configure: ``` build/Makefile:DTRACE_OBJ = probes.$(OBJEXT) ``` so this might also trigger a (re)build of probes.o, and in some cases this breaks the build. libruby also has a dependency chain that includes probes.o (it links OBJS which includes EXPORTOBJS which includes COMMONOBJS). ---Files-------------------------------- install.log (19.1 KB) patch-template_Makefile.in (1.1 KB) -- https://bugs.ruby-lang.org/
participants (1)
-
wiz (Thomas Klausner)