📄 index.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"><HTML><HEAD><TITLE>ccache</TITLE></HEAD><BODY BGCOLOR="#ffffff" TEXT="#000000" VLINK="#292555" LINK="#292555" ALINK="#cc0033"><h2>ccache</h2>ccache is a compiler cache. It acts as a caching pre-processor toC/C++ compilers, using the -E compiler switch and a hash to detectwhen a compilation can be satisfied from cache. This often results ina 5 to 10 times speedup in common compilations.<p>The idea came from Erik Thiele wrote the original <ahref="http://compilercache.sourceforge.net/">compilercache</a> programas a bourne shell script. ccache is a re-implementation of Erik's ideain C with more features and better performance.<p><h2>Latest release</h2>The latest release is ccache 2.3.<ul><li>Added CCACHE_UMASK option<li>Added support for compilation of .i files<li>Fixed bug with DEPENDENCIES_OUTPUT flag<li>Added support for more -Mx options<li>Added separate stderr channel for distcc<li>Improved test suite</ul>See the <a href="/ccache/ccache-man.html">manual page</a> for detailson the new options.You can get this release from the <a href="/ftp/ccache/">download directory</a> <h2>Why bother?</h2>Why bother with a compiler cache? If you ever run "make clean; make"then you can probably benefit from ccache. It is very common fordevelopers to do a clean build of a project for a whole host ofreasons, and this throws away all the information from your previouscompiles.<p>By using ccache you can get exactly the same effect as "make clean;make" but much faster. It also helps a lot when doing RPM builds,as RPM can make doing incremental builds tricky.<p>I put the effort into writing ccache for 2 reasons. The first is theSamba build farm (<a href="http://build.samba.org/">http://build.samba.org/</a>) which constantly does clean builds of Samba on about 30 machines after eachCVS commit. On some of those machines the build took over an hour. Byusing ccache we get the same effect as clean builds but about 6 timesfaster.<p>The second reason is the autobuild system I used to run forQuantum. That system builds our whole Linux based OS from scratchafter every CVS commit to catch compilation problems quickly. Usingccache those builds are much faster.<h2>Is it safe?</h2>Yes. The most important aspect of a compiler cache is to <b>always</b>produce exactly the same output that the real compiler wouldproduce. The includes providing exactly the same object files andexactly the same compiler warnings that would be produced if you usethe real compiler. The only way you should be able to tell that youare using ccache is the speed.<p>I have coded ccache very carefully to try to provide these guarantees.<h2>Features</h2><ul><li> keeps statistics on hits/misses<li> automatic cache size management<li> can cache compiles that generate warnings<li> easy installation<li> very low overhead<li> uses hard links where possible to avoid copies</ul><h2>Documentation</h2>See the <a href="/ccache/ccache-man.html">manual page</a><h2>Performance</h2>Here are some results for compiling Samba on my Linux laptop. I havealso included the results of using Erik's compilercache program(version 1.0.10) for comparison.<p><table border=1><tr><th> </th> <th> ccache</th> <th> compilercache</th> </tr><tr><td>normal </td> <td align=right>13m 4s </td><td align=right>13m 4s</td> </tr><tr><td>uncached </td> <td align=right>13m 15s </td><td align=right>15m 41s</td> </tr><tr><td>cached </td> <td align=right>2m 45s </td><td align=right>4m 26s</td> </tr></table><h2>How to use it</h2>You can use ccache in two ways. The first is just to prefix yourcompile commands with "ccache". For example, you could change the"CC=gcc" line in your Makefile to be "CC=ccache gcc".<p>Alternatively, you can create symbolic links from your compilers nameto ccache. This allows you to use ccache without any changes to yourbuild system.<h2>Download</h2>You can download the latest release from the <ahref="/ftp/ccache/">download directory</a>.<p>For the bleeding edge, you can fetch ccache via CVS orrsync. To fetch via cvs use the following command:<pre> cvs -d :pserver:cvs@pserver.samba.org:/cvsroot co ccache</pre>To fetch via rsync use this command:<pre> rsync -Pavz samba.org::ftp/unpacked/ccache .</pre><h2>Related projects</h2>Here are some related programs you may find interesting<ul><li> <a href="http://distcc.samba.org/">distcc</a> - a distributed compilation system</ul><p><h2>Mailing list</h2><p>A <a href="http://lists.samba.org/mailman/listinfo/ccache/">mailinglist</a> is available for discussion of ccache.<hr><tiny><a href="http://samba.org/~tridge/">Andrew Tridgell</a><br><a href="mailto:bugs@ccache.samba.org">bugs@ccache.samba.org</a></tiny></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -