Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 24 May 2019 10:56:50 -0400
From:      Mark Johnston <markj@freebsd.org>
To:        Cy Schubert <Cy.Schubert@cschubert.com>
Cc:        freebsd-hackers@freebsd.org, rmacklem@freebsd.org
Subject:   Re: DTrace instrumentation build error
Message-ID:  <20190524145650.GB72269@raichu>
In-Reply-To: <201905241255.x4OCtpGV037672@slippy.cwsent.com>
References:  <201905241255.x4OCtpGV037672@slippy.cwsent.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, May 24, 2019 at 05:55:51AM -0700, Cy Schubert wrote:
> Hi,
> 
> I'm helping rmacklem@ with instrumentation of mountd with USDT 
> probes.It builds fine on amd64 however fails on i386
> 
> ===> sbin/sconfig (all)
> ld: error: cannot open /usr/lib32/dtrace/drti.o: No such file or 
> directory
> dtrace: failed to link script /home/cy/stable12/usr.sbin/mountd/mountd_d
> t.d: fai
> led to link mountd_dt.o: ld exited with status 1
> --- mountd_dt.o ---
> *** [mountd_dt.o] Error code 1
> 
> make[6]: stopped in /home/cy/stable12/usr.sbin/mountd
> 1 error
> 
> make[6]: stopped in /home/cy/stable12/usr.sbin/mountd
> --- all_subdir_usr.sbin/mountd ---
> *** [all_subdir_usr.sbin/mountd] Error code 2
> 
> A couple of interesting things here:
> 
> 1. /usr/lib32/dtrace/drti.o doesn't exist in the universe12a and 
> universe12b jails.

/usr/lib32 is entirely missing in those jails.

> 2. Why would buildworld (tinderbox in this case) link against an object 
> outside of /usr/obj?

It is simply dtrace(1)'s default behaviour.  I believe this patch is
sufficient to fix the problem for both native and 32-bit compat builds.
I think it is a bit too hacky though: we should probably only add
-x libdir during a world build.  A standalone make -C usr.sbin/mountd
should use the host drti.o.  What's the right predicate for that?

diff --git a/share/mk/bsd.dep.mk b/share/mk/bsd.dep.mk
index 5d0aac91f1b4..ce008fdba324 100644
--- a/share/mk/bsd.dep.mk
+++ b/share/mk/bsd.dep.mk
@@ -147,6 +147,9 @@ OBJS_DEPEND_GUESS.${_YC:R}.o+=	${_YC}
 # DTrace probe definitions
 .if ${SRCS:M*.d}
 CFLAGS+=	-I${.OBJDIR}
+.if exists(${OBJTOP}/cddl/lib/drti/drti.o)
+DTRACEFLAGS+=	-x libdir=${OBJTOP}/cddl/lib/drti
+.endif
 .endif
 .for _DSRC in ${SRCS:M*.d:N*/*}
 .for _D in ${_DSRC:R}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20190524145650.GB72269>