Project

General

Profile

Actions

Bug #22059

open

make -j problem in dtrace build

Bug #22059: make -j problem in dtrace build

Added by wiz (Thomas Klausner) 7 days ago.

Status:
Open
Assignee:
-
Target version:
-
[ruby-core:125430]

Description

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) install.log wiz (Thomas Klausner), 05/07/2026 02:15 PM

No data to display

Actions

Also available in: PDF Atom