Bug 269366 - installworld calls cc breaking nanobsd build
Summary: installworld calls cc breaking nanobsd build
Status: Closed Not A Bug
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 13.1-STABLE
Hardware: amd64 Any
: --- Affects Some People
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-02-06 09:33 UTC by Eugene Grosbein
Modified: 2023-02-27 17:20 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eugene Grosbein freebsd_committer freebsd_triage 2023-02-06 09:33:57 UTC
I have new motherboard that supports BIOS/Legacy CSM with discrete PCIe videocard only; with Intel video it boots in UEFI mode only. First, extra videocard was added and I successfully rebuilt my nanobsd image using fresh stable/13 amd64 source tree, and it boots just fine in BIOS mode.

Now I try to switch it to UEFI boot mode adding NANO_LAYOUT=std-uefi-bios to nanobsd config but now it fails building image at installworld stage due to non-existing compiler in the built world (WITHOUT_CLANG, WITHOUT_CPP, WITHOUT_GCC, WITHOUT_OBJC, WITHOUT_SYSTEM_COMPILER etc.):

===> stand/i386/loader_4th (install)
cc -target x86_64-unknown-freebsd13.2 --sysroot=/home/obj/nanobsd.setup/home/src/amd64.amd64/tmp -B
/home/obj/nanobsd.setup/home/src/amd64.amd64/tmp/usr/bin  -O2 -pipe -fno-common   -I/home/src/stand
/i386/btx/lib -nostdinc    -I/home/obj/nanobsd.setup/home/src/amd64.amd64/stand/libsa32 -I/home/src
/stand/libsa -D_STANDALONE -I/home/src/sys -Ddouble=jagged-little-pill -Dfloat=floaty-mcfloatface -
ffunction-sections -fdata-sections -DLOADER_GELI_SUPPORT -I/home/src/stand/libsa/geli -DLOADER_DISK
_SUPPORT -m32 -ffreestanding -mno-mmx -mno-sse -mno-avx -mno-avx2 -msoft-float -march=i386 -mno-rel
ax -I. -Iinclude -I/home/src/stand/common -I/home/src/stand/ficl -I/home/src/stand/ficl/i386 -I/hom
e/src/stand/common -DBF_DICTSIZE=30000 -DLOADER_CD9660_SUPPORT -DLOADER_EXT2FS_SUPPORT -DLOADER_MSD
OS_SUPPORT -DLOADER_UFS_SUPPORT -DLOADER_GZIP_SUPPORT -DLOADER_NET_SUPPORT -DLOADER_NFS_SUPPORT -DL
OADER_TFTP_SUPPORT -DLOADER_GPT_SUPPORT -DLOADER_MBR_SUPPORT -DLOADER_ZFS_SUPPORT -I/home/src/stand
/libsa/zfs -I/home/src/sys/cddl/boot/zfs -I/home/src/sys/cddl/contrib/opensolaris/uts/common -Wall
-I/home/src/stand/i386 -DLOADER_PREFER_AMD64 -DNDEBUG  -std=gnu99 -Wno-format-zero-length -nobuilti
ninc -idirafter /usr/lib/clang/14.0.5/include -Wsystem-headers -Wno-pointer-sign -Wno-empty-body -W
no-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-p
arameter -Wno-parentheses  -Oz -Qunused-arguments -I/home/src/sys/contrib/openzfs/include -I/home/s
rc/sys/contrib/openzfs/include/os/freebsd/zfs   ERROR-tried-to-rebuild-during-make-install -c /home
/src/stand/i386/loader/main.c -o main.o
/tmp/install.3p4xVTZ8/sh: cc: not found
*** Error code 127

Stop.
Comment 1 Warner Losh freebsd_committer freebsd_triage 2023-02-07 03:26:51 UTC
The usual cause of this error is updating sources, changing the build options (Which changes the command line, which can cause rebuilds in meta modes), or accidentally using the wrong obj repo... In bygone days, nfs time-skew also could be a problem...
Comment 2 Eugene Grosbein freebsd_committer freebsd_triage 2023-02-08 02:01:07 UTC
(In reply to Warner Losh from comment #1)

Thank you for a hint. It appeared that one should not switch NANO_LAYOUT without obj cleaning. I removed obj and restarted my build from scratch, and it completed successfully.
Comment 3 Eugene Grosbein freebsd_committer freebsd_triage 2023-02-08 03:29:29 UTC
(In reply to Warner Losh from comment #1)

May I suggest to change default for NANO_OBJ to depend on NANO_LAYOUT? Add a suffix .${NANO_LAYOUT} if NANO_LAYOUT not empty.

=: ${NANO_OBJ:=/usr/obj/nanobsd.${NANO_NAME}}
+: ${NANO_OBJ:=/usr/obj/nanobsd.${NANO_NAME}${NANO_LAYOUT:+.${NANO_LAYOUT}}

So first change to NANO_LAYOUT would not break build like in my case. And keep already populated obj intact so it could be reused if needed with another nanobsd config file.
Comment 4 Warner Losh freebsd_committer freebsd_triage 2023-02-08 23:24:14 UTC
I like it. I'll commit it to head soonish.
Comment 5 commit-hook freebsd_committer freebsd_triage 2023-02-27 17:20:06 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=cbf64e2dd59c3579c49acbc52659eaa1ddceb557

commit cbf64e2dd59c3579c49acbc52659eaa1ddceb557
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2023-02-08 23:19:49 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2023-02-27 17:18:59 +0000

    nanobsd: Better NANO_OBJ if NANO_LAYOUT is set

    If NANO_LAYOUT is set, then use /usr/obj/nanobsd.${NANO_NAME}.${NANO_LAYOUT}
    instead of the current /usr/obj/nanobsd.${NANO_NAME} to allow multiple layouts
    to be built w/o errors due to the time-skew that creates.

    PR: 269366
    Suggested by: Eugene Grosbein
    Sponsored by: Netflix

 tools/tools/nanobsd/defaults.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)