On Wed, Dec 07, 2022 at 08:34:20AM +1030, Andrew Jeffery wrote: > On Wed, 7 Dec 2022, at 01:24, Andy Shevchenko wrote: > > On Mon, Dec 05, 2022 at 07:55:29PM +0100, Bartosz Golaszewski wrote: > >> On Mon, Dec 5, 2022 at 2:22 PM Andrew Jeffery <andrew@xxxxxxxx> wrote: ... > >> > Meson defaults to using ninja as its backend, and automatically exploits > >> > ccache[2] when available to keep repeated builds speedy. > > > > ...which is a bad idea for a clean build. > > > >> It does show! Full rebuild with autotools: > >> > >> real 0m43,902s > >> user 2m40,010s > >> sys 0m20,172s > >> > >> Full rebuild with meson: > >> > >> real 0m10,001s > >> user 1m1,334s > >> sys 0m12,205s > >> > >> More than 4x faster now. > > > > And risk to have a badly formed binaries (yes, very little risk, but > 0). > > > >> > [2] https://ccache.dev/ > > > > ccache has downside of its own use. If we have a common storage for ccache -- > > the collision is just matter of time (yes, have seen that in real life). > > > > OTOH requiring per-project ccache storage makes a little sense for the end user > > as they quite likely won't rebuild it many times. > > Valid points. However I think they're addressed by: > > 1. Not installing ccache on the system, or > 2. Overriding the auto-detection behaviour of `meson setup ...` > > Regarding 2, you can specify the CC and CXX environment variables to force its hand: > > ``` > $ command -v ccache > /usr/bin/ccache > $ CC=cc CXX=c++ meson setup -Dbindings=cxx build > The Meson build system > Version: 0.63.0 > ... > C compiler for the host machine: cc (gcc 12.2.0 "cc (Ubuntu 12.2.0-3ubuntu1) 12.2.0") > ... > C++ compiler for the host machine: c++ (gcc 12.2.0 "c++ (Ubuntu 12.2.0-3ubuntu1) 12.2.0") > ... > ``` > > Compared to the default behaviour: > > ``` > $ meson setup -Dbindings=cxx build > The Meson build system > Version: 0.63.0 > ... > C compiler for the host machine: ccache cc (gcc 12.2.0 "cc (Ubuntu 12.2.0-3ubuntu1) 12.2.0") > ... > C++ compiler for the host machine: ccache c++ (gcc 12.2.0 "c++ (Ubuntu 12.2.0-3ubuntu1) 12.2.0") > ... > ``` > > This use of the CC and CXX variables is covered in the documentation: > > https://mesonbuild.com/Feature-autodetection.html#ccache Right, my point that ccache should be opt-in and not opt-out. For example, Buidroot project has ccache support (as opt-in). -- With Best Regards, Andy Shevchenko