Bug 253956

Summary: Cannot build 13-STABLE on 12.2-STABLE if kbdcontrol is not installed.
Product: Base System Reporter: rsmith
Component: miscAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed Works As Intended    
Severity: Affects Only Me    
Priority: ---    
Version: 12.2-STABLE   
Hardware: amd64   
OS: Any   

Description rsmith 2021-03-02 14:48:08 UTC
As I normally do, I wanted to do a source upgrade from 12.2-STABLE to 13.0-STABLE.
My machine is currently on FreeBSD 12.2-STABLE r367247 GENERIC  amd64

I checked out the source using git:
# cd /usr
# rm -rf obj
# mv src old-src-12
# git clone -o freebsd -b stable/13 --depth 1 https://git.freebsd.org/src.git src 
Cloning into 'src'...
remote: Enumerating objects: 88802, done.
remote: Counting objects: 100% (88802/88802), done.
remote: Compressing objects: 100% (76293/76293), done.
remote: Total 88802 (delta 18824), reused 48105 (delta 9295), pack-reused 0
Receiving objects: 100% (88802/88802), 259.08 MiB | 9.85 MiB/s, done.
Resolving deltas: 100% (18824/18824), done.
Updating files: 100% (85295/85295), done. 

This got me commit 6f6c6480047ba1ebbc398c1052446e35f8a4ecab.
But trying to build the world failed in the bootstrap tools:

# env -i make buildworld
make[1]: "/usr/src/Makefile.inc1" line 341: SYSTEM_COMPILER: libclang will be built for bootstrapping a cross-compiler./src/Makefile.inc1" line 346: SYSTEM_LINKER: libclang will be built for bootstrapping a cross-linker.----------------------------------------------------
>>> World build started on Tue Mar  2 15:22:55 CET 2021
--------------------------------------------------------------

--------------------------------------------------------------
>>> Rebuilding the temporary build tree
--------------------------------------------------------------
rm -rf /usr/obj/usr/src/amd64.amd64/tmp
cd /usr/src/tools/build;  make DIRPRFX=tools/build/ DESTDIR=/usr/obj/usr/src/amd64.amd64/tmp/legacy installdirs/src/sys/sys/elf64.h /usr/src/sys/sys/elf_common.h /usr/src/sys/sys/elf_generic.h /usr/src/sys/sys/queue.h /usr/src/sys/sys/md5.h /usr/src/sys/sys/sbuf.h /usr/src/sys/sys/tree.h /usr/src/sys/sys/font.h /usr/src/sys/sys/consio.h /usr/src/sys/sys/fnv_hash.h /usr/src/sys/sys/elf.h /usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/include/sys/
sh /usr/src/tools/install.sh  -C -o root -g wheel -m 444  /usr/src/lib/libcasper/services/cap_fileargs/cap_fileargs.h /usr/src/lib/libcasper/services/cap_net/cap_net.h /usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/include/casper/
sh /usr/src/tools/install.sh  -C -o root -g wheel -m 444  /usr/src/sys/ufs/ufs/dinode.h /usr/src/sys/ufs/ufs/dir.h /usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/include/ufs/ufs/
sh /usr/src/tools/install.sh  -C -o root -g wheel -m 444  /usr/src/sys/ufs/ffs/fs.h /usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/include/ufs/ffs/
sh /usr/src/tools/install.sh  -C -o root -g wheel -m 444  /usr/src/sys/fs/msdosfs/bootsect.h /usr/src/sys/fs/msdosfs/bpb.h /usr/src/sys/fs/msdosfs/denode.h /usr/src/sys/fs/msdosfs/direntry.h /usr/src/sys/fs/msdosfs/fat.h /usr/src/sys/fs/msdosfs/msdosfsmount.h /usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/include/fs/msdosfs/
sh /usr/src/tools/install.sh  -C -o root -g wheel -m 444  /usr/src/sys/sys/disk/bsd.h /usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/include/sys/disk/
sh /usr/src/tools/install.sh  -C -o root -g wheel -m 444  /usr/src/sys/amd64/include/elf.h /usr/src/sys/amd64/include/exec.h /usr/src/sys/amd64/include/reloc.h /usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/include/machine/
sh /usr/src/tools/install.sh  -C -o root -g wheel -m 444  /usr/src/sys/rpc/types.h /usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/include/rpc/
sh /usr/src/tools/install.sh  -C -o root -g wheel -m 444  /usr/src/sys/crypto/chacha20/_chacha.h /usr/src/sys/crypto/chacha20/chacha.h /usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/include/crypto/chacha20/
sh /usr/src/tools/install.sh  -C -o root -g wheel -m 444  /usr/src/sys/x86/include/elf.h /usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/include/x86/
cc  -O2 -pipe -fno-common -I/usr/src/tools/build/libc-bootstrap  -MD  -MF.depend.dummy.o -MTdummy.o -std=gnu99 -Wno-format-zero-length  -Wsystem-headers -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wcast-align -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls -Wold-style-definition -Wno-pointer-sign -Wmissing-variable-declarations -Wthread-safety -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable  -Qunused-arguments    -I/usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/include -c /usr/src/tools/build/dummy.c -o dummy.o
building static egacy library
ar -crsD libegacy.a dummy.o
sh /usr/src/tools/install.sh  -C -o root -g wheel -m 444   libegacy.a /usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/lib/
mkdir -p /usr/obj/usr/src/amd64.amd64/tmp/legacy/bin /usr/obj/usr/src/amd64.amd64/tmp/legacy/lib/casper /usr/obj/usr/src/amd64.amd64/tmp/legacy/lib/geom /usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/include/casper /usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/include/private/ucl /usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/include/private/zstd /usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/lib /usr/obj/usr/src/amd64.amd64/tmmkdir -p /usr/obj/usr/src/amd64.amd64/tmp/legacy/bin /usr/obj/usr/src/amd64.amd64/tmp/legacy/lib/casper /usr/obj/usr/src/amd64.amd64/tmp/legacy/lib/geom /usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/include/casper /usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/include/private/ucl /usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/include/private/zstd /usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/lib /usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/libexec
ln -sfn bin /usr/obj/usr/src/amd64.amd64/tmp/legacy/sbin
ln -sfn ../bin /usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/bin
ln -sfn ../bin /usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/sbin
mkdir -p "/usr/obj/usr/src/amd64.amd64/tmp/legacy//usr/include/sys"
mkdir -p "/usr/obj/usr/src/amd64.amd64/tmp/legacy//usr/include/casper"
mkdir -p "/usr/obj/usr/src/amd64.amd64/tmp/legacy//usr/include/ufs/ufs"
mkdir -p "/usr/obj/usr/src/amd64.amd64/tmp/legacy//usr/include/ufs/ffs"
mkdir -p "/usr/obj/usr/src/amd64.amd64/tmp/legacy//usr/include/fs/msdosfs"
mkdir -p "/usr/obj/usr/src/amd64.amd64/tmp/legacy//usr/include/sys/disk"
mkdir -p "/usr/obj/usr/src/amd64.amd64/tmp/legacy//usr/include/machine"
mkdir -p "/usr/obj/usr/src/amd64.amd64/tmp/legacy//usr/include/rpc"
mkdir -p "/usr/obj/usr/src/amd64.amd64/tmp/legacy//usr/include/crypto/chacha20"
mkdir -p "/usr/obj/usr/src/amd64.amd64/tmp/legacy//usr/include/x86"

--------------------------------------------------------------
>>> stage 1.2: bootstrap tools
--------------------------------------------------------------
cd /usr/src; INSTALL="sh /usr/src/tools/install.sh"  TOOLS_PREFIX=/usr/obj/usr/src/amd64.amd64/tmp  PATH=/usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/sbin:/usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/bin:/usr/obj/usr/src/amd64.amd64/tmp/legacy/bin:/usr/obj/usr/src/amd64.amd64/tmp/legacy/usr/libexec:/sbin:/bin:/usr/sbin:/usr/bin  WORLDTMP=/usr/obj/usr/src/amd64.amd64/tmp  MAKEFLAGS="-m /usr/src/tools/build/mk  -m /usr/src/share/mk" make  -f Makefile.inc1  DESTDIR=  OBJTOP='/usr/obj/usr/src/amd64.amd64/tmp/obj-tools'  OBJROOT='${OBJTOP}/'  MAKEOBJDIRPREFIX=  BOOTSTRAPPING=1202503  BWPHASE=bootstrap-tools  SSP_CFLAGS=  MK_HTML=no NO_LINT=yes MK_MAN=no MK_MAN_UTILS=yes  -DNO_PIC MK_PROFILE=no -DNO_SHARED  -DNO_CPU_CFLAGS MK_WERROR=no MK_CTF=no  MK_CLANG_EXTRAS=no MK_CLANG_FORMAT=no MK_CLANG_FULL=no  MK_LLDB=no MK_RETPOLINE=no MK_TESTS=no  MK_INCLUDES=yes MK_LLVM_TARGET_ALL=no bootstrap-tools
*** Error code 1
*** Error code 1
*** Error code 1

I removed /etc/src.conf and /etc/make.conf, but that made no difference.
Comment 1 rsmith 2021-03-03 10:41:43 UTC
Some more information; I ran the makeworld build again with the -de flag and got:

*** Failed target:  _bootstrap-tools-link-kbdcontrol
*** Failed command: rm -f "/usr/obj/usr/src/amd64.amd64/tmp/legacy/bin/kbdcontrol"; source_path=`which kbdcontrol`; if [ ! -e "${source_path}" ] ; then echo "Cannot find host tool 'kbdcontrol'"; false; fi; cp -pf "${source_path}" "/usr/obj/usr/src/amd64.amd64/tmp/legacy/bin/kbdcontrol"
*** Error code 1

This is probably caused by the fact that my current 12.2 system is built with WITHOUT_LEGACY_CONSOLE=true.

After manually building and installing kbdcontrol, the build started.

This might need a note in the release notes.