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.