Re: FYI: Why META_MODE rebuilds so much for building again after installworld (no source changes)
Date: Thu, 23 Feb 2023 22:34:57 UTC
Mark Millard <marklmi@yahoo.com> wrote: > [External Email. Be cautious of content] > > > [Note for "how many separate bmake instances are in that log?": > I do not know how to tell how many submakes are run total. It > was with -j32 on the threadripper 1950X, if that is was you > were after.] You can get a clue from the number of directories being built - each will have its own instance of bmake. > > Per my last response, I'd be pretty sure MAKEOBJDIR is incorrect. > > Which still leaves me experimenting to find a correct > reference. Do you know notation will always lead to the > same absolute path with the proper /usr/obj/BUILDs/*/usr/main-src/*.*/ > prefix ? (I've been showing just the main-amd64-nodbg-clang > and amd64.amd64 combination but there are many more.) I would question why you care. What is wrong with ${OBJTOP} ? Hmm, this does not look promising actually: grep '^OBJTOP' share/mk/*mk share/mk/bsd.obj.mk:OBJTOP?= ${MAKEOBJDIR} share/mk/bsd.obj.mk:OBJTOP?= ${.OBJDIR:S,${.CURDIR},,}${SRCTOP} share/mk/local.meta.sys.mk:OBJTOP:= ${OBJROOT}${TARGET_OBJ_SPEC} share/mk/local.meta.sys.mk:OBJTOP := ${HOST_OBJTOP} share/mk/local.sys.mk:OBJTOP?= ${.OBJDIR:S,${.CURDIR},,}${SRCTOP} share/mk/src.sys.obj.mk:OBJTOP:= ${OBJROOT}${TARGET}.${TARGET_ARCH} share/mk/src.sys.obj.mk:OBJTOP:= ${OBJROOT:H} share/mk/src.sys.obj.mk:OBJTOP:= ${OBJROOT}${MACHINE}.${MACHINE_ARCH} share/mk/src.sys.obj.mk:OBJTOP:= ${OBJROOT:H} share/mk/src.sys.obj.mk:OBJTOP:= ${MAKEOBJDIRPREFIX}${SRCTOP} share/mk/src.sys.obj.mk:OBJTOP= ${SRCTOP} Without full context, apart from local.meta.sys.mk some of the above looks highly dubious In some respects the BSD build provides way too much flexibility. About 20 years ago at Juniper we found it untenable to continue allowing users 4 different options for the relationship between their srcs and objects. So we simply mandated: SRCTOP= ${SB}/src OBJROOT= ${SB}/obj/ OBJTOP= ${OBJROOT}/${MACHINE}/ MAKEOBJDIR= ${.CURDIR:S,${SRCTOP},${OBJTOP},} and life was better, but in a project like FreeBSD you cannot imposed your will that way ;-) > >>>>> .MAKE.META.IGNORE_PATHS+= ${OBJTOP}/tmp/ > >>>> > >>>> (Ignoring the variability of OBJTOP issue . . .) > >>>> > >>>> I do not expect that would work: ignoring things > >>>> it likely should not. > >>> > >>> Sure, but it may be useful as an experiment to ensure things are > >>> behaving as expected. > >> > >> As a test: > >> > >> .if ${.MAKE.LEVEL} == 0 > >> .MAKE.META.IGNORE_PATHS+= ${MAKEOBJDIR:tA}/tmp/ > >> .MAKE.META.IGNORE_PATHS:= ${.MAKE.META.IGNORE_PATHS} > >> .endif > > > > Lose the .if ${.MAKE.LEVEL} == 0 > > it is almost certainly keeping things from working as expected. > > What do you want tested instead of MAKEOBJDIR ? I would expect you want ${OBJTOP} (assuming a sane value for OBJTOP ;-) > I'm taking a guess (no .MAKE.LEVEL use): Correct. > > .MAKE.META.IGNORE_PATHS+= ${OBJTOP:tA}/tmp/ > .MAKE.META.IGNORE_PATHS:= ${.MAKE.META.IGNORE_PATHS:tA} You do not want to apply :tA to everything. .MAKE.META.IGNORE_PATHS+= ${OBJTOP}/tmp/ ${OBJTOP:tA}/tmp/ should be valid. > > > >> I still get things like: > >> > >> /usr/obj/BUILDs/main-amd64-nodbg-clang/usr/main-src/amd64.amd64/sys/GENERIC-NODBG/modules/usr/main-src/sys/modules/zlib/x86.meta: 23: file '/usr/obj/BUILDs/main-amd64-nodbg-clang/usr/main-src/amd64.amd64/tmp/legacy/usr/sbin/realpath' is newer than the target... and is OBJTOP /usr/obj/BUILDs/main-amd64-nodbg-clang/usr/main-src/amd64.amd64 ? > >> Building /usr/obj/BUILDs/main-amd64-nodbg-clang/usr/main-src/amd64.amd64/sys/GENERIC-NODBG/modules/usr/main-src/sys/modules/zlib/x86 > > > > Because that will not be level 0 and so .MAKE.META.IGNORE_PATHS is not > > set. > > I tried the above and I still get (picking to look for > tmp/legacy/usr/sbin/ln examples): > > /usr/obj/BUILDs/main-amd64-nodbg-clang/usr/main-src/amd64.amd64/sys/GENERIC-NODBG/modules/usr/main-src/sys/modules/aac/opt_scsi.h.meta: 22: file '/usr/obj/BUILDs/main-amd64-nodbg-clang/usr/main-src/amd64.amd64/tmp/legacy/usr/sbin/ln' is newer than the target... Its a bit messy with kernels since there isn't a src directory associated with each (in FreeBSD anyway) but you could add the following to one of the makefiles that will be in play: .info ${.CURDIR .OBJDIR OBJTOP .MAKE.META.IGNORE_PATHS:L:@v@${.newline}$v=${$v}@} to help you see what is going on. It should then be easy to see whether OBJTOP is covered by .MAKE.META.IGNORE_PATHS