[OpenWrt-Devel] [PATCH] build: improve ccache support
Roman Yeryomin
roman at advem.lv
Tue Jun 2 08:21:38 EDT 2020
On 2020-06-01 21:34, Michael Jones wrote:
> On Mon, Jun 1, 2020 at 1:22 PM Felix Fietkau <nbd at nbd.name> wrote:
>
>> On 2020-06-01 19:11, Michael Jones wrote:
>> >
>> >
>> > On Mon, Jun 1, 2020 at 10:33 AM Roman Yeryomin <roman at advem.lv
>> > <mailto:roman at advem.lv>> wrote:
>> >
>> > Set CCACHE_DIR to $(TOPDIR)/.ccache and CCACHE_BASEDIR to $(TOPDIR).
>> > This allows to do clean and dirclean. Cache hit rate for test build
>> > after dirclean is ~65%.
>> > If CCACHE is enabled stats are printed out at the end of building
>> > process.
>> >
>> > Signed-off-by: Roman Yeryomin <roman at advem.lv <mailto:roman at advem.lv
>> >>
>> >
>> >
>> > This certainly looks like an improvement.
>> >
>> > However, there is an important usage case that this change doesn't
>> address.
>> >
>> > Frequently when I am working on OpenWRT related things, I have many
>> > different workspaces all tied to the same git repository hosted
>> > externally. The reason for this is to allow multiple builds to live and
>> > run independently.
>> >
>> > Having the CCACHE_DIR be located *inside* the repository doesn't share
>> > the cache between multiple workspaces.
>> >
>> > So can the CCACHE_DIR be made configurable at build time based on the
>> > .config file? Perhaps it can default to this, and only be set to the
>> > value in .config if provided? For my purposes, I would always set the
>> > CCACHE_DIR to a path that all of my workspaces use.
>> I don't think there's a need for that config option. You could simply
>> add a .ccache symlink in your source dir and point it to your shared
>> cache. I do the same with dl on my trees.
>>
>> - Felix
>>
>
> I disagree.
>
> Having build behavior change based on a symlink is undesirable.
>
> If it were a config option, it becomes a documented feature that is
> easily
> discoverable in the menu config.
>
> Additionally, having the ccache directory be a configuration option
> allows
> it to persist across clones of the git repository, if the .config file
> is
> stored in git. A symlink would need to be manually re-configured on
> each
> clone.
I agree with Felix. Having one ccache directory for multiple repos
doesn't make much sense to me as most probably they are for different
platforms. And even if they are for same platform there are more chances
for ccache corruption and deleting it will affect all those repos. So it
still can be done with symlink but IMO should be done manually to make
sure you know what you are doing.
Also BASEDIR should be changed too, probably, if we want to go that way.
Regards,
Roman
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list