Cross build 13.1 from OSX

From: Daniel O'Connor <darius_at_dons.net.au>
Date: Wed, 13 Jul 2022 06:16:21 UTC
Hi,
I'm trying to cross build from OSX (with stuff built from Macports). I modified make.py to add /opt/local/bin to the path then ran:

env XCC=/opt/local/bin/clang-mp-14 XCXX=/opt/local/bin/clang++-mp-14 XCPP=/opt/local/bin/clang-cpp-mp-14 XLD=/opt/local/bin/ld.lld-mp-14 MAKEOBJDIRPREFIX=/tmp/freebsdobj --host-bindir=/opt/local/bin tools/build/make.py TARGET=amd64 TARGET_ARCH=amd64 kernel-toolchain

However it bombs out trying to build compile_et:
--------------------------------------------------------------
>>> stage 1.2: bootstrap tools
--------------------------------------------------------------
cd /Users/oconnd1/projects/freebsd; INSTALL="sh /Users/oconnd1/projects/freebsd/tools/install.sh"  TOOLS_PREFIX=/private/tmp/freebsdobj/Users/oconnd1/projects/freebsd/amd64.amd64/tmp  PATH=/private/tmp/freebsdobj/Users/oconnd1/projects/freebsd/amd64.amd64/tmp/legacy/usr/sbin:/private/tmp/freebsdobj/Users/oconnd1/projects/freebsd/amd64.amd64/tmp/legacy/usr/bin:/private/tmp/freebsdobj/Users/oconnd1/projects/freebsd/amd64.amd64/tmp/legacy/bin:/private/tmp/freebsdobj/Users/oconnd1/projects/freebsd/amd64.amd64/tmp/legacy/usr/libexec:/sbin:/bin:/usr/sbin:/usr/bin  WORLDTMP=/private/tmp/freebsdobj/Users/oconnd1/projects/freebsd/amd64.amd64/tmp  MAKEFLAGS="-m /Users/oconnd1/projects/freebsd/tools/build/mk  -D WITH_AUTO_OBJ -D WITHOUT_CLEAN -m /Users/oconnd1/projects/freebsd/share/mk" /tmp/freebsdobj/bmake-install/bin/bmake  -f Makefile.inc1  DESTDIR=  OBJTOP='/private/tmp/freebsdobj/Users/oconnd1/projects/freebsd/amd64.amd64/tmp/obj-tools'  OBJROOT='${OBJTOP}/'  MAKEOBJDIRPREFIX=  BOOTSTRAPPING=0  BWPHASE=bootstrap-tools  -DNO_CPU_CFLAGS  -DNO_LINT  -DNO_PIC  -DNO_SHARED  MK_CTF=no  MK_CLANG_EXTRAS=no  MK_CLANG_FORMAT=no  MK_CLANG_FULL=no  MK_HTML=no  MK_MAN=no  MK_PROFILE=no  MK_RETPOLINE=no  MK_SSP=no  MK_TESTS=no  MK_WERROR=no  MK_INCLUDES=yes  MK_MAN_UTILS=yes MK_LLVM_TARGET_ALL=no bootstrap-tools
<snip>
===> usr.bin/compile_et (obj,all,install)
[Creating objdir /private/tmp/freebsdobj/Users/oconnd1/projects/freebsd/amd64.amd64/tmp/obj-tools/usr.bin/compile_et...]
yacc -d  -o parse.c /Users/oconnd1/projects/freebsd/contrib/com_err/parse.y
lex   -olex.c /Users/oconnd1/projects/freebsd/contrib/com_err/lex.l
echo compile_et:  /private/tmp/freebsdobj/Users/oconnd1/projects/freebsd/amd64.amd64/tmp/legacy/usr/lib/libroken.a /usr/lib/libcrypt.a /private/tmp/freebsdobj/Users/oconnd1/projects/freebsd/amd64.amd64/tmp/obj-tools/kerberos5/lib/libvers/libvers.a /private/tmp/freebsdobj/Users/oconnd1/projects/freebsd/amd64.amd64/tmp/legacy/usr/lib/libegacy.a >> .depend
/usr/bin/cc  -O2 -pipe -fno-common -I. -I/Users/oconnd1/projects/freebsd/contrib/com_err  -MD  -MF.depend.compile_et.o -MTcompile_et.o -std=gnu99 -Wno-format-zero-length -Wno-pointer-sign -Wno-system-headers -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Wno-error=unused-but-set-variable -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality -Wno-unused-function -Wno-enum-conversion -Wno-unused-local-typedef -Wno-address-of-packed-member -Wno-switch -Wno-switch-enum -Wno-knr-promoted-parameter -Wno-parentheses -Wno-typedef-redefinition -Werror=incompatible-pointer-types-discards-qualifiers  -Qunused-arguments    -I/private/tmp/freebsdobj/Users/oconnd1/projects/freebsd/amd64.amd64/tmp/legacy/usr/include -Werror=implicit-function-declaration -Werror=implicit-int  -Werror=return-type -Wundef -DHAVE_NBTOOL_CONFIG_H=1 -I/Users/oconnd1/projects/freebsd/tools/build/cross-build/include/common -D_DARWIN_C_SOURCE=1 -I/Users/oconnd1/projects/freebsd/tools/build/cross-build/include/mac -idirafter /Users/oconnd1/projects/freebsd/contrib/libarchive/libarchive -c /Users/oconnd1/projects/freebsd/contrib/com_err/compile_et.c -o compile_et.o
/usr/bin/cc  -O2 -pipe -fno-common -I. -I/Users/oconnd1/projects/freebsd/contrib/com_err  -MD  -MF.depend.parse.o -MTparse.o -std=gnu99 -Wno-format-zero-length -Wno-pointer-sign -Wno-system-headers -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Wno-error=unused-but-set-variable -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality -Wno-unused-function -Wno-enum-conversion -Wno-unused-local-typedef -Wno-address-of-packed-member -Wno-switch -Wno-switch-enum -Wno-knr-promoted-parameter -Wno-parentheses -Wno-typedef-redefinition -Werror=incompatible-pointer-types-discards-qualifiers  -Qunused-arguments    -I/private/tmp/freebsdobj/Users/oconnd1/projects/freebsd/amd64.amd64/tmp/legacy/usr/include -Werror=implicit-function-declaration -Werror=implicit-int  -Werror=return-type -Wundef -DHAVE_NBTOOL_CONFIG_H=1 -I/Users/oconnd1/projects/freebsd/tools/build/cross-build/include/common -D_DARWIN_C_SOURCE=1 -I/Users/oconnd1/projects/freebsd/tools/build/cross-build/include/mac -idirafter /Users/oconnd1/projects/freebsd/contrib/libarchive/libarchive -c parse.c -o parse.o
/usr/bin/cc  -O2 -pipe -fno-common -I. -I/Users/oconnd1/projects/freebsd/contrib/com_err  -MD  -MF.depend.lex.o -MTlex.o -std=gnu99 -Wno-format-zero-length -Wno-pointer-sign -Wno-system-headers -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Wno-error=unused-but-set-variable -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality -Wno-unused-function -Wno-enum-conversion -Wno-unused-local-typedef -Wno-address-of-packed-member -Wno-switch -Wno-switch-enum -Wno-knr-promoted-parameter -Wno-parentheses -Wno-typedef-redefinition -Werror=incompatible-pointer-types-discards-qualifiers  -Qunused-arguments    -I/private/tmp/freebsdobj/Users/oconnd1/projects/freebsd/amd64.amd64/tmp/legacy/usr/include -Werror=implicit-function-declaration -Werror=implicit-int  -Werror=return-type -Wundef -DHAVE_NBTOOL_CONFIG_H=1 -I/Users/oconnd1/projects/freebsd/tools/build/cross-build/include/common -D_DARWIN_C_SOURCE=1 -I/Users/oconnd1/projects/freebsd/tools/build/cross-build/include/mac -idirafter /Users/oconnd1/projects/freebsd/contrib/libarchive/libarchive -c lex.c -o lex.o
/usr/bin/cc -O2 -pipe -fno-common -I. -I/Users/oconnd1/projects/freebsd/contrib/com_err -std=gnu99 -Wno-format-zero-length -Wno-pointer-sign -Wno-system-headers -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Wno-error=unused-but-set-variable -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality -Wno-unused-function -Wno-enum-conversion -Wno-unused-local-typedef -Wno-address-of-packed-member -Wno-switch -Wno-switch-enum -Wno-knr-promoted-parameter -Wno-parentheses -Wno-typedef-redefinition -Werror=incompatible-pointer-types-discards-qualifiers -Qunused-arguments -I/private/tmp/freebsdobj/Users/oconnd1/projects/freebsd/amd64.amd64/tmp/legacy/usr/include -Werror=implicit-function-declaration -Werror=implicit-int -Werror=return-type -Wundef -DHAVE_NBTOOL_CONFIG_H=1 -I/Users/oconnd1/projects/freebsd/tools/build/cross-build/include/common -D_DARWIN_C_SOURCE=1 -I/Users/oconnd1/projects/freebsd/tools/build/cross-build/include/mac -idirafter /Users/oconnd1/projects/freebsd/contrib/libarchive/libarchive    -L/private/tmp/freebsdobj/Users/oconnd1/projects/freebsd/amd64.amd64/tmp/legacy/usr/lib -o compile_et compile_et.o parse.o lex.o  -L/private/tmp/freebsdobj/Users/oconnd1/projects/freebsd/amd64.amd64/tmp/obj-tools/kerberos5/lib/libroken -lroken -L/private/tmp/freebsdobj/Users/oconnd1/projects/freebsd/amd64.amd64/tmp/obj-tools/lib/libcrypt -lcrypt -L/private/tmp/freebsdobj/Users/oconnd1/projects/freebsd/amd64.amd64/tmp/obj-tools/kerberos5/lib/libvers -lvers  -legacy -lresolv
ld: warning: directory not found for option '-L/private/tmp/freebsdobj/Users/oconnd1/projects/freebsd/amd64.amd64/tmp/obj-tools/lib/libcrypt'
ld: library not found for -lcrypt
clang: error: linker command failed with exit code 1 (use -v to see invocation)
*** Error code 1

Stop.
bmake[3]: stopped in /Users/oconnd1/projects/freebsd/usr.bin/compile_et
*** Error code 1

My tree is a (slightly modified) clone of fc952ac2212b121aa6eefc273f5960ec3e0a466d

I see usr.bin/compile_et/Makefile.depend has libcrypt but not sure why it doesn't get built.

--
Daniel O'Connor
"The nice thing about standards is that there
are so many of them to choose from."
-- Andrew Tanenbaum