1899
|
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
|
|
2 <HTML>
|
|
3 <HEAD>
|
|
4 <TITLE>ccache</TITLE>
|
|
5 </HEAD>
|
|
6 <BODY BGCOLOR="#ffffff" TEXT="#000000" VLINK="#292555" LINK="#292555" ALINK="#cc0033">
|
|
7 <h2>ccache</h2>
|
|
8
|
|
9 ccache is a compiler cache. It acts as a caching pre-processor to
|
|
10 C/C++ compilers, using the -E compiler switch and a hash to detect
|
|
11 when a compilation can be satisfied from cache. This often results in
|
|
12 a 5 to 10 times speedup in common compilations.<p>
|
|
13
|
|
14 The idea came from Erik Thiele wrote the original <a
|
|
15 href="http://compilercache.sourceforge.net/">compilercache</a> program
|
|
16 as a bourne shell script. ccache is a re-implementation of Erik's idea
|
|
17 in C with more features and better performance.<p>
|
|
18
|
|
19 <h2>Latest release</h2>
|
|
20
|
|
21 The latest release is ccache 2.4.
|
|
22
|
|
23 <ul>
|
|
24 <li>Added CCACHE_READONLY option
|
|
25 <li>Added CCACHE_TEMPDIR option
|
|
26 <li>fixed handling of hard-linked compilers on AIX
|
|
27 <li>added O_BINARY support, to try and support win32 compiles
|
|
28 <li>show cache directory in stats output
|
|
29 <li>fixed handling of HOME environment variable
|
|
30 </ul>
|
|
31
|
|
32 See the <a href="ccache-man.html">manual page</a> for details
|
|
33 on the new options.<p>
|
|
34
|
|
35 You can get this release from the <a href="http://ccache.samba.org/ftp/ccache/">download directory</a>
|
|
36
|
|
37 <p>NOTE! This release changes the hash input slighly, so you will
|
|
38 probably find that you will not get any hits against your existing
|
|
39 cache when you upgrade.
|
|
40
|
|
41 <h2>Why bother?</h2>
|
|
42
|
|
43 Why bother with a compiler cache? If you ever run "make clean; make"
|
|
44 then you can probably benefit from ccache. It is very common for
|
|
45 developers to do a clean build of a project for a whole host of
|
|
46 reasons, and this throws away all the information from your previous
|
|
47 compiles.<p>
|
|
48
|
|
49 By using ccache you can get exactly the same effect as "make clean;
|
|
50 make" but much faster. It also helps a lot when doing RPM builds,
|
|
51 as RPM can make doing incremental builds tricky.<p>
|
|
52
|
|
53 I put the effort into writing ccache for 2 reasons. The first is the
|
|
54 Samba build farm
|
|
55 (<a href="http://build.samba.org/">http://build.samba.org/</a>)
|
|
56 which constantly does clean builds of Samba on about 30 machines after each
|
|
57 CVS commit. On some of those machines the build took over an hour. By
|
|
58 using ccache we get the same effect as clean builds but about 6 times
|
|
59 faster.<p>
|
|
60
|
|
61 The second reason is the autobuild system I used to run for
|
|
62 Quantum. That system builds our whole Linux based OS from scratch
|
|
63 after every CVS commit to catch compilation problems quickly. Using
|
|
64 ccache those builds are much faster.
|
|
65
|
|
66 <h2>Is it safe?</h2>
|
|
67
|
|
68 Yes. The most important aspect of a compiler cache is to <b>always</b>
|
|
69 produce exactly the same output that the real compiler would
|
|
70 produce. The includes providing exactly the same object files and
|
|
71 exactly the same compiler warnings that would be produced if you use
|
|
72 the real compiler. The only way you should be able to tell that you
|
|
73 are using ccache is the speed.<p>
|
|
74
|
|
75 I have coded ccache very carefully to try to provide these guarantees.
|
|
76
|
|
77 <h2>Features</h2>
|
|
78
|
|
79 <ul>
|
|
80 <li> keeps statistics on hits/misses
|
|
81 <li> automatic cache size management
|
|
82 <li> can cache compiles that generate warnings
|
|
83 <li> easy installation
|
|
84 <li> very low overhead
|
|
85 <li> uses hard links where possible to avoid copies
|
|
86 </ul>
|
|
87
|
|
88 <h2>Documentation</h2>
|
|
89
|
|
90 See the <a href="ccache-man.html">manual page</a>
|
|
91
|
|
92
|
|
93 <h2>Performance</h2>
|
|
94
|
|
95 Here are some results for compiling Samba on my Linux laptop. I have
|
|
96 also included the results of using Erik's compilercache program
|
|
97 (version 1.0.10) for comparison.<p>
|
|
98
|
|
99 <table border=1>
|
|
100 <tr><th> </th> <th> ccache</th> <th> compilercache</th> </tr>
|
|
101 <tr><td>normal </td> <td align=right>13m 4s </td><td align=right>13m 4s</td> </tr>
|
|
102 <tr><td>uncached </td> <td align=right>13m 15s </td><td align=right>15m 41s</td> </tr>
|
|
103 <tr><td>cached </td> <td align=right>2m 45s </td><td align=right>4m 26s</td> </tr>
|
|
104 </table>
|
|
105
|
|
106 <h2>How to use it</h2>
|
|
107
|
|
108 You can use ccache in two ways. The first is just to prefix your
|
|
109 compile commands with "ccache". For example, you could change the
|
|
110 "CC=gcc" line in your Makefile to be "CC=ccache gcc".<p>
|
|
111
|
|
112 Alternatively, you can create symbolic links from your compilers name
|
|
113 to ccache. This allows you to use ccache without any changes to your
|
|
114 build system.
|
|
115
|
|
116 <h2>Download</h2>
|
|
117
|
|
118 You can download the latest release from the <a
|
|
119 href="http://ccache.samba.org/ftp/ccache/">download directory</a>.<p>
|
|
120
|
|
121 For the bleeding edge, you can fetch ccache via CVS or
|
|
122 rsync. To fetch via cvs use the following command:
|
|
123
|
|
124 <pre>
|
|
125 cvs -d :pserver:cvs@pserver.samba.org:/cvsroot co ccache
|
|
126 </pre>
|
|
127
|
|
128 To fetch via rsync use this command:
|
|
129
|
|
130 <pre>
|
|
131 rsync -Pavz samba.org::ftp/unpacked/ccache .
|
|
132 </pre>
|
|
133
|
|
134 <h2>Related projects</h2>
|
|
135
|
|
136 Here are some related programs you may find interesting
|
|
137
|
|
138 <ul>
|
|
139 <li> <a href="http://distcc.samba.org/">distcc</a> - a distributed compilation system
|
|
140 <li> <a href="http://cachecc1.sourceforge.net/">cachecc1</a> - a gcc specific cache
|
|
141 <li> <a href="http://sourceforge.net/projects/gocache/">gocache</a> - a cross platform compiler cache
|
|
142 </ul>
|
|
143 <p>
|
|
144
|
|
145 <h2>Mailing list</h2>
|
|
146
|
|
147 <p>A <a href="http://lists.samba.org/mailman/listinfo/ccache/">mailing
|
|
148 list</a> is available for discussion of ccache.
|
|
149
|
|
150
|
|
151 <hr>
|
|
152 <tiny>
|
|
153 <a href="http://samba.org/~tridge/">Andrew Tridgell</a><br>
|
|
154 <a href="mailto:bugs@ccache.samba.org">bugs@ccache.samba.org</a>
|
|
155 </tiny>
|
|
156
|
|
157 </BODY>
|
|
158 </HTML>
|