[mythtv] Using ccache for native builds in win32 build script

Lawrence Rust lvr at softsystem.co.uk
Mon Feb 21 10:12:14 UTC 2011


On Sat, 2011-02-19 at 23:21 +0100, Jonathan Martens wrote:
> Lawrence, e.a.,
> 
> I have been trying to implement ccache in building under MinGW as 
> recompiling takes quite some time, since this can be installed natively 
> on Linux when cross compiling I think this tweak is only needed when 
> compiling under MinGW on Windows.

Yes, ccache is a nice addition.

> For now I have been using a relatively old version of ccache and 
> additional patches as provided at https://github.com/ramiropolla/ccache 
> as that is the only version I have been able to get to compile under 
> MinGW until now.

[snip]

> Apart from that the time make takes also decreases drastically:
> 
> First build:
> 
> make
> ...
> make[2]: Leaving directory `/home/Administrator/mythbuild/yasm-1.1.0'
> make[1]: Leaving directory `/home/Administrator/mythbuild/yasm-1.1.0'
> 
> real    1m29.219s
> user    0m9.676s
> sys     0m15.329s
> 
> Subsequent build:
> 
> make
> ...
> make[2]: Leaving directory `/home/Administrator/mythbuild/yasm-1.1.0'
> make[1]: Leaving directory `/home/Administrator/mythbuild/yasm-1.1.0'
> 
> real    0m29.672s
> user    0m9.041s
> sys     0m15.143s
> 
> The total compilation time is reduced with about a minute (~60%) on a 
> minute and a half.

That's very significant reduction for Yasm.  Do you have any figures for
MythTV and the plugins?

>  Imagine what that could do for long builds like Qt 
> when rebuilding with the -C option.

I'm not sure that using ccache for the Qt build would be useful.  In a
normal environment Qt is built just once,  There should be relatively
few times when a clean build is necessary.  In those cases using ccache
could actually slow the build due to ccache saving the intermediates.

> Since I was already tracking Lawrence Rust changes in my personal github 
> clone I also created a branch for the new changes.
> 
> You can download the latest version of Lawrence Rust's script including 
> my ccache addition at:
> 
> https://github.com/jmartens/packaging/raw/win32-build-script-ccache/Win32/build/mythbuild.sh

Grabbed a copy and tried it.  Nice.

I see that you create wrapper scripts for cpp, c++, gcc and g++  which
means that ccache will be used for every compilation.  I can see the
advantage for MythTV, but most of the other libs are only built once.
Adding a ccache wrapper to these one-off builds might actually slow
things down.  For instance the default max cache size is 1GB but the
mythbuild folder (including mysql & Qt but not mythtv) is 3.5G.  This is
likely to lead to thrashing.

In normal usage (repetitive MythTV rebuilds), ccache is detected by
mythtv/configure so the wrapper scripts aren't necessary.  For
repetitive 'clean' builds, the wrapper scripts might be counter
productive unless the ccache setup is tweaked somewhat.  The gains will
be very dependent on available system memory and disk space/performance.

Incidentally, I got bored manually updating the script and patch
archives so I setup a git repo for them about 2 weeks ago.  You can find
it here:

git clone http://www.softsystem.co.uk/git/mythbuilder.git

For normal use I symlink the script and patches to the folder where I
build mythtv.

-- Lawrence




More information about the mythtv-dev mailing list