Is ccache broken in distcc compilation mode?
Created by: zhuowei
Ccache doesn't seem to work inside a chroot with distcc enabled.
To reproduce: Build kwin, weston, or any other large package twice for aarch64.
Expected: Second build is blazingly fast, with no distcc invocations as all the built files should be cached
Actual: Second build same speed as the first build; looking at the distcc log shows that it's still invoked on all the files
This post suggests that, to allow distcc and ccache to work together, one should use the CCACHE_PREFIX environmental variable instead of just adding them together in the PATH, which is what we do right now. I'm not sure if that information is accurate for our ccache and distcc wrapper setups, though.
Edit: no, CCACHE_PREFIX doesn't work; it compiles x86 executables instead for some reason.
Edit 2: https://wiki.gentoo.org/wiki/Distcc#With_automake seems to have a working solution: ccache must go before distcc in the path. This seems to work.
Edit 3: Adding ccache to the front of the path does make ccache cache distcc outputs: before the change, my distccd.log shows that all files are recompiled at each build; after the change, distccd.log only shows files being compiled on the first compile.
This however doesn't seem to have an effect on compile time: building weston
took 11 minutes without ccache and 10 minutes with ccache on my computer. I suspect the effect would be stronger for C++ packages such as kwin.
I have not compared with the old code, so I'm not sure if my change actually makes a difference though.