On my laptop I have WIP that has TIOCSTI removed. tcsh supports this (with `#ifdef TIOCSTI` in its source). However, buildworld failed in tcsh: .../contrib/tcsh/sh.set.c:761:15: error: use of undeclared identifier 'STRfilec' 761 | if (adrof(STRfilec) == 0) | ^ tc.const.h is generated via (bin/csh/Makefile): tc.const.h: tc.const.c sh.char.h config.h config_f.h sh.types.h sh.err.h ${BUILD_TOOLS_META} @rm -f ${.TARGET} @echo '/* Do not edit this file, make creates it. */' > ${.TARGET} @echo '#ifndef _h_tc_const' >> ${.TARGET} @echo '#define _h_tc_const' >> ${.TARGET} ${CC:N${CCACHE_BIN}} -E ${CFLAGS:C/-DHAVE_ICONV//} ${.ALLSRC} -D_h_tc_const | \ grep 'Char STR' | \ sed -e 's/Char \([a-zA-Z0-9_]*\)\(.*\)/extern Char \1[];/' | \ sort >> ${.TARGET} @echo '#endif /* _h_tc_const */' >> ${.TARGET} This uses the host's headers which in my case do not define TIOCSTI, and as a result there's no definition for STRfilec (comparing stock build on ref14-amd64.freebsd with one on my machine): $ diff -purw bin/csh/ref-obj/ bin/csh/obj/ | egrep -v 'Only in|Binary files' diff -purw bin/csh/ref-obj/tc.const.h bin/csh/obj/tc.const.h --- bin/csh/ref-obj/tc.const.h 2024-12-11 17:17:29.000000000 -0500 +++ bin/csh/obj/tc.const.h 2024-12-11 18:13:33.439537000 -0500 @@ -122,7 +122,6 @@ extern Char STRfignore[]; extern Char STRfakecom1[]; extern Char STRfakecom[]; extern Char STRfignore[]; -extern Char STRfilec[]; extern Char STRgid[]; extern Char STRglobdot[]; extern Char STRglobstar[];
^Triage: tag this as having an inline patch so the automated tools can find it.
(The diff above is showing the error, it is not a patch to be applied.)
This dates to the original "BSD 4.4 Lite bin Sources" commit, 4b88c807ea9c629dc5691abc7e3cac9ea0d776dd.
I'm not sure exactly what's happening here. If I delete all tc.const.h (find <objdir> -name tc.const.h -print -delete) followed by `make buildworld` tc.const.h is not generated correctly (for either bin/csh or rescue/rescue). But I think we should be getting the right path via --sysroot in CC. In the buildenv environment I do see CC=cc -target x86_64-unknown-freebsd15.0 --sysroot=/usr/obj/.../amd64.amd64/tmp -B/usr/obj/.../amd64.amd64/tmp/usr/bin I tried deleting all tc.const.h and then running `make buildenv` followed by `make -C bin/csh` and tc.const.h is indeed generated correctly.
Oh, I see. tc.const.h is being generated in ">>> stage 2.3: build tools" which does not have the --sysroot set. From the bin/csh/Makefile: --- build-tools: gethost tc.defs.c: gethost DEPENDOBJS+= gethost gethost: gethost.c sh.err.h tc.const.h sh.h ${BUILD_TOOLS_META} --- so we build tc.const.h as a dependency of gethost as a stage 2.3 build tool, but for tc.const.h to be correct we need the target headers from stage 4.1.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=ed8b456f82ed822652f2abb24d65ab73ac3dbb0a commit ed8b456f82ed822652f2abb24d65ab73ac3dbb0a Author: Ed Maste <emaste@FreeBSD.org> AuthorDate: 2025-02-07 01:23:47 +0000 Commit: Ed Maste <emaste@FreeBSD.org> CommitDate: 2025-02-09 00:30:55 +0000 csh: Remove gethost dependency on tc.const.h gethost is a build tool built in stage 2.3, but it had a dependency on tc.const.h, which requires target headers (that are not installed until stage 4.1). The build falls back to the host's headers if the target headers don't yet exist, which may result in a build failure if the host's headers don't match the target. As gethost.c doesn't actually require the definitions in tc.const.h, add a hack to skip the include of tc.const.h and remove the dependency. PR: 283273 Reviewed by: imp Sponsored by: The FreeBSD Foundation Fixes: e754e5f36195 ("Upgrade to 6.10") Differential Revision: https://reviews.freebsd.org/D48880 bin/csh/Makefile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
^Triage: set flags for possible MFCs (just close if not).