On Thu, 2007-09-06 at 18:51 +0100, José Matos wrote: > I am not reticent. I am still compiling. :-( > > That is why I like André's goal to reduce the compile time. Does anyone has > some simple step by step procedure to make ccache (or any other compiler > cache) work. It is really frustrating to almost recompile lyx everytime there > is a new update. :-(
Check out gcc's new precompiled header functionality. http://gcc.gnu.org/onlinedocs/gcc/Precompiled-Headers.html Basically gcc-3.4 and newer allow you to dump the state of the compiler to disc after your headers are compiled, and then load it in place of those headers, saving you most of the compile time. The catch is you have to include exactly the same headers in the same order with all the same options, in order for the pre-compiled image to be used. So you might create an all.h header which #includes most of the headers you expect to use, and then the first thing each .cpp does is #include "all.h". Now the compiler can grab the pre-compiled version of that and skip all the headers. Of course this means often including things you wouldn't have otherwise included, for consistency, but lets face it the reason for not including something is usually to speed up compilation in the first place. I remember Andrew Tridgell (Samba) giving us a talk on it just after another person demoed distcc, a distributed gcc. By using precompiled headers, Tridge was able to compile Samba-4 faster on one machine than distcc on multiple machines. I think that lends a lot of support to the idea of a single include which pulls in most of the other includes, and precompiling it. One can mix and match the two methods for compatibility, see the above link. Have fun, Darren