Re: Help cross-building kernel from macos

From: Brooks Davis <brooks_at_freebsd.org>
Date: Wed, 08 Nov 2023 23:34:04 UTC
On Wed, Nov 08, 2023 at 06:05:21PM -0500, Colin S. Gordon wrote:
> On Wed, Nov 8, 2023, at 16:13, Kyle Evans wrote:
> > On 11/8/23 13:54, Colin S. Gordon wrote:
> > > [... snip ...]
> > 
> > Just a couple of missing dependencies; this seems to do it for me [0], 
> > could probably still use a bit of cleanup.
> > 
> > diff --git a/Makefile.inc1 b/Makefile.inc1
> > index c1c0b56ef..d9a772a00 100644
> > --- a/Makefile.inc1
> > +++ b/Makefile.inc1
> > @@ -2442,6 +2442,9 @@ _gensnmptree= usr.sbin/bsnmpd/gensnmptree
> >   _clang_tblgen= \
> >   lib/clang/libllvmminimal \
> >   usr.bin/clang/llvm-tblgen
> > +.if ${BOOTSTRAPPING} < 1300030
> > +${_bt}-usr.bin/clang/llvm-tblgen: ${_bt}-lib/libzstd
> > +.endif
> >   .if ${MK_CLANG_BOOTSTRAP} != "no" || ${MK_CLANG} != "no" || \
> >       ${MK_LLDB} != "no"
> >   _clang_tblgen+= lib/clang/libclangminimal
> > @@ -2475,6 +2478,7 @@ _kerberos5_bootstrap_tools= \
> >   kerberos5/tools/slc \
> >   usr.bin/compile_et
> > 
> > +${_bt}-kerberos5/lib/libroken: ${_bt}-lib/libcrypt
> >   .ORDER: ${_kerberos5_bootstrap_tools:C/^/${_bt}-/g}
> >   .for _tool in ${_kerberos5_bootstrap_tools}
> >   ${_bt}-${_tool}: ${_bt}-usr.bin/yacc ${_bt_lex_depend}
> > 
> > [0] https://termbin.com/oszy
> > 
> 
> Thanks! This seems to work for me for kernel-toolchain, then switching to a newer LLVM works around a RISC-V-specific failure in buildkernel, and it works! I'm still curious why the CI environment (and presumably others) don't need this patch; clearly there's some other divergence between the CI environment and my machine (and apparently Kyle's, too).

The way jobs get scheduled if you use -jN (N>1) seems to cause libztsd to
be built in time.  The Cirrus-CI job uses -j8.  I can reliably trigger
the bug on my mac with no -j argument or -j1, but with -j1.2 it builds
fine.

-- Brooks