Bug 257616 - WITH_META_MODE=yes, toolchain is rebuilt each make buildworld
Summary: WITH_META_MODE=yes, toolchain is rebuilt each make buildworld
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: misc (show other bugs)
Version: 13.0-STABLE
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-08-04 13:11 UTC by Oleh Vinichenko
Modified: 2021-10-16 12:51 UTC (History)
2 users (show)

See Also:


Attachments
src.conf used for buildworld (449 bytes, text/plain)
2021-08-04 16:49 UTC, Oleh Vinichenko
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Oleh Vinichenko 2021-08-04 13:11:38 UTC
i run stable/13 from git with world rebuilds, when it feels necessary and WITH_META_MODE=yes.
each make buildworld appears rebuilding whole toolchain stack, even if no any changes to toolchain made in src.
This has not been observed on 12.2. Alternatively, i tried, building world with CROSS_TOOLCHAIN=llvm-@version, and WITHOUT_TOOLCHAIN=yes, next rebuild, if tried, takes only minutes, which is a desired behavior.
Comment 1 Oleh Vinichenko 2021-08-04 15:52:56 UTC
there were no cleaning of /usr/obj, so that it stays with *.meta files from previous build
Comment 2 Oleh Vinichenko 2021-08-04 16:49:16 UTC
Created attachment 226949 [details]
src.conf used for buildworld
Comment 3 Mark Millard 2021-08-04 18:42:53 UTC
I'll note that if

#define __FreeBSD_version

in src/tree/sys/sys/param.h has changed, rebuilds
are expected behavior. So I'm assuming that has
not changed.

Are you saying that the following wort of sequence
rebuilds the toolchain 3 times?

# cd /usr/src/
# env WITH_META_MODE=yes make buildworld
# env WITH_META_MODE=yes make buildworld
# env WITH_META_MODE=yes make buildworld

Note that lack of any other activity between buildworld's.
I do not expect the above would rebuild the toolchain
3 times.

By constrast it is expected that the below sort of
sequence will rebuild (or relink) more than the
the above would overall:

# cd /usr/src/
# env WITH_META_MODE=yes make buildworld
# env WITH_META_MODE=yes make installworld
# env WITH_META_MODE=yes make buildworld
# env WITH_META_MODE=yes make installworld
# env WITH_META_MODE=yes make buildworld

This is because the installworld activity will update
file dates on files that WITH_META_MODE checks as an
example of a dependency. WITH_META_MODE has some examples
of dependency recording that could be avoided with
appropriate safety. An example would be avoiding checking
in the rm command having been updated, even when rm was
used in the command sequence for regenerating a file.

You may need to be more explicit about your sequence of
steps that leads to the rebuilds that you object to.
Comment 4 Oleh Vinichenko 2021-08-04 19:08:09 UTC
my case would be results that are from two consecutive buildworld such as in your example 1 scenario. i did not try 3 times in a row. i will retest this more thoroughly. indeed, after installworld step, buildworld takes slightly more time which is expected, from your explanation, but i had no full llvm/clang rebuild on version 12.2. i will report back asap.
Comment 5 Mark Millard 2021-08-04 20:46:15 UTC
(In reply to Oleh Vinichenko from comment #4)

Note that if the old/prior /usr/src vs. new /usr/src
did have a change to

#define __FreeBSD_version

that the rebuild is expected each time --until after
the update is installed so that it then matches the
update /usr/src content.

You did not comment on if there was a change to
__FreeBSD_version involved or not.

The test of:

# cd /usr/src/
# env WITH_META_MODE=yes make buildworld
# env WITH_META_MODE=yes make buildworld
# env WITH_META_MODE=yes make buildworld

should be for the installed __FreeBSD_version already
matching the value in /usr/src/tree/sys/sys/param.h .

(I've made a presumption of the default /usr/src place.
You might be using some other path.)
Comment 6 Mark Millard 2021-08-04 21:09:08 UTC
(In reply to Mark Millard from comment #5)

Actually, my wording has in general made a presumption
about prior activity that need not be the case.

A sequence that avoids the presumption is:

# cd /usr/src/
# env WITH_META_MODE=yes make buildworld
# env WITH_META_MODE=yes make installworld
# env WITH_META_MODE=yes make buildworld
## no more rebuilds below?
# env WITH_META_MODE=yes make buildworld
# env WITH_META_MODE=yes make buildworld

The installworld establishes the updated compiler
version is in place, so also matching /usr/src
for the version number and such.

The first buildworld after that may have the
usual issues with some rebuilding based on changes
to dependencies from the installworld activity.

After that the version should match /usr/src and the
dependencies should no longer cause rebuild/relink
activity.
Comment 7 Oleh Vinichenko 2021-08-05 08:14:18 UTC
ok, so correct report from me had to be, that toolchain is rebuilt completely after installworld, while i understand why it could be the case, it seems excessive, when no changes in /usr/src happened (i.e, no git pull, etc ...). If such behavior is by design, then this report can be closed as expected, no problems with that.

with building world from scratch:
>>> World built in 5134 seconds, ncpu: 8, make -j8

with building world, just right after first one finished:
>>> World built in 64 seconds, ncpu: 8, make -j8 # good :)

after installing world (notice, that nothing done in /usr/src at all):
>>> World built in 3238 seconds, ncpu: 8, make -j8
most of time is llvm rebuild
Comment 8 Herbert J. Skuhra 2021-08-05 08:27:53 UTC
This was discussed on the current mailing list:

https://lists.freebsd.org/pipermail/freebsd-current/2021-January/078488.html

I guess we need a separate build server/jail/VM which isn't updated frequently.
Comment 9 Oleh Vinichenko 2021-10-16 12:51:53 UTC
I guess this can be closed as not really a problem ( for my concerns ), mentioned mailing list providing good explantion, thank you