Imported Upstream version 3.4
[platform/upstream/ccache.git] / MANUAL.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"\r
2     "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">\r
3 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">\r
4 <head>\r
5 <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />\r
6 <meta name="generator" content="AsciiDoc 8.6.9" />\r
7 <title>CCACHE(1)</title>\r
8 <style type="text/css">\r
9 /* Shared CSS for AsciiDoc xhtml11 and html5 backends */\r
10 \r
11 /* Default font. */\r
12 body {\r
13   font-family: Georgia,serif;\r
14 }\r
15 \r
16 /* Title font. */\r
17 h1, h2, h3, h4, h5, h6,\r
18 div.title, caption.title,\r
19 thead, p.table.header,\r
20 #toctitle,\r
21 #author, #revnumber, #revdate, #revremark,\r
22 #footer {\r
23   font-family: Arial,Helvetica,sans-serif;\r
24 }\r
25 \r
26 body {\r
27   margin: 1em 5% 1em 5%;\r
28 }\r
29 \r
30 a {\r
31   color: blue;\r
32   text-decoration: underline;\r
33 }\r
34 a:visited {\r
35   color: fuchsia;\r
36 }\r
37 \r
38 em {\r
39   font-style: italic;\r
40   color: navy;\r
41 }\r
42 \r
43 strong {\r
44   font-weight: bold;\r
45   color: #083194;\r
46 }\r
47 \r
48 h1, h2, h3, h4, h5, h6 {\r
49   color: #527bbd;\r
50   margin-top: 1.2em;\r
51   margin-bottom: 0.5em;\r
52   line-height: 1.3;\r
53 }\r
54 \r
55 h1, h2, h3 {\r
56   border-bottom: 2px solid silver;\r
57 }\r
58 h2 {\r
59   padding-top: 0.5em;\r
60 }\r
61 h3 {\r
62   float: left;\r
63 }\r
64 h3 + * {\r
65   clear: left;\r
66 }\r
67 h5 {\r
68   font-size: 1.0em;\r
69 }\r
70 \r
71 div.sectionbody {\r
72   margin-left: 0;\r
73 }\r
74 \r
75 hr {\r
76   border: 1px solid silver;\r
77 }\r
78 \r
79 p {\r
80   margin-top: 0.5em;\r
81   margin-bottom: 0.5em;\r
82 }\r
83 \r
84 ul, ol, li > p {\r
85   margin-top: 0;\r
86 }\r
87 ul > li     { color: #aaa; }\r
88 ul > li > * { color: black; }\r
89 \r
90 .monospaced, code, pre {\r
91   font-family: "Courier New", Courier, monospace;\r
92   font-size: inherit;\r
93   color: navy;\r
94   padding: 0;\r
95   margin: 0;\r
96 }\r
97 pre {\r
98   white-space: pre-wrap;\r
99 }\r
100 \r
101 #author {\r
102   color: #527bbd;\r
103   font-weight: bold;\r
104   font-size: 1.1em;\r
105 }\r
106 #email {\r
107 }\r
108 #revnumber, #revdate, #revremark {\r
109 }\r
110 \r
111 #footer {\r
112   font-size: small;\r
113   border-top: 2px solid silver;\r
114   padding-top: 0.5em;\r
115   margin-top: 4.0em;\r
116 }\r
117 #footer-text {\r
118   float: left;\r
119   padding-bottom: 0.5em;\r
120 }\r
121 #footer-badges {\r
122   float: right;\r
123   padding-bottom: 0.5em;\r
124 }\r
125 \r
126 #preamble {\r
127   margin-top: 1.5em;\r
128   margin-bottom: 1.5em;\r
129 }\r
130 div.imageblock, div.exampleblock, div.verseblock,\r
131 div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,\r
132 div.admonitionblock {\r
133   margin-top: 1.0em;\r
134   margin-bottom: 1.5em;\r
135 }\r
136 div.admonitionblock {\r
137   margin-top: 2.0em;\r
138   margin-bottom: 2.0em;\r
139   margin-right: 10%;\r
140   color: #606060;\r
141 }\r
142 \r
143 div.content { /* Block element content. */\r
144   padding: 0;\r
145 }\r
146 \r
147 /* Block element titles. */\r
148 div.title, caption.title {\r
149   color: #527bbd;\r
150   font-weight: bold;\r
151   text-align: left;\r
152   margin-top: 1.0em;\r
153   margin-bottom: 0.5em;\r
154 }\r
155 div.title + * {\r
156   margin-top: 0;\r
157 }\r
158 \r
159 td div.title:first-child {\r
160   margin-top: 0.0em;\r
161 }\r
162 div.content div.title:first-child {\r
163   margin-top: 0.0em;\r
164 }\r
165 div.content + div.title {\r
166   margin-top: 0.0em;\r
167 }\r
168 \r
169 div.sidebarblock > div.content {\r
170   background: #ffffee;\r
171   border: 1px solid #dddddd;\r
172   border-left: 4px solid #f0f0f0;\r
173   padding: 0.5em;\r
174 }\r
175 \r
176 div.listingblock > div.content {\r
177   border: 1px solid #dddddd;\r
178   border-left: 5px solid #f0f0f0;\r
179   background: #f8f8f8;\r
180   padding: 0.5em;\r
181 }\r
182 \r
183 div.quoteblock, div.verseblock {\r
184   padding-left: 1.0em;\r
185   margin-left: 1.0em;\r
186   margin-right: 10%;\r
187   border-left: 5px solid #f0f0f0;\r
188   color: #888;\r
189 }\r
190 \r
191 div.quoteblock > div.attribution {\r
192   padding-top: 0.5em;\r
193   text-align: right;\r
194 }\r
195 \r
196 div.verseblock > pre.content {\r
197   font-family: inherit;\r
198   font-size: inherit;\r
199 }\r
200 div.verseblock > div.attribution {\r
201   padding-top: 0.75em;\r
202   text-align: left;\r
203 }\r
204 /* DEPRECATED: Pre version 8.2.7 verse style literal block. */\r
205 div.verseblock + div.attribution {\r
206   text-align: left;\r
207 }\r
208 \r
209 div.admonitionblock .icon {\r
210   vertical-align: top;\r
211   font-size: 1.1em;\r
212   font-weight: bold;\r
213   text-decoration: underline;\r
214   color: #527bbd;\r
215   padding-right: 0.5em;\r
216 }\r
217 div.admonitionblock td.content {\r
218   padding-left: 0.5em;\r
219   border-left: 3px solid #dddddd;\r
220 }\r
221 \r
222 div.exampleblock > div.content {\r
223   border-left: 3px solid #dddddd;\r
224   padding-left: 0.5em;\r
225 }\r
226 \r
227 div.imageblock div.content { padding-left: 0; }\r
228 span.image img { border-style: none; vertical-align: text-bottom; }\r
229 a.image:visited { color: white; }\r
230 \r
231 dl {\r
232   margin-top: 0.8em;\r
233   margin-bottom: 0.8em;\r
234 }\r
235 dt {\r
236   margin-top: 0.5em;\r
237   margin-bottom: 0;\r
238   font-style: normal;\r
239   color: navy;\r
240 }\r
241 dd > *:first-child {\r
242   margin-top: 0.1em;\r
243 }\r
244 \r
245 ul, ol {\r
246     list-style-position: outside;\r
247 }\r
248 ol.arabic {\r
249   list-style-type: decimal;\r
250 }\r
251 ol.loweralpha {\r
252   list-style-type: lower-alpha;\r
253 }\r
254 ol.upperalpha {\r
255   list-style-type: upper-alpha;\r
256 }\r
257 ol.lowerroman {\r
258   list-style-type: lower-roman;\r
259 }\r
260 ol.upperroman {\r
261   list-style-type: upper-roman;\r
262 }\r
263 \r
264 div.compact ul, div.compact ol,\r
265 div.compact p, div.compact p,\r
266 div.compact div, div.compact div {\r
267   margin-top: 0.1em;\r
268   margin-bottom: 0.1em;\r
269 }\r
270 \r
271 tfoot {\r
272   font-weight: bold;\r
273 }\r
274 td > div.verse {\r
275   white-space: pre;\r
276 }\r
277 \r
278 div.hdlist {\r
279   margin-top: 0.8em;\r
280   margin-bottom: 0.8em;\r
281 }\r
282 div.hdlist tr {\r
283   padding-bottom: 15px;\r
284 }\r
285 dt.hdlist1.strong, td.hdlist1.strong {\r
286   font-weight: bold;\r
287 }\r
288 td.hdlist1 {\r
289   vertical-align: top;\r
290   font-style: normal;\r
291   padding-right: 0.8em;\r
292   color: navy;\r
293 }\r
294 td.hdlist2 {\r
295   vertical-align: top;\r
296 }\r
297 div.hdlist.compact tr {\r
298   margin: 0;\r
299   padding-bottom: 0;\r
300 }\r
301 \r
302 .comment {\r
303   background: yellow;\r
304 }\r
305 \r
306 .footnote, .footnoteref {\r
307   font-size: 0.8em;\r
308 }\r
309 \r
310 span.footnote, span.footnoteref {\r
311   vertical-align: super;\r
312 }\r
313 \r
314 #footnotes {\r
315   margin: 20px 0 20px 0;\r
316   padding: 7px 0 0 0;\r
317 }\r
318 \r
319 #footnotes div.footnote {\r
320   margin: 0 0 5px 0;\r
321 }\r
322 \r
323 #footnotes hr {\r
324   border: none;\r
325   border-top: 1px solid silver;\r
326   height: 1px;\r
327   text-align: left;\r
328   margin-left: 0;\r
329   width: 20%;\r
330   min-width: 100px;\r
331 }\r
332 \r
333 div.colist td {\r
334   padding-right: 0.5em;\r
335   padding-bottom: 0.3em;\r
336   vertical-align: top;\r
337 }\r
338 div.colist td img {\r
339   margin-top: 0.3em;\r
340 }\r
341 \r
342 @media print {\r
343   #footer-badges { display: none; }\r
344 }\r
345 \r
346 #toc {\r
347   margin-bottom: 2.5em;\r
348 }\r
349 \r
350 #toctitle {\r
351   color: #527bbd;\r
352   font-size: 1.1em;\r
353   font-weight: bold;\r
354   margin-top: 1.0em;\r
355   margin-bottom: 0.1em;\r
356 }\r
357 \r
358 div.toclevel0, div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {\r
359   margin-top: 0;\r
360   margin-bottom: 0;\r
361 }\r
362 div.toclevel2 {\r
363   margin-left: 2em;\r
364   font-size: 0.9em;\r
365 }\r
366 div.toclevel3 {\r
367   margin-left: 4em;\r
368   font-size: 0.9em;\r
369 }\r
370 div.toclevel4 {\r
371   margin-left: 6em;\r
372   font-size: 0.9em;\r
373 }\r
374 \r
375 span.aqua { color: aqua; }\r
376 span.black { color: black; }\r
377 span.blue { color: blue; }\r
378 span.fuchsia { color: fuchsia; }\r
379 span.gray { color: gray; }\r
380 span.green { color: green; }\r
381 span.lime { color: lime; }\r
382 span.maroon { color: maroon; }\r
383 span.navy { color: navy; }\r
384 span.olive { color: olive; }\r
385 span.purple { color: purple; }\r
386 span.red { color: red; }\r
387 span.silver { color: silver; }\r
388 span.teal { color: teal; }\r
389 span.white { color: white; }\r
390 span.yellow { color: yellow; }\r
391 \r
392 span.aqua-background { background: aqua; }\r
393 span.black-background { background: black; }\r
394 span.blue-background { background: blue; }\r
395 span.fuchsia-background { background: fuchsia; }\r
396 span.gray-background { background: gray; }\r
397 span.green-background { background: green; }\r
398 span.lime-background { background: lime; }\r
399 span.maroon-background { background: maroon; }\r
400 span.navy-background { background: navy; }\r
401 span.olive-background { background: olive; }\r
402 span.purple-background { background: purple; }\r
403 span.red-background { background: red; }\r
404 span.silver-background { background: silver; }\r
405 span.teal-background { background: teal; }\r
406 span.white-background { background: white; }\r
407 span.yellow-background { background: yellow; }\r
408 \r
409 span.big { font-size: 2em; }\r
410 span.small { font-size: 0.6em; }\r
411 \r
412 span.underline { text-decoration: underline; }\r
413 span.overline { text-decoration: overline; }\r
414 span.line-through { text-decoration: line-through; }\r
415 \r
416 div.unbreakable { page-break-inside: avoid; }\r
417 \r
418 \r
419 /*\r
420  * xhtml11 specific\r
421  *\r
422  * */\r
423 \r
424 div.tableblock {\r
425   margin-top: 1.0em;\r
426   margin-bottom: 1.5em;\r
427 }\r
428 div.tableblock > table {\r
429   border: 3px solid #527bbd;\r
430 }\r
431 thead, p.table.header {\r
432   font-weight: bold;\r
433   color: #527bbd;\r
434 }\r
435 p.table {\r
436   margin-top: 0;\r
437 }\r
438 /* Because the table frame attribute is overriden by CSS in most browsers. */\r
439 div.tableblock > table[frame="void"] {\r
440   border-style: none;\r
441 }\r
442 div.tableblock > table[frame="hsides"] {\r
443   border-left-style: none;\r
444   border-right-style: none;\r
445 }\r
446 div.tableblock > table[frame="vsides"] {\r
447   border-top-style: none;\r
448   border-bottom-style: none;\r
449 }\r
450 \r
451 \r
452 /*\r
453  * html5 specific\r
454  *\r
455  * */\r
456 \r
457 table.tableblock {\r
458   margin-top: 1.0em;\r
459   margin-bottom: 1.5em;\r
460 }\r
461 thead, p.tableblock.header {\r
462   font-weight: bold;\r
463   color: #527bbd;\r
464 }\r
465 p.tableblock {\r
466   margin-top: 0;\r
467 }\r
468 table.tableblock {\r
469   border-width: 3px;\r
470   border-spacing: 0px;\r
471   border-style: solid;\r
472   border-color: #527bbd;\r
473   border-collapse: collapse;\r
474 }\r
475 th.tableblock, td.tableblock {\r
476   border-width: 1px;\r
477   padding: 4px;\r
478   border-style: solid;\r
479   border-color: #527bbd;\r
480 }\r
481 \r
482 table.tableblock.frame-topbot {\r
483   border-left-style: hidden;\r
484   border-right-style: hidden;\r
485 }\r
486 table.tableblock.frame-sides {\r
487   border-top-style: hidden;\r
488   border-bottom-style: hidden;\r
489 }\r
490 table.tableblock.frame-none {\r
491   border-style: hidden;\r
492 }\r
493 \r
494 th.tableblock.halign-left, td.tableblock.halign-left {\r
495   text-align: left;\r
496 }\r
497 th.tableblock.halign-center, td.tableblock.halign-center {\r
498   text-align: center;\r
499 }\r
500 th.tableblock.halign-right, td.tableblock.halign-right {\r
501   text-align: right;\r
502 }\r
503 \r
504 th.tableblock.valign-top, td.tableblock.valign-top {\r
505   vertical-align: top;\r
506 }\r
507 th.tableblock.valign-middle, td.tableblock.valign-middle {\r
508   vertical-align: middle;\r
509 }\r
510 th.tableblock.valign-bottom, td.tableblock.valign-bottom {\r
511   vertical-align: bottom;\r
512 }\r
513 \r
514 \r
515 /*\r
516  * manpage specific\r
517  *\r
518  * */\r
519 \r
520 body.manpage h1 {\r
521   padding-top: 0.5em;\r
522   padding-bottom: 0.5em;\r
523   border-top: 2px solid silver;\r
524   border-bottom: 2px solid silver;\r
525 }\r
526 body.manpage h2 {\r
527   border-style: none;\r
528 }\r
529 body.manpage div.sectionbody {\r
530   margin-left: 3em;\r
531 }\r
532 \r
533 @media print {\r
534   body.manpage div#toc { display: none; }\r
535 }\r
536 \r
537 \r
538 </style>\r
539 <script type="text/javascript">\r
540 /*<![CDATA[*/\r
541 var asciidoc = {  // Namespace.\r
542 \r
543 /////////////////////////////////////////////////////////////////////\r
544 // Table Of Contents generator\r
545 /////////////////////////////////////////////////////////////////////\r
546 \r
547 /* Author: Mihai Bazon, September 2002\r
548  * http://students.infoiasi.ro/~mishoo\r
549  *\r
550  * Table Of Content generator\r
551  * Version: 0.4\r
552  *\r
553  * Feel free to use this script under the terms of the GNU General Public\r
554  * License, as long as you do not remove or alter this notice.\r
555  */\r
556 \r
557  /* modified by Troy D. Hanson, September 2006. License: GPL */\r
558  /* modified by Stuart Rackham, 2006, 2009. License: GPL */\r
559 \r
560 // toclevels = 1..4.\r
561 toc: function (toclevels) {\r
562 \r
563   function getText(el) {\r
564     var text = "";\r
565     for (var i = el.firstChild; i != null; i = i.nextSibling) {\r
566       if (i.nodeType == 3 /* Node.TEXT_NODE */) // IE doesn't speak constants.\r
567         text += i.data;\r
568       else if (i.firstChild != null)\r
569         text += getText(i);\r
570     }\r
571     return text;\r
572   }\r
573 \r
574   function TocEntry(el, text, toclevel) {\r
575     this.element = el;\r
576     this.text = text;\r
577     this.toclevel = toclevel;\r
578   }\r
579 \r
580   function tocEntries(el, toclevels) {\r
581     var result = new Array;\r
582     var re = new RegExp('[hH]([1-'+(toclevels+1)+'])');\r
583     // Function that scans the DOM tree for header elements (the DOM2\r
584     // nodeIterator API would be a better technique but not supported by all\r
585     // browsers).\r
586     var iterate = function (el) {\r
587       for (var i = el.firstChild; i != null; i = i.nextSibling) {\r
588         if (i.nodeType == 1 /* Node.ELEMENT_NODE */) {\r
589           var mo = re.exec(i.tagName);\r
590           if (mo && (i.getAttribute("class") || i.getAttribute("className")) != "float") {\r
591             result[result.length] = new TocEntry(i, getText(i), mo[1]-1);\r
592           }\r
593           iterate(i);\r
594         }\r
595       }\r
596     }\r
597     iterate(el);\r
598     return result;\r
599   }\r
600 \r
601   var toc = document.getElementById("toc");\r
602   if (!toc) {\r
603     return;\r
604   }\r
605 \r
606   // Delete existing TOC entries in case we're reloading the TOC.\r
607   var tocEntriesToRemove = [];\r
608   var i;\r
609   for (i = 0; i < toc.childNodes.length; i++) {\r
610     var entry = toc.childNodes[i];\r
611     if (entry.nodeName.toLowerCase() == 'div'\r
612      && entry.getAttribute("class")\r
613      && entry.getAttribute("class").match(/^toclevel/))\r
614       tocEntriesToRemove.push(entry);\r
615   }\r
616   for (i = 0; i < tocEntriesToRemove.length; i++) {\r
617     toc.removeChild(tocEntriesToRemove[i]);\r
618   }\r
619 \r
620   // Rebuild TOC entries.\r
621   var entries = tocEntries(document.getElementById("content"), toclevels);\r
622   for (var i = 0; i < entries.length; ++i) {\r
623     var entry = entries[i];\r
624     if (entry.element.id == "")\r
625       entry.element.id = "_toc_" + i;\r
626     var a = document.createElement("a");\r
627     a.href = "#" + entry.element.id;\r
628     a.appendChild(document.createTextNode(entry.text));\r
629     var div = document.createElement("div");\r
630     div.appendChild(a);\r
631     div.className = "toclevel" + entry.toclevel;\r
632     toc.appendChild(div);\r
633   }\r
634   if (entries.length == 0)\r
635     toc.parentNode.removeChild(toc);\r
636 },\r
637 \r
638 \r
639 /////////////////////////////////////////////////////////////////////\r
640 // Footnotes generator\r
641 /////////////////////////////////////////////////////////////////////\r
642 \r
643 /* Based on footnote generation code from:\r
644  * http://www.brandspankingnew.net/archive/2005/07/format_footnote.html\r
645  */\r
646 \r
647 footnotes: function () {\r
648   // Delete existing footnote entries in case we're reloading the footnodes.\r
649   var i;\r
650   var noteholder = document.getElementById("footnotes");\r
651   if (!noteholder) {\r
652     return;\r
653   }\r
654   var entriesToRemove = [];\r
655   for (i = 0; i < noteholder.childNodes.length; i++) {\r
656     var entry = noteholder.childNodes[i];\r
657     if (entry.nodeName.toLowerCase() == 'div' && entry.getAttribute("class") == "footnote")\r
658       entriesToRemove.push(entry);\r
659   }\r
660   for (i = 0; i < entriesToRemove.length; i++) {\r
661     noteholder.removeChild(entriesToRemove[i]);\r
662   }\r
663 \r
664   // Rebuild footnote entries.\r
665   var cont = document.getElementById("content");\r
666   var spans = cont.getElementsByTagName("span");\r
667   var refs = {};\r
668   var n = 0;\r
669   for (i=0; i<spans.length; i++) {\r
670     if (spans[i].className == "footnote") {\r
671       n++;\r
672       var note = spans[i].getAttribute("data-note");\r
673       if (!note) {\r
674         // Use [\s\S] in place of . so multi-line matches work.\r
675         // Because JavaScript has no s (dotall) regex flag.\r
676         note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[1];\r
677         spans[i].innerHTML =\r
678           "[<a id='_footnoteref_" + n + "' href='#_footnote_" + n +\r
679           "' title='View footnote' class='footnote'>" + n + "</a>]";\r
680         spans[i].setAttribute("data-note", note);\r
681       }\r
682       noteholder.innerHTML +=\r
683         "<div class='footnote' id='_footnote_" + n + "'>" +\r
684         "<a href='#_footnoteref_" + n + "' title='Return to text'>" +\r
685         n + "</a>. " + note + "</div>";\r
686       var id =spans[i].getAttribute("id");\r
687       if (id != null) refs["#"+id] = n;\r
688     }\r
689   }\r
690   if (n == 0)\r
691     noteholder.parentNode.removeChild(noteholder);\r
692   else {\r
693     // Process footnoterefs.\r
694     for (i=0; i<spans.length; i++) {\r
695       if (spans[i].className == "footnoteref") {\r
696         var href = spans[i].getElementsByTagName("a")[0].getAttribute("href");\r
697         href = href.match(/#.*/)[0];  // Because IE return full URL.\r
698         n = refs[href];\r
699         spans[i].innerHTML =\r
700           "[<a href='#_footnote_" + n +\r
701           "' title='View footnote' class='footnote'>" + n + "</a>]";\r
702       }\r
703     }\r
704   }\r
705 },\r
706 \r
707 install: function(toclevels) {\r
708   var timerId;\r
709 \r
710   function reinstall() {\r
711     asciidoc.footnotes();\r
712     if (toclevels) {\r
713       asciidoc.toc(toclevels);\r
714     }\r
715   }\r
716 \r
717   function reinstallAndRemoveTimer() {\r
718     clearInterval(timerId);\r
719     reinstall();\r
720   }\r
721 \r
722   timerId = setInterval(reinstall, 500);\r
723   if (document.addEventListener)\r
724     document.addEventListener("DOMContentLoaded", reinstallAndRemoveTimer, false);\r
725   else\r
726     window.onload = reinstallAndRemoveTimer;\r
727 }\r
728 \r
729 }\r
730 asciidoc.install(2);\r
731 /*]]>*/\r
732 </script>\r
733 </head>\r
734 <body class="article">\r
735 <div id="header">\r
736 <h1>CCACHE(1)</h1>\r
737 <span id="revnumber">version 3.4</span>\r
738 <div id="toc">
739   <div id="toctitle">Table of Contents</div>
740   <noscript><p><b>JavaScript must be enabled in your browser to display the table of contents.</b></p></noscript>
741 </div>\r
742 </div>\r
743 <div id="content">\r
744 <div class="sect1">\r
745 <h2 id="_name">Name</h2>\r
746 <div class="sectionbody">\r
747 <div class="paragraph"><p>ccache - a fast C/C++ compiler cache</p></div>\r
748 </div>\r
749 </div>\r
750 <div class="sect1">\r
751 <h2 id="_synopsis">Synopsis</h2>\r
752 <div class="sectionbody">\r
753 <div class="verseblock">\r
754 <pre class="content"><strong>ccache</strong> [<em>options</em>]\r
755 <strong>ccache</strong> <em>compiler</em> [<em>compiler options</em>]\r
756 <em>compiler</em> [<em>compiler options</em>]                   (via symbolic link)</pre>\r
757 <div class="attribution">\r
758 </div></div>\r
759 </div>\r
760 </div>\r
761 <div class="sect1">\r
762 <h2 id="_description">Description</h2>\r
763 <div class="sectionbody">\r
764 <div class="paragraph"><p>ccache is a compiler cache. It speeds up recompilation by caching the result of\r
765 previous compilations and detecting when the same compilation is being done\r
766 again. Supported languages are C, C++, Objective-C and Objective-C++.</p></div>\r
767 <div class="paragraph"><p>ccache has been carefully written to always produce exactly the same compiler\r
768 output that you would get without the cache. The only way you should be able to\r
769 tell that you are using ccache is the speed. Currently known exceptions to this\r
770 goal are listed under <a href="#_caveats">CAVEATS</a>. If you ever discover an\r
771 undocumented case where ccache changes the output of your compiler, please let\r
772 us know.</p></div>\r
773 <div class="sect2">\r
774 <h3 id="_features">Features</h3>\r
775 <div class="ulist"><ul>\r
776 <li>\r
777 <p>\r
778 Keeps statistics on hits/misses.\r
779 </p>\r
780 </li>\r
781 <li>\r
782 <p>\r
783 Automatic cache size management.\r
784 </p>\r
785 </li>\r
786 <li>\r
787 <p>\r
788 Can cache compilations that generate warnings.\r
789 </p>\r
790 </li>\r
791 <li>\r
792 <p>\r
793 Easy installation.\r
794 </p>\r
795 </li>\r
796 <li>\r
797 <p>\r
798 Low overhead.\r
799 </p>\r
800 </li>\r
801 <li>\r
802 <p>\r
803 Optionally compresses files in the cache to reduce disk space.\r
804 </p>\r
805 </li>\r
806 </ul></div>\r
807 </div>\r
808 <div class="sect2">\r
809 <h3 id="_limitations">Limitations</h3>\r
810 <div class="ulist"><ul>\r
811 <li>\r
812 <p>\r
813 Only knows how to cache the compilation of a single\r
814   C/C++/Objective-C/Objective-C++ file. Other types of compilations\r
815   (multi-file compilation, linking, etc) will silently fall back to running the\r
816   real compiler.\r
817 </p>\r
818 </li>\r
819 <li>\r
820 <p>\r
821 Only works with GCC and compilers that behave similar enough.\r
822 </p>\r
823 </li>\r
824 <li>\r
825 <p>\r
826 Some compiler flags are not supported. If such a flag is detected, ccache\r
827   will silently fall back to running the real compiler.\r
828 </p>\r
829 </li>\r
830 </ul></div>\r
831 </div>\r
832 </div>\r
833 </div>\r
834 <div class="sect1">\r
835 <h2 id="_run_modes">Run modes</h2>\r
836 <div class="sectionbody">\r
837 <div class="paragraph"><p>There are two ways to use ccache. You can either prefix your compilation\r
838 commands with <strong>ccache</strong> or you can let ccache masquerade as the compiler by\r
839 creating a symbolic link (named as the compiler) to ccache. The first method is\r
840 most convenient if you just want to try out ccache or wish to use it for some\r
841 specific projects. The second method is most useful for when you wish to use\r
842 ccache for all your compilations.</p></div>\r
843 <div class="paragraph"><p>To use the first method, just make sure that <strong>ccache</strong> is in your <strong>PATH</strong>.</p></div>\r
844 <div class="paragraph"><p>To use the symlinks method, do something like this:</p></div>\r
845 <div class="listingblock">\r
846 <div class="content">\r
847 <pre><code>cp ccache /usr/local/bin/\r
848 ln -s ccache /usr/local/bin/gcc\r
849 ln -s ccache /usr/local/bin/g++\r
850 ln -s ccache /usr/local/bin/cc\r
851 ln -s ccache /usr/local/bin/c++</code></pre>\r
852 </div></div>\r
853 <div class="paragraph"><p>And so forth. This will work as long as the directory with symlinks comes\r
854 before the path to the compiler (which is usually in <code>/usr/bin</code>). After\r
855 installing you may wish to run &#8220;which gcc&#8221; to make sure that the correct link\r
856 is being used.</p></div>\r
857 <div class="admonitionblock">\r
858 <table><tr>\r
859 <td class="icon">\r
860 <div class="title">Warning</div>\r
861 </td>\r
862 <td class="content">The technique of letting ccache masquerade as the compiler works well,\r
863 but currently doesn&#8217;t interact well with other tools that do the same thing.\r
864 See <a href="#_using_ccache_with_other_compiler_wrappers">USING CCACHE WITH OTHER COMPILER WRAPPERS</a>.</td>\r
865 </tr></table>\r
866 </div>\r
867 <div class="admonitionblock">\r
868 <table><tr>\r
869 <td class="icon">\r
870 <div class="title">Warning</div>\r
871 </td>\r
872 <td class="content">Do not use a hard link, use a symbolic link. A hard link will cause\r
873 &#8220;interesting&#8221; problems.</td>\r
874 </tr></table>\r
875 </div>\r
876 </div>\r
877 </div>\r
878 <div class="sect1">\r
879 <h2 id="_options">Options</h2>\r
880 <div class="sectionbody">\r
881 <div class="paragraph"><p>These options only apply when you invoke ccache as &#8220;ccache&#8221;. When invoked as\r
882 a compiler (via a symlink as described in the previous section), the normal\r
883 compiler options apply and you should refer to the compiler&#8217;s documentation.</p></div>\r
884 <div class="dlist"><dl>\r
885 <dt class="hdlist1">\r
886 <strong>-c, --cleanup</strong>\r
887 </dt>\r
888 <dd>\r
889 <p>\r
890     Clean up the cache by removing old cached files until the specified file\r
891     number and cache size limits are not exceeded. This also recalculates the\r
892     cache file count and size totals. Normally, there is no need to initiate\r
893     cleanup manually as ccache keeps the cache below the specified limits at\r
894     runtime and keeps statistics up to date on each compilation. Forcing a\r
895     cleanup is mostly useful if you manually modify the cache contents or\r
896     believe that the cache size statistics may be inaccurate.\r
897 </p>\r
898 </dd>\r
899 <dt class="hdlist1">\r
900 <strong>-C, --clear</strong>\r
901 </dt>\r
902 <dd>\r
903 <p>\r
904     Clear the entire cache, removing all cached files, but keeping the\r
905     configuration file.\r
906 </p>\r
907 </dd>\r
908 <dt class="hdlist1">\r
909 <strong>-F, --max-files</strong>=<em>N</em>\r
910 </dt>\r
911 <dd>\r
912 <p>\r
913     Set the maximum number of files allowed in the cache. Use 0 for no limit.\r
914     The value is stored in a configuration file in the cache directory and\r
915     applies to all future compilations.\r
916 </p>\r
917 </dd>\r
918 <dt class="hdlist1">\r
919 <strong>-h, --help</strong>\r
920 </dt>\r
921 <dd>\r
922 <p>\r
923     Print an options summary page.\r
924 </p>\r
925 </dd>\r
926 <dt class="hdlist1">\r
927 <strong>-M, --max-size</strong>=<em>SIZE</em>\r
928 </dt>\r
929 <dd>\r
930 <p>\r
931     Set the maximum size of the files stored in the cache. <em>SIZE</em> should be a\r
932     number followed by an optional suffix: k, M, G, T (decimal), Ki, Mi, Gi or\r
933     Ti (binary). The default suffix is G. Use 0 for no limit. The value is\r
934     stored in a configuration file in the cache directory and applies to all\r
935     future compilations.\r
936 </p>\r
937 </dd>\r
938 <dt class="hdlist1">\r
939 <strong>-o, --set-config</strong>=<em>KEY=VALUE</em>\r
940 </dt>\r
941 <dd>\r
942 <p>\r
943     Set configuration <em>KEY</em> to <em>VALUE</em>. See <a href="#_configuration">CONFIGURATION</a>\r
944     for more information.\r
945 </p>\r
946 </dd>\r
947 <dt class="hdlist1">\r
948 <strong>-p, --print-config</strong>\r
949 </dt>\r
950 <dd>\r
951 <p>\r
952     Print current configuration options and from where they originate\r
953     (environment variable, configuration file or compile-time default).\r
954 </p>\r
955 </dd>\r
956 <dt class="hdlist1">\r
957 <strong>-s, --show-stats</strong>\r
958 </dt>\r
959 <dd>\r
960 <p>\r
961     Print the current statistics summary for the cache.\r
962 </p>\r
963 </dd>\r
964 <dt class="hdlist1">\r
965 <strong>-V, --version</strong>\r
966 </dt>\r
967 <dd>\r
968 <p>\r
969     Print version and copyright information.\r
970 </p>\r
971 </dd>\r
972 <dt class="hdlist1">\r
973 <strong>-z, --zero-stats</strong>\r
974 </dt>\r
975 <dd>\r
976 <p>\r
977     Zero the cache statistics (but not the configuration options).\r
978 </p>\r
979 </dd>\r
980 </dl></div>\r
981 </div>\r
982 </div>\r
983 <div class="sect1">\r
984 <h2 id="_extra_options">Extra options</h2>\r
985 <div class="sectionbody">\r
986 <div class="paragraph"><p>When run as a compiler, ccache usually just takes the same command line options\r
987 as the compiler you are using. The only exception to this is the option\r
988 <strong>--ccache-skip</strong>. That option can be used to tell ccache to avoid interpreting\r
989 the next option in any way and to pass it along to the compiler as-is.</p></div>\r
990 <div class="admonitionblock">\r
991 <table><tr>\r
992 <td class="icon">\r
993 <div class="title">Note</div>\r
994 </td>\r
995 <td class="content"><strong>--ccache-skip</strong> currently only tells ccache not to interpret the next\r
996 option as a special compiler option&#8201;&#8212;&#8201;the option will still be included in the\r
997 direct mode hash.</td>\r
998 </tr></table>\r
999 </div>\r
1000 <div class="paragraph"><p>The reason this can be important is that ccache does need to parse the command\r
1001 line and determine what is an input filename and what is a compiler option, as\r
1002 it needs the input filename to determine the name of the resulting object file\r
1003 (among other things). The heuristic ccache uses when parsing the command line\r
1004 is that any argument that exists as a file is treated as an input file name. By\r
1005 using <strong>--ccache-skip</strong> you can force an option to not be treated as an input\r
1006 file name and instead be passed along to the compiler as a command line option.</p></div>\r
1007 <div class="paragraph"><p>Another case where <strong>--ccache-skip</strong> can be useful is if ccache interprets an\r
1008 option specially but shouldn&#8217;t, since the option has another meaning for your\r
1009 compiler than what ccache thinks.</p></div>\r
1010 </div>\r
1011 </div>\r
1012 <div class="sect1">\r
1013 <h2 id="_configuration">Configuration</h2>\r
1014 <div class="sectionbody">\r
1015 <div class="paragraph"><p>ccache&#8217;s default behavior can be overridden by configuration file settings,\r
1016 which in turn can be overridden by environment variables with names starting\r
1017 with <strong>CCACHE_</strong>. ccache normally reads configuration from two files: first a\r
1018 system-level configuration file and secondly a cache-specific configuration\r
1019 file. The priority of configuration settings is as follows (where 1 is\r
1020 highest):</p></div>\r
1021 <div class="olist arabic"><ol class="arabic">\r
1022 <li>\r
1023 <p>\r
1024 Environment variables.\r
1025 </p>\r
1026 </li>\r
1027 <li>\r
1028 <p>\r
1029 The cache-specific configuration file <strong>&lt;ccachedir&gt;/ccache.conf</strong> (typically\r
1030    <strong>$HOME/.ccache/ccache.conf</strong>).\r
1031 </p>\r
1032 </li>\r
1033 <li>\r
1034 <p>\r
1035 The system-wide configuration file <strong>&lt;sysconfdir&gt;/ccache.conf</strong> (typically\r
1036    <strong>/etc/ccache.conf</strong> or <strong>/usr/local/etc/ccache.conf</strong>).\r
1037 </p>\r
1038 </li>\r
1039 <li>\r
1040 <p>\r
1041 Compile-time defaults.\r
1042 </p>\r
1043 </li>\r
1044 </ol></div>\r
1045 <div class="paragraph"><p>As a special case, if the environment variable <strong>CCACHE_CONFIGPATH</strong> is set,\r
1046 ccache reads configuration from the specified path instead of the default\r
1047 paths.</p></div>\r
1048 <div class="sect2">\r
1049 <h3 id="_configuration_file_syntax">Configuration file syntax</h3>\r
1050 <div class="paragraph"><p>Configuration files are in a simple &#8220;key = value&#8221; format, one setting per\r
1051 line. Lines starting with a hash sign are comments. Blank lines are ignored, as\r
1052 is whitespace surrounding keys and values. Example:</p></div>\r
1053 <div class="listingblock">\r
1054 <div class="content">\r
1055 <pre><code># Set maximum cache size to 10 GB:\r
1056 max_size = 10G</code></pre>\r
1057 </div></div>\r
1058 </div>\r
1059 <div class="sect2">\r
1060 <h3 id="_boolean_values">Boolean values</h3>\r
1061 <div class="paragraph"><p>Some settings are boolean values (i.e. truth values). In a configuration file,\r
1062 such values must be set to the string <strong>true</strong> or <strong>false</strong>. For the corresponding\r
1063 environment variables, the semantics are a bit different: a set environment\r
1064 variable means &#8220;true&#8221; (even if set to the empty string), the following\r
1065 case-insensitive negative values are considered an error (rather than\r
1066 surprising the user): <strong>0</strong>, <strong>false</strong>, <strong>disable</strong> and <strong>no</strong>, and an unset\r
1067 environment variable means &#8220;false&#8221;. Each boolean environment variable also\r
1068 has a negated form starting with <strong>CCACHE_NO</strong>. For example, <strong>CCACHE_COMPRESS</strong>\r
1069 can be set to force compression and <strong>CCACHE_NOCOMPRESS</strong> can be set to force no\r
1070 compression.</p></div>\r
1071 </div>\r
1072 <div class="sect2">\r
1073 <h3 id="_configuration_settings">Configuration settings</h3>\r
1074 <div class="paragraph"><p>Below is a list of available configuration settings. The corresponding\r
1075 environment variable name is indicated in parentheses after each configuration\r
1076 setting key.</p></div>\r
1077 <div class="dlist"><dl>\r
1078 <dt class="hdlist1">\r
1079 <strong>base_dir</strong> (<strong>CCACHE_BASEDIR</strong>)\r
1080 </dt>\r
1081 <dd>\r
1082 <p>\r
1083     This setting should be an absolute path to a directory. ccache then\r
1084     rewrites absolute paths into relative paths before computing the hash that\r
1085     identifies the compilation, but only for paths under the specified\r
1086     directory. If set to the empty string (which is the default), no rewriting\r
1087     is done. A typical path to use as the base directory is your home directory\r
1088     or another directory that is a parent of your build directories. Don&#8217;t use\r
1089     <code>/</code> as the base directory since that will make ccache also rewrite paths to\r
1090     system header files, which doesn&#8217;t gain anything.\r
1091 </p>\r
1092 <div class="paragraph"><p>See also the discussion under <a href="#_compiling_in_different_directories">COMPILING IN DIFFERENT DIRECTORIES</a>.</p></div>\r
1093 </dd>\r
1094 <dt class="hdlist1">\r
1095 <strong>cache_dir</strong> (<strong>CCACHE_DIR</strong>)\r
1096 </dt>\r
1097 <dd>\r
1098 <p>\r
1099     This setting specifies where ccache will keep its cached compiler outputs.\r
1100     It will only take effect if set in the system-wide configuration file or as\r
1101     an environment variable. The default is <strong>$HOME/.ccache</strong>.\r
1102 </p>\r
1103 </dd>\r
1104 <dt class="hdlist1">\r
1105 <strong>cache_dir_levels</strong> (<strong>CCACHE_NLEVELS</strong>)\r
1106 </dt>\r
1107 <dd>\r
1108 <p>\r
1109     This setting allows you to choose the number of directory levels in the\r
1110     cache directory. The default is 2. The minimum is 1 and the maximum is 8.\r
1111 </p>\r
1112 </dd>\r
1113 <dt class="hdlist1">\r
1114 <strong>compiler</strong> (<strong>CCACHE_CC</strong>)\r
1115 </dt>\r
1116 <dd>\r
1117 <p>\r
1118     This setting can be used to force the name of the compiler to use. If set\r
1119     to the empty string (which is the default), ccache works it out from the\r
1120     command line.\r
1121 </p>\r
1122 </dd>\r
1123 <dt class="hdlist1">\r
1124 <strong>compiler_check</strong> (<strong>CCACHE_COMPILERCHECK</strong>)\r
1125 </dt>\r
1126 <dd>\r
1127 <p>\r
1128     By default, ccache includes the modification time (&#8220;mtime&#8221;) and size of\r
1129     the compiler in the hash to ensure that results retrieved from the cache\r
1130     are accurate. This setting can be used to select another strategy. Possible\r
1131     values are:\r
1132 </p>\r
1133 <div class="openblock">\r
1134 <div class="content">\r
1135 <div class="dlist"><dl>\r
1136 <dt class="hdlist1">\r
1137 <strong>content</strong>\r
1138 </dt>\r
1139 <dd>\r
1140 <p>\r
1141     Hash the content of the compiler binary. This makes ccache very slightly\r
1142     slower compared to the <strong>mtime</strong> setting, but makes it cope better with\r
1143     compiler upgrades during a build bootstrapping process.\r
1144 </p>\r
1145 </dd>\r
1146 <dt class="hdlist1">\r
1147 <strong>mtime</strong>\r
1148 </dt>\r
1149 <dd>\r
1150 <p>\r
1151     Hash the compiler&#8217;s mtime and size, which is fast. This is the default.\r
1152 </p>\r
1153 </dd>\r
1154 <dt class="hdlist1">\r
1155 <strong>none</strong>\r
1156 </dt>\r
1157 <dd>\r
1158 <p>\r
1159     Don&#8217;t hash anything. This may be good for situations where you can safely\r
1160     use the cached results even though the compiler&#8217;s mtime or size has changed\r
1161     (e.g. if the compiler is built as part of your build system and the\r
1162     compiler&#8217;s source has not changed, or if the compiler only has changes that\r
1163     don&#8217;t affect code generation). You should only use the <strong>none</strong> setting if\r
1164     you know what you are doing.\r
1165 </p>\r
1166 </dd>\r
1167 <dt class="hdlist1">\r
1168 <strong>string:value</strong>\r
1169 </dt>\r
1170 <dd>\r
1171 <p>\r
1172     Use <strong>value</strong> as the string to calculate hash from. This can be the compiler\r
1173     revision number you retrieved earlier and set here via environment variable.\r
1174 </p>\r
1175 </dd>\r
1176 <dt class="hdlist1">\r
1177 <em>a command string</em>\r
1178 </dt>\r
1179 <dd>\r
1180 <p>\r
1181     Hash the standard output and standard error output of the specified\r
1182     command. The string will be split on whitespace to find out the command and\r
1183     arguments to run. No other interpretation of the command string will be\r
1184     done, except that the special word <strong>%compiler%</strong> will be replaced with the\r
1185     path to the compiler. Several commands can be specified with semicolon as\r
1186     separator. Examples:\r
1187 </p>\r
1188 <div class="openblock">\r
1189 <div class="content">\r
1190 <div class="listingblock">\r
1191 <div class="content">\r
1192 <pre><code>%compiler% -v</code></pre>\r
1193 </div></div>\r
1194 <div class="listingblock">\r
1195 <div class="content">\r
1196 <pre><code>%compiler% -dumpmachine; %compiler% -dumpversion</code></pre>\r
1197 </div></div>\r
1198 <div class="paragraph"><p>You should make sure that the specified command is as fast as possible since it\r
1199 will be run once for each ccache invocation.</p></div>\r
1200 <div class="paragraph"><p>Identifying the compiler using a command is useful if you want to avoid cache\r
1201 misses when the compiler has been rebuilt but not changed.</p></div>\r
1202 <div class="paragraph"><p>Another case is when the compiler (as seen by ccache) actually isn&#8217;t the real\r
1203 compiler but another compiler wrapper&#8201;&#8212;&#8201;in that case, the default <strong>mtime</strong>\r
1204 method will hash the mtime and size of the other compiler wrapper, which means\r
1205 that ccache won&#8217;t be able to detect a compiler upgrade. Using a suitable\r
1206 command to identify the compiler is thus safer, but it&#8217;s also slower, so you\r
1207 should consider continue using the <strong>mtime</strong> method in combination with\r
1208 the <strong>prefix_command</strong> setting if possible. See\r
1209 <a href="#_using_ccache_with_other_compiler_wrappers">USING CCACHE WITH OTHER COMPILER WRAPPERS</a>.</p></div>\r
1210 </div></div>\r
1211 </dd>\r
1212 </dl></div>\r
1213 </div></div>\r
1214 </dd>\r
1215 <dt class="hdlist1">\r
1216 <strong>compression</strong> (<strong>CCACHE_COMPRESS</strong> or <strong>CCACHE_NOCOMPRESS</strong>, see <a href="#_boolean_values">Boolean values</a> above)\r
1217 </dt>\r
1218 <dd>\r
1219 <p>\r
1220     If true, ccache will compress object files and other compiler output it\r
1221     puts in the cache. However, this setting has no effect on how files are\r
1222     retrieved from the cache; compressed and uncompressed results will still be\r
1223     usable regardless of this setting. The default is false.\r
1224 </p>\r
1225 </dd>\r
1226 <dt class="hdlist1">\r
1227 <strong>compression_level</strong> (<strong>CCACHE_COMPRESSLEVEL</strong>)\r
1228 </dt>\r
1229 <dd>\r
1230 <p>\r
1231     This setting determines the level at which ccache will compress object\r
1232     files. It only has effect if <strong>compression</strong> is enabled. The value defaults\r
1233     to 6, and must be no lower than 1 (fastest, worst compression) and no\r
1234     higher than 9 (slowest, best compression).\r
1235 </p>\r
1236 </dd>\r
1237 <dt class="hdlist1">\r
1238 <strong>cpp_extension</strong> (<strong>CCACHE_EXTENSION</strong>)\r
1239 </dt>\r
1240 <dd>\r
1241 <p>\r
1242     This setting can be used to force a certain extension for the intermediate\r
1243     preprocessed file. The default is to automatically determine the extension\r
1244     to use for intermediate preprocessor files based on the type of file being\r
1245     compiled, but that sometimes doesn&#8217;t work. For example, when using the\r
1246     &#8220;aCC&#8221; compiler on HP-UX, set the cpp extension to <strong>i</strong>.\r
1247 </p>\r
1248 </dd>\r
1249 <dt class="hdlist1">\r
1250 <strong>direct_mode</strong> (<strong>CCACHE_DIRECT</strong> or <strong>CCACHE_NODIRECT</strong>, see <a href="#_boolean_values">Boolean values</a> above)\r
1251 </dt>\r
1252 <dd>\r
1253 <p>\r
1254     If true, the direct mode will be used. The default is true. See\r
1255     <a href="#_the_direct_mode">THE DIRECT MODE</a>.\r
1256 </p>\r
1257 </dd>\r
1258 <dt class="hdlist1">\r
1259 <strong>disable</strong> (<strong>CCACHE_DISABLE</strong> or <strong>CCACHE_NODISABLE</strong>, see <a href="#_boolean_values">Boolean values</a> above)\r
1260 </dt>\r
1261 <dd>\r
1262 <p>\r
1263     When true, ccache will just call the real compiler, bypassing the cache\r
1264     completely. The default is false.\r
1265 </p>\r
1266 </dd>\r
1267 <dt class="hdlist1">\r
1268 <strong>extra_files_to_hash</strong> (<strong>CCACHE_EXTRAFILES</strong>)\r
1269 </dt>\r
1270 <dd>\r
1271 <p>\r
1272     This setting is a list of paths to files that ccache will include in the\r
1273     the hash sum that identifies the build. The list separator is semicolon on\r
1274     Windows systems and colon on other systems.\r
1275 </p>\r
1276 </dd>\r
1277 <dt class="hdlist1">\r
1278 <strong>hard_link</strong> (<strong>CCACHE_HARDLINK</strong> or <strong>CCACHE_NOHARDLINK</strong>, see <a href="#_boolean_values">Boolean values</a> above)\r
1279 </dt>\r
1280 <dd>\r
1281 <p>\r
1282     If true, ccache will attempt to use hard links from the cache directory\r
1283     when creating the compiler output rather than using a file copy. Hard links\r
1284     are never made for compressed cache files. This means that you should not\r
1285     enable compression if you want to use hard links. The default is false.\r
1286 </p>\r
1287 <div class="admonitionblock">\r
1288 <table><tr>\r
1289 <td class="icon">\r
1290 <div class="title">Warning</div>\r
1291 </td>\r
1292 <td class="content">Do not enable this option unless you are aware of the consequences.\r
1293 Using hard links may be slightly faster in some situations, but there are\r
1294 several pitfalls since the resulting object file will share i-node with the\r
1295 cached object file:</td>\r
1296 </tr></table>\r
1297 </div>\r
1298 <div class="olist arabic"><ol class="arabic">\r
1299 <li>\r
1300 <p>\r
1301 If the resulting object file is modified in any way, the cached object file\r
1302    will be modified as well. For instance, if you run <strong>strip object.o</strong> or <strong>echo\r
1303    &gt;object.o</strong>, you will corrupt the cache.\r
1304 </p>\r
1305 </li>\r
1306 <li>\r
1307 <p>\r
1308 Programs that rely on modification times (like &#8220;make&#8221;) can be confused\r
1309    since ccache updates the cached files' modification times as part of the\r
1310    automatic cache size management. This will affect object files in the build\r
1311    tree as well, which can retrigger the linking step even though nothing\r
1312    really has changed.\r
1313 </p>\r
1314 </li>\r
1315 </ol></div>\r
1316 </dd>\r
1317 <dt class="hdlist1">\r
1318 <strong>hash_dir</strong> (<strong>CCACHE_HASHDIR</strong> or <strong>CCACHE_NOHASHDIR</strong>, see <a href="#_boolean_values">Boolean values</a> above)\r
1319 </dt>\r
1320 <dd>\r
1321 <p>\r
1322     If true (which is the default), ccache will include the current working\r
1323     directory (CWD) in the hash that is used to distinguish two compilations\r
1324     when generating debug info (compiler option <strong>-g</strong> with variations).\r
1325     Exception: The CWD will not be included in the hash if <strong>base_dir</strong> is set\r
1326     (and matches the CWD) and the compiler option <strong>-fdebug-prefix-map</strong> is used.\r
1327     See also the discussion under\r
1328     <a href="#_compiling_in_different_directories">COMPILING IN DIFFERENT DIRECTORIES</a>.\r
1329 </p>\r
1330 <div class="paragraph"><p>The reason for including the CWD in the hash by default is to prevent a problem\r
1331 with the storage of the current working directory in the debug info of an\r
1332 object file, which can lead ccache to return a cached object file that has the\r
1333 working directory in the debug info set incorrectly.</p></div>\r
1334 <div class="paragraph"><p>You can disable this setting to get cache hits when compiling the same source\r
1335 code in different directories if you don&#8217;t mind that CWD in the debug info\r
1336 might be incorrect.</p></div>\r
1337 </dd>\r
1338 <dt class="hdlist1">\r
1339 <strong>ignore_headers_in_manifest</strong> (<strong>CCACHE_IGNOREHEADERS</strong>)\r
1340 </dt>\r
1341 <dd>\r
1342 <p>\r
1343     This setting is a list of paths to files (or directories with headers) that\r
1344     ccache will <strong>not</strong> include in the manifest list that makes up the direct\r
1345     mode. Note that this can cause stale cache hits if those headers do indeed\r
1346     change. The list separator is semicolon on Windows systems and colon on\r
1347     other systems.\r
1348 </p>\r
1349 </dd>\r
1350 <dt class="hdlist1">\r
1351 <strong>keep_comments_cpp</strong> (<strong>CCACHE_COMMENTS</strong> or <strong>CCACHE_NOCOMMENTS</strong>, see <a href="#_boolean_values">Boolean values</a> above)\r
1352 </dt>\r
1353 <dd>\r
1354 <p>\r
1355     If true, ccache will not discard the comments before hashing preprocessor\r
1356     output. This can be used to check documentation with <strong>-Wdocumentation</strong>.\r
1357 </p>\r
1358 </dd>\r
1359 <dt class="hdlist1">\r
1360 <strong>limit_multiple</strong> (<strong>CCACHE_LIMIT_MULTIPLE</strong>)\r
1361 </dt>\r
1362 <dd>\r
1363 <p>\r
1364     Sets the limit when cleaning up. Files are deleted (in LRU order) until the\r
1365     levels are below the limit. The default is 0.8 (= 80%). See\r
1366     <a href="#_automatic_cleanup">AUTOMATIC CLEANUP</a> for more information.\r
1367 </p>\r
1368 </dd>\r
1369 <dt class="hdlist1">\r
1370 <strong>log_file</strong> (<strong>CCACHE_LOGFILE</strong>)\r
1371 </dt>\r
1372 <dd>\r
1373 <p>\r
1374     If set to a file path, ccache will write information on what it is doing to\r
1375     the specified file. This is useful for tracking down problems.\r
1376 </p>\r
1377 </dd>\r
1378 <dt class="hdlist1">\r
1379 <strong>max_files</strong> (<strong>CCACHE_MAXFILES</strong>)\r
1380 </dt>\r
1381 <dd>\r
1382 <p>\r
1383     This option specifies the maximum number of files to keep in the cache. Use\r
1384     0 for no limit (which is the default). See also\r
1385     <a href="#_cache_size_management">CACHE SIZE MANAGEMENT</a>.\r
1386 </p>\r
1387 </dd>\r
1388 <dt class="hdlist1">\r
1389 <strong>max_size</strong> (<strong>CCACHE_MAXSIZE</strong>)\r
1390 </dt>\r
1391 <dd>\r
1392 <p>\r
1393     This option specifies the maximum size of the cache. Use 0 for no limit.\r
1394     The default value is 5G. Available suffixes: k, M, G, T (decimal) and Ki,\r
1395     Mi, Gi, Ti (binary). The default suffix is "G". See also\r
1396     <a href="#_cache_size_management">CACHE SIZE MANAGEMENT</a>.\r
1397 </p>\r
1398 </dd>\r
1399 <dt class="hdlist1">\r
1400 <strong>path</strong> (<strong>CCACHE_PATH</strong>)\r
1401 </dt>\r
1402 <dd>\r
1403 <p>\r
1404     If set, ccache will search directories in this list when looking for the\r
1405     real compiler. The list separator is semicolon on Windows systems and colon\r
1406     on other systems. If not set, ccache will look for the first executable\r
1407     matching the compiler name in the normal <strong>PATH</strong> that isn&#8217;t a symbolic link\r
1408     to ccache itself.\r
1409 </p>\r
1410 </dd>\r
1411 <dt class="hdlist1">\r
1412 <strong>prefix_command</strong> (<strong>CCACHE_PREFIX</strong>)\r
1413 </dt>\r
1414 <dd>\r
1415 <p>\r
1416     This option adds a list of prefixes (separated by space) to the command\r
1417     line that ccache uses when invoking the compiler. See also\r
1418     <a href="#_using_ccache_with_other_compiler_wrappers">USING CCACHE WITH OTHER     COMPILER WRAPPERS</a>.\r
1419 </p>\r
1420 </dd>\r
1421 <dt class="hdlist1">\r
1422 <strong>prefix_command_cpp</strong> (<strong>CCACHE_PREFIX_CPP</strong>)\r
1423 </dt>\r
1424 <dd>\r
1425 <p>\r
1426     This option adds a list of prefixes (separated by space) to the command\r
1427     line that ccache uses when invoking the preprocessor.\r
1428 </p>\r
1429 </dd>\r
1430 <dt class="hdlist1">\r
1431 <strong>read_only</strong> (<strong>CCACHE_READONLY</strong> or <strong>CCACHE_NOREADONLY</strong>, see <a href="#_boolean_values">Boolean values</a> above)\r
1432 </dt>\r
1433 <dd>\r
1434 <p>\r
1435     If true, ccache will attempt to use existing cached object files, but it\r
1436     will not to try to add anything new to the cache. If you are using this\r
1437     because your ccache directory is read-only, then you need to set\r
1438     <strong>temporary_dir</strong> as otherwise ccache will fail to create temporary files.\r
1439 </p>\r
1440 </dd>\r
1441 <dt class="hdlist1">\r
1442 <strong>read_only_direct</strong> (<strong>CCACHE_READONLY_DIRECT</strong> or <strong>CCACHE_NOREADONLY_DIRECT</strong>, see <a href="#_boolean_values">Boolean values</a> above)\r
1443 </dt>\r
1444 <dd>\r
1445 <p>\r
1446     Just like <strong>read_only</strong> except that ccache will only try to retrieve results\r
1447     from the cache using the direct mode, not the preprocessor mode. See\r
1448     documentation for <strong>read_only</strong> regarding using a read-only ccache directory.\r
1449 </p>\r
1450 </dd>\r
1451 <dt class="hdlist1">\r
1452 <strong>recache</strong> (<strong>CCACHE_RECACHE</strong> or <strong>CCACHE_NORECACHE</strong>, see <a href="#_boolean_values">Boolean values</a> above)\r
1453 </dt>\r
1454 <dd>\r
1455 <p>\r
1456     If true, ccache will not use any previously stored result. New results will\r
1457     still be cached, possibly overwriting any pre-existing results.\r
1458 </p>\r
1459 </dd>\r
1460 <dt class="hdlist1">\r
1461 <strong>run_second_cpp</strong> (<strong>CCACHE_CPP2</strong> or <strong>CCACHE_NOCPP2</strong>, see <a href="#_boolean_values">Boolean values</a> above)\r
1462 </dt>\r
1463 <dd>\r
1464 <p>\r
1465     If true, ccache will first run the preprocessor to preprocess the source\r
1466     code (see <a href="#_the_preprocessor_mode">THE PREPROCESSOR MODE</a>) and then on a\r
1467     cache miss run the compiler on the source code to get hold of the object\r
1468     file. This is the default.\r
1469 </p>\r
1470 <div class="paragraph"><p>If false, ccache will first run preprocessor to preprocess the source code and\r
1471 then on a cache miss run the compiler on the <em>preprocessed source code</em> instead\r
1472 of the original source code. This makes cache misses slightly faster since the\r
1473 source code only has to be preprocessed once. The downside is that some\r
1474 compilers won&#8217;t produce the same result (for instance diagnostics warnings)\r
1475 when compiling preprocessed source code.</p></div>\r
1476 <div class="paragraph"><p>A solution to the above mentioned downside is to set <strong>run_second_cpp</strong> to false\r
1477 and pass <strong>-fdirectives-only</strong> (for GCC) or <strong>-frewrite-includes</strong> (for Clang) to\r
1478 the compiler. This will cause the compiler to leave the macros and other\r
1479 preprocessor information, and only process the <strong>#include</strong> directives. When run\r
1480 in this way, the preprocessor arguments will be passed to the compiler since it\r
1481 still has to do <em>some</em> preprocessing (like macros).</p></div>\r
1482 </dd>\r
1483 <dt class="hdlist1">\r
1484 <strong>sloppiness</strong> (<strong>CCACHE_SLOPPINESS</strong>)\r
1485 </dt>\r
1486 <dd>\r
1487 <p>\r
1488     By default, ccache tries to give as few false cache hits as possible.\r
1489     However, in certain situations it&#8217;s possible that you know things that\r
1490     ccache can&#8217;t take for granted. This setting makes it possible to tell\r
1491     ccache to relax some checks in order to increase the hit rate. The value\r
1492     should be a comma-separated string with options. Available options are:\r
1493 </p>\r
1494 <div class="openblock">\r
1495 <div class="content">\r
1496 <div class="dlist"><dl>\r
1497 <dt class="hdlist1">\r
1498 <strong>file_macro</strong>\r
1499 </dt>\r
1500 <dd>\r
1501 <p>\r
1502     Ignore <strong>__FILE__</strong> being present in the source.\r
1503 </p>\r
1504 </dd>\r
1505 <dt class="hdlist1">\r
1506 <strong>file_stat_matches</strong>\r
1507 </dt>\r
1508 <dd>\r
1509 <p>\r
1510     ccache normally examines a file&#8217;s contents to determine whether it matches\r
1511     the cached version. With this option set, ccache will consider a file as\r
1512     matching its cached version if the mtimes and ctimes match.\r
1513 </p>\r
1514 </dd>\r
1515 <dt class="hdlist1">\r
1516 <strong>include_file_ctime</strong>\r
1517 </dt>\r
1518 <dd>\r
1519 <p>\r
1520     By default, ccache also will not cache a file if it includes a header whose\r
1521     ctime is too new. This option disables that check.\r
1522 </p>\r
1523 </dd>\r
1524 <dt class="hdlist1">\r
1525 <strong>include_file_mtime</strong>\r
1526 </dt>\r
1527 <dd>\r
1528 <p>\r
1529     By default, ccache will not cache a file if it includes a header whose\r
1530     mtime is too new. This option disables that check.\r
1531 </p>\r
1532 </dd>\r
1533 <dt class="hdlist1">\r
1534 <strong>no_system_headers</strong>\r
1535 </dt>\r
1536 <dd>\r
1537 <p>\r
1538     By default, ccache will also include all system headers in the manifest.\r
1539     With this option set, ccache will only include system headers in the hash\r
1540     but not add the system header files to the list of include files.\r
1541 </p>\r
1542 </dd>\r
1543 <dt class="hdlist1">\r
1544 <strong>pch_defines</strong>\r
1545 </dt>\r
1546 <dd>\r
1547 <p>\r
1548     Be sloppy about <strong>#define</strong>s when precompiling a header file. See\r
1549     <a href="#_precompiled_headers">PRECOMPILED HEADERS</a> for more information.\r
1550 </p>\r
1551 </dd>\r
1552 <dt class="hdlist1">\r
1553 <strong>time_macros</strong>\r
1554 </dt>\r
1555 <dd>\r
1556 <p>\r
1557     Ignore <strong>__DATE__</strong> and <strong>__TIME__</strong> being present in the source code.\r
1558 </p>\r
1559 </dd>\r
1560 </dl></div>\r
1561 </div></div>\r
1562 <div class="paragraph"><p>See the discussion under <a href="#_troubleshooting">TROUBLESHOOTING</a> for more\r
1563 information.</p></div>\r
1564 </dd>\r
1565 <dt class="hdlist1">\r
1566 <strong>stats</strong> (<strong>CCACHE_STATS</strong> or <strong>CCACHE_NOSTATS</strong>, see <a href="#_boolean_values">Boolean values</a> above)\r
1567 </dt>\r
1568 <dd>\r
1569 <p>\r
1570     If true, ccache will update the statistics counters on each compilation.\r
1571     The default is true.\r
1572 </p>\r
1573 </dd>\r
1574 <dt class="hdlist1">\r
1575 <strong>temporary_dir</strong> (<strong>CCACHE_TEMPDIR</strong>)\r
1576 </dt>\r
1577 <dd>\r
1578 <p>\r
1579     This setting specifies where ccache will put temporary files. The default\r
1580     is <strong>&lt;cache_dir&gt;/tmp</strong>.\r
1581 </p>\r
1582 <div class="admonitionblock">\r
1583 <table><tr>\r
1584 <td class="icon">\r
1585 <div class="title">Note</div>\r
1586 </td>\r
1587 <td class="content">In previous versions of ccache, <strong>CCACHE_TEMPDIR</strong> had to be on the same\r
1588     filesystem as the <strong>CCACHE_DIR</strong> path, but this requirement has been\r
1589     relaxed.)</td>\r
1590 </tr></table>\r
1591 </div>\r
1592 </dd>\r
1593 <dt class="hdlist1">\r
1594 <strong>umask</strong> (<strong>CCACHE_UMASK</strong>)\r
1595 </dt>\r
1596 <dd>\r
1597 <p>\r
1598     This setting specifies the umask for ccache and all child processes (such\r
1599     as the compiler). This is mostly useful when you wish to share your cache\r
1600     with other users. Note that this also affects the file permissions set on\r
1601     the object files created from your compilations.\r
1602 </p>\r
1603 </dd>\r
1604 <dt class="hdlist1">\r
1605 <strong>unify</strong> (<strong>CCACHE_UNIFY</strong> or <strong>CCACHE_NOUNIFY</strong>, see <a href="#_boolean_values">Boolean values</a> above)\r
1606 </dt>\r
1607 <dd>\r
1608 <p>\r
1609     If true, ccache will use a C/C++ unifier when hashing the preprocessor\r
1610     output if the <strong>-g</strong> option is not used. The unifier is slower than a normal\r
1611     hash, so setting this environment variable loses a little bit of speed, but\r
1612     it means that ccache can take advantage of not recompiling when the changes\r
1613     to the source code consist of reformatting only. Note that enabling the\r
1614     unifier changes the hash, so cached compilations produced when the unifier\r
1615     is enabled cannot be reused when the unifier is disabled, and vice versa.\r
1616     Enabling the unifier may result in incorrect line number information in\r
1617     compiler warning messages and expansions of the <strong>__LINE__</strong> macro.\r
1618 </p>\r
1619 </dd>\r
1620 </dl></div>\r
1621 </div>\r
1622 </div>\r
1623 </div>\r
1624 <div class="sect1">\r
1625 <h2 id="_cache_size_management">Cache size management</h2>\r
1626 <div class="sectionbody">\r
1627 <div class="paragraph"><p>By default, ccache has a 5 GB limit on the total size of files in the cache and\r
1628 no limit on the number of files. You can set different limits using the\r
1629 <strong>-M</strong>/<strong>--max-size</strong> and <strong>-F</strong>/<strong>--max-files</strong> options. Use <strong>ccache -s/--show-stats</strong>\r
1630 to see the cache size and the currently configured limits (in addition to other\r
1631 various statistics).</p></div>\r
1632 <div class="paragraph"><p>Cleanup can be triggered in two different ways: automatic and manual.</p></div>\r
1633 <div class="sect2">\r
1634 <h3 id="_automatic_cleanup">Automatic cleanup</h3>\r
1635 <div class="paragraph"><p>ccache maintains counters for various statistics about the cache, including the\r
1636 size and number of all cached files. In order to improve performance and reduce\r
1637 issues with concurrent ccache invocations, there is one statistics file for\r
1638 each of the sixteen subdirectories in the cache.</p></div>\r
1639 <div class="paragraph"><p>After a new compilation result has been written to the cache, ccache will\r
1640 update the size and file number statistics for the subdirectory (one of\r
1641 sixteen) to which the result was written. Then, if the size counter for said\r
1642 subdirectory is greater than <strong>max_size / 16</strong> or the file number counter is\r
1643 greater than <strong>max_files / 16</strong>, automatic cleanup is triggered.</p></div>\r
1644 <div class="paragraph"><p>When automatic cleanup is triggered for a subdirectory in the cache, ccache\r
1645 will:</p></div>\r
1646 <div class="olist arabic"><ol class="arabic">\r
1647 <li>\r
1648 <p>\r
1649 Count all files in the subdirectory and compute their aggregated size.\r
1650 </p>\r
1651 </li>\r
1652 <li>\r
1653 <p>\r
1654 Remove files in LRU (least recently used) order until the size is at most\r
1655    <strong>limit_multiple * max_size / 16</strong> and the number of files is at most\r
1656    <strong>limit_multiple * max_files / 16</strong>, where <strong>limit_multiple</strong>, <strong>max_size</strong> and\r
1657    <strong>max_files</strong> are configuration settings.\r
1658 </p>\r
1659 </li>\r
1660 <li>\r
1661 <p>\r
1662 Set the size and file number counters to match the files that were kept.\r
1663 </p>\r
1664 </li>\r
1665 </ol></div>\r
1666 <div class="paragraph"><p>The reason for removing more files than just those needed to not exceed the max\r
1667 limits is that a cleanup is a fairly slow operation, so it would not be a good\r
1668 idea to trigger it often, like after each cache miss.</p></div>\r
1669 </div>\r
1670 <div class="sect2">\r
1671 <h3 id="_manual_cleanup">Manual cleanup</h3>\r
1672 <div class="paragraph"><p>You can run <strong>ccache -c/--cleanup</strong> to force cleanup of the whole cache, i.e. all\r
1673 of the sixteen subdirectories. This will recalculate the statistics counters\r
1674 and make sure that the <strong>max_size</strong> and <strong>max_files</strong> settings are not exceeded.\r
1675 Note that <strong>limit_multiple</strong> is not taken into account for manual cleanup.</p></div>\r
1676 </div>\r
1677 </div>\r
1678 </div>\r
1679 <div class="sect1">\r
1680 <h2 id="_cache_compression">Cache compression</h2>\r
1681 <div class="sectionbody">\r
1682 <div class="paragraph"><p>ccache can optionally compress all files it puts into the cache using the\r
1683 compression library zlib. While this may involve a tiny performance slowdown,\r
1684 it increases the number of files that fit in the cache. You can turn on\r
1685 compression with the <strong>compression</strong> configuration setting and you can also tweak\r
1686 the compression level with <strong>compression_level</strong>.</p></div>\r
1687 </div>\r
1688 </div>\r
1689 <div class="sect1">\r
1690 <h2 id="_cache_statistics">Cache statistics</h2>\r
1691 <div class="sectionbody">\r
1692 <div class="paragraph"><p><strong>ccache -s/--show-stats</strong> can show the following statistics:</p></div>\r
1693 <div class="tableblock">\r
1694 <table rules="all"\r
1695 width="100%"\r
1696 frame="border"\r
1697 cellspacing="0" cellpadding="4">\r
1698 <col width="30%" />\r
1699 <col width="70%" />\r
1700 <thead>\r
1701 <tr>\r
1702 <th align="left" valign="top">Name </th>\r
1703 <th align="left" valign="top"> Description</th>\r
1704 </tr>\r
1705 </thead>\r
1706 <tbody>\r
1707 <tr>\r
1708 <td align="left" valign="top"><p class="table">autoconf compile/link</p></td>\r
1709 <td align="left" valign="top"><p class="table">Uncachable compilation or linking by an autoconf test.</p></td>\r
1710 </tr>\r
1711 <tr>\r
1712 <td align="left" valign="top"><p class="table">bad compiler arguments</p></td>\r
1713 <td align="left" valign="top"><p class="table">Malformed compiler argument, e.g. missing a value for an option that requires\r
1714 an argument or failure to read a file specified by an option argument.</p></td>\r
1715 </tr>\r
1716 <tr>\r
1717 <td align="left" valign="top"><p class="table">cache file missing</p></td>\r
1718 <td align="left" valign="top"><p class="table">A file was unexpectedly missing from the cache. This only happens in rare\r
1719 situations, e.g. if one ccache instance is about to get a file from the cache\r
1720 while another instance removed the file as part of cache cleanup.</p></td>\r
1721 </tr>\r
1722 <tr>\r
1723 <td align="left" valign="top"><p class="table">cache hit (direct)</p></td>\r
1724 <td align="left" valign="top"><p class="table">A result was successfully found using <a href="#_the_direct_mode">the direct mode</a>.</p></td>\r
1725 </tr>\r
1726 <tr>\r
1727 <td align="left" valign="top"><p class="table">cache hit (preprocessed)</p></td>\r
1728 <td align="left" valign="top"><p class="table">A result was successfully found using <a href="#_the_preprocessor_mode">the preprocessor mode</a>.</p></td>\r
1729 </tr>\r
1730 <tr>\r
1731 <td align="left" valign="top"><p class="table">cache miss</p></td>\r
1732 <td align="left" valign="top"><p class="table">No result was found.</p></td>\r
1733 </tr>\r
1734 <tr>\r
1735 <td align="left" valign="top"><p class="table">cache size</p></td>\r
1736 <td align="left" valign="top"><p class="table">Current size of the cache.</p></td>\r
1737 </tr>\r
1738 <tr>\r
1739 <td align="left" valign="top"><p class="table">called for link</p></td>\r
1740 <td align="left" valign="top"><p class="table">The compiler was called for linking, not compiling.</p></td>\r
1741 </tr>\r
1742 <tr>\r
1743 <td align="left" valign="top"><p class="table">called for preprocessing</p></td>\r
1744 <td align="left" valign="top"><p class="table">The compiler was called for preprocessing, not compiling.</p></td>\r
1745 </tr>\r
1746 <tr>\r
1747 <td align="left" valign="top"><p class="table">can&#8217;t use precompiled header</p></td>\r
1748 <td align="left" valign="top"><p class="table">Preconditions for using <a href="#_precompiled_headers">precompiled headers</a> were not\r
1749 fulfilled.</p></td>\r
1750 </tr>\r
1751 <tr>\r
1752 <td align="left" valign="top"><p class="table">ccache internal error</p></td>\r
1753 <td align="left" valign="top"><p class="table">Unexpected failure, e.g. due to problems reading/writing the cache.</p></td>\r
1754 </tr>\r
1755 <tr>\r
1756 <td align="left" valign="top"><p class="table">cleanups performed</p></td>\r
1757 <td align="left" valign="top"><p class="table">Number of cleanups performed, either implicitly due to the cache size limit\r
1758 being reached or due to explicit <strong>ccache -c/--cleanup</strong> calls.</p></td>\r
1759 </tr>\r
1760 <tr>\r
1761 <td align="left" valign="top"><p class="table">compile failed</p></td>\r
1762 <td align="left" valign="top"><p class="table">The compilation failed. No result stored in the cache.</p></td>\r
1763 </tr>\r
1764 <tr>\r
1765 <td align="left" valign="top"><p class="table">compiler check failed</p></td>\r
1766 <td align="left" valign="top"><p class="table">A compiler check program specified by <strong>compiler_check</strong> (<strong>CCACHE_COMPILERCHECK</strong>)\r
1767 failed.</p></td>\r
1768 </tr>\r
1769 <tr>\r
1770 <td align="left" valign="top"><p class="table">compiler produced empty output</p></td>\r
1771 <td align="left" valign="top"><p class="table">The compiler&#8217;s output file (typically an object file) was empty after\r
1772 compilation.</p></td>\r
1773 </tr>\r
1774 <tr>\r
1775 <td align="left" valign="top"><p class="table">compiler produced no output</p></td>\r
1776 <td align="left" valign="top"><p class="table">The compiler&#8217;s output file (typically an object file) was missing after\r
1777 compilation.</p></td>\r
1778 </tr>\r
1779 <tr>\r
1780 <td align="left" valign="top"><p class="table">compiler produced stdout</p></td>\r
1781 <td align="left" valign="top"><p class="table">The compiler wrote data to standard output. This is something that compilers\r
1782 normally never do, so ccache is not designed to store such output in the cache.</p></td>\r
1783 </tr>\r
1784 <tr>\r
1785 <td align="left" valign="top"><p class="table">couldn&#8217;t find the compiler</p></td>\r
1786 <td align="left" valign="top"><p class="table">The compiler to execute could not be found.</p></td>\r
1787 </tr>\r
1788 <tr>\r
1789 <td align="left" valign="top"><p class="table">error hashing extra file</p></td>\r
1790 <td align="left" valign="top"><p class="table">Failure reading a file specified by <strong>extra_files_to_hash</strong>\r
1791 (<strong>CCACHE_EXTRAFILES</strong>).</p></td>\r
1792 </tr>\r
1793 <tr>\r
1794 <td align="left" valign="top"><p class="table">files in cache</p></td>\r
1795 <td align="left" valign="top"><p class="table">Current number of files in the cache.</p></td>\r
1796 </tr>\r
1797 <tr>\r
1798 <td align="left" valign="top"><p class="table">multiple source files</p></td>\r
1799 <td align="left" valign="top"><p class="table">The compiler was called to compile multiple source files in one go. This is not\r
1800 supported by ccache.</p></td>\r
1801 </tr>\r
1802 <tr>\r
1803 <td align="left" valign="top"><p class="table">no input file</p></td>\r
1804 <td align="left" valign="top"><p class="table">No input file was specified to the compiler.</p></td>\r
1805 </tr>\r
1806 <tr>\r
1807 <td align="left" valign="top"><p class="table">output to a non-regular file</p></td>\r
1808 <td align="left" valign="top"><p class="table">The output path specified with <strong>-o</strong> is not a file (e.g. a directory or a device\r
1809 node).</p></td>\r
1810 </tr>\r
1811 <tr>\r
1812 <td align="left" valign="top"><p class="table">output to stdout</p></td>\r
1813 <td align="left" valign="top"><p class="table">The compiler was instructed to write its output to standard output using <strong>-o\r
1814 -</strong>. This is not supported by ccache.</p></td>\r
1815 </tr>\r
1816 <tr>\r
1817 <td align="left" valign="top"><p class="table">preprocessor error</p></td>\r
1818 <td align="left" valign="top"><p class="table">Preprocessing the source code using the compiler&#8217;s <strong>-E</strong> option failed.</p></td>\r
1819 </tr>\r
1820 <tr>\r
1821 <td align="left" valign="top"><p class="table">unsupported code directive</p></td>\r
1822 <td align="left" valign="top"><p class="table">Code like the assembler &#8220;.incbin&#8221; directive was found. This is not supported\r
1823 by ccache.</p></td>\r
1824 </tr>\r
1825 <tr>\r
1826 <td align="left" valign="top"><p class="table">unsupported compiler option</p></td>\r
1827 <td align="left" valign="top"><p class="table">A compiler option not supported by ccache was found.</p></td>\r
1828 </tr>\r
1829 <tr>\r
1830 <td align="left" valign="top"><p class="table">unsupported source language</p></td>\r
1831 <td align="left" valign="top"><p class="table">A source language e.g. specified with <strong>-x</strong> was unsupported by ccache.</p></td>\r
1832 </tr>\r
1833 </tbody>\r
1834 </table>\r
1835 </div>\r
1836 </div>\r
1837 </div>\r
1838 <div class="sect1">\r
1839 <h2 id="_how_ccache_works">How ccache works</h2>\r
1840 <div class="sectionbody">\r
1841 <div class="paragraph"><p>The basic idea is to detect when you are compiling exactly the same code a\r
1842 second time and reuse the previously produced output. The detection is done by\r
1843 hashing different kinds of information that should be unique for the\r
1844 compilation and then using the hash sum to identify the cached output. ccache\r
1845 uses MD4, a very fast cryptographic hash algorithm, for the hashing. (MD4 is\r
1846 nowadays too weak to be useful in cryptographic contexts, but it should be safe\r
1847 enough to be used to identify recompilations.) On a cache hit, ccache is able\r
1848 to supply all of the correct compiler outputs (including all warnings,\r
1849 dependency file, etc) from the cache.</p></div>\r
1850 <div class="paragraph"><p>ccache has two ways of doing the detection:</p></div>\r
1851 <div class="ulist"><ul>\r
1852 <li>\r
1853 <p>\r
1854 the <strong>direct mode</strong>, where ccache hashes the source code and include files\r
1855   directly\r
1856 </p>\r
1857 </li>\r
1858 <li>\r
1859 <p>\r
1860 the <strong>preprocessor mode</strong>, where ccache runs the preprocessor on the source\r
1861   code and hashes the result\r
1862 </p>\r
1863 </li>\r
1864 </ul></div>\r
1865 <div class="paragraph"><p>The direct mode is generally faster since running the preprocessor has some\r
1866 overhead.</p></div>\r
1867 <div class="sect2">\r
1868 <h3 id="_common_hashed_information">Common hashed information</h3>\r
1869 <div class="paragraph"><p>For both modes, the following information is included in the hash:</p></div>\r
1870 <div class="ulist"><ul>\r
1871 <li>\r
1872 <p>\r
1873 the extension used by the compiler for a file with preprocessor output\r
1874   (normally <strong>.i</strong> for C code and <strong>.ii</strong> for C++ code)\r
1875 </p>\r
1876 </li>\r
1877 <li>\r
1878 <p>\r
1879 the compiler&#8217;s size and modification time (or other compiler-specific\r
1880   information specified by the <strong>compiler_check</strong> setting)\r
1881 </p>\r
1882 </li>\r
1883 <li>\r
1884 <p>\r
1885 the name of the compiler\r
1886 </p>\r
1887 </li>\r
1888 <li>\r
1889 <p>\r
1890 the current directory (if the <strong>hash_dir</strong> setting is enabled)\r
1891 </p>\r
1892 </li>\r
1893 <li>\r
1894 <p>\r
1895 contents of files specified by the <strong>extra_files_to_hash</strong> setting (if any)\r
1896 </p>\r
1897 </li>\r
1898 </ul></div>\r
1899 </div>\r
1900 <div class="sect2">\r
1901 <h3 id="_the_direct_mode">The direct mode</h3>\r
1902 <div class="paragraph"><p>In the direct mode, the hash is formed of the common information and:</p></div>\r
1903 <div class="ulist"><ul>\r
1904 <li>\r
1905 <p>\r
1906 the input source file\r
1907 </p>\r
1908 </li>\r
1909 <li>\r
1910 <p>\r
1911 the command line options\r
1912 </p>\r
1913 </li>\r
1914 </ul></div>\r
1915 <div class="paragraph"><p>Based on the hash, a data structure called &#8220;manifest&#8221; is looked up in the\r
1916 cache. The manifest contains:</p></div>\r
1917 <div class="ulist"><ul>\r
1918 <li>\r
1919 <p>\r
1920 references to cached compilation results (object file, dependency file, etc)\r
1921   that were produced by previous compilations that matched the hash\r
1922 </p>\r
1923 </li>\r
1924 <li>\r
1925 <p>\r
1926 paths to the include files that were read at the time the compilation results\r
1927   were stored in the cache\r
1928 </p>\r
1929 </li>\r
1930 <li>\r
1931 <p>\r
1932 hash sums of the include files at the time the compilation results were\r
1933   stored in the cache\r
1934 </p>\r
1935 </li>\r
1936 </ul></div>\r
1937 <div class="paragraph"><p>The current contents of the include files are then hashed and compared to the\r
1938 information in the manifest. If there is a match, ccache knows the result of\r
1939 the compilation. If there is no match, ccache falls back to running the\r
1940 preprocessor. The output from the preprocessor is parsed to find the include\r
1941 files that were read. The paths and hash sums of those include files are then\r
1942 stored in the manifest along with information about the produced compilation\r
1943 result.</p></div>\r
1944 <div class="paragraph"><p>There is a catch with the direct mode: header files that were used by the\r
1945 compiler are recorded, but header files that were <strong>not</strong> used, but would have\r
1946 been used if they existed, are not. So, when ccache checks if a result can be\r
1947 taken from the cache, it currently can&#8217;t check if the existence of a new header\r
1948 file should invalidate the result. In practice, the direct mode is safe to use\r
1949 in the absolute majority of cases.</p></div>\r
1950 <div class="paragraph"><p>The direct mode will be disabled if any of the following holds:</p></div>\r
1951 <div class="ulist"><ul>\r
1952 <li>\r
1953 <p>\r
1954 the configuration setting <strong>direct_mode</strong> is false\r
1955 </p>\r
1956 </li>\r
1957 <li>\r
1958 <p>\r
1959 a modification time of one of the include files is too new (needed to avoid a\r
1960   race condition)\r
1961 </p>\r
1962 </li>\r
1963 <li>\r
1964 <p>\r
1965 a compiler option not supported by the direct mode is used:\r
1966 </p>\r
1967 <div class="ulist"><ul>\r
1968 <li>\r
1969 <p>\r
1970 a <strong>-Wp,<em>X</em></strong> compiler option other than <strong>-Wp,-MD,<em>path</em></strong>,\r
1971    <strong>-Wp,-MMD,<em>path</em></strong> and <strong>-Wp,-D_define_</strong>\r
1972 </p>\r
1973 </li>\r
1974 <li>\r
1975 <p>\r
1976 <strong>-Xpreprocessor</strong>\r
1977 </p>\r
1978 </li>\r
1979 </ul></div>\r
1980 </li>\r
1981 <li>\r
1982 <p>\r
1983 the string &#8220;__TIME__&#8221; is present in the source code\r
1984 </p>\r
1985 </li>\r
1986 </ul></div>\r
1987 </div>\r
1988 <div class="sect2">\r
1989 <h3 id="_the_preprocessor_mode">The preprocessor mode</h3>\r
1990 <div class="paragraph"><p>In the preprocessor mode, the hash is formed of the common information and:</p></div>\r
1991 <div class="ulist"><ul>\r
1992 <li>\r
1993 <p>\r
1994 the preprocessor output from running the compiler with <strong>-E</strong>\r
1995 </p>\r
1996 </li>\r
1997 <li>\r
1998 <p>\r
1999 the command line options except options that affect include files (<strong>-I</strong>,\r
2000   <strong>-include</strong>, <strong>-D</strong>, etc; the theory is that these options will change the\r
2001   preprocessor output if they have any effect at all)\r
2002 </p>\r
2003 </li>\r
2004 <li>\r
2005 <p>\r
2006 any standard error output generated by the preprocessor\r
2007 </p>\r
2008 </li>\r
2009 </ul></div>\r
2010 <div class="paragraph"><p>Based on the hash, the cached compilation result can be looked up directly in\r
2011 the cache.</p></div>\r
2012 </div>\r
2013 </div>\r
2014 </div>\r
2015 <div class="sect1">\r
2016 <h2 id="_compiling_in_different_directories">Compiling in different directories</h2>\r
2017 <div class="sectionbody">\r
2018 <div class="paragraph"><p>Some information included in the hash that identifies a unique compilation can\r
2019 contain absolute paths:</p></div>\r
2020 <div class="ulist"><ul>\r
2021 <li>\r
2022 <p>\r
2023 The preprocessed source code may contain absolute paths to include files if\r
2024   the compiler option <strong>-g</strong> is used or if absolute paths are given to <strong>-I</strong> and\r
2025   similar compiler options.\r
2026 </p>\r
2027 </li>\r
2028 <li>\r
2029 <p>\r
2030 Paths specified by compiler options (such as <strong>-I</strong>, <strong>-MF</strong>, etc) on the command\r
2031   line may be absolute.\r
2032 </p>\r
2033 </li>\r
2034 <li>\r
2035 <p>\r
2036 The source code file path may be absolute, and that path may substituted for\r
2037   <strong>__FILE__</strong> macros in the source code or included in warnings emitted to\r
2038   standard error by the preprocessor.\r
2039 </p>\r
2040 </li>\r
2041 </ul></div>\r
2042 <div class="paragraph"><p>This means that if you compile the same code in different locations, you can&#8217;t\r
2043 share compilation results between the different build directories since you get\r
2044 cache misses because of the absolute build directory paths that are part of the\r
2045 hash.</p></div>\r
2046 <div class="paragraph"><p>Here&#8217;s what can be done to enable cache hits between different build\r
2047 directories:</p></div>\r
2048 <div class="ulist"><ul>\r
2049 <li>\r
2050 <p>\r
2051 If you build with <strong>-g</strong> (or similar) to add debug information to the object\r
2052   file, you must either:\r
2053 </p>\r
2054 <div class="openblock">\r
2055 <div class="content">\r
2056 <div class="ulist"><ul>\r
2057 <li>\r
2058 <p>\r
2059 use the <strong>-fdebug-prefix-map=<em>old</em>=<em>new</em></strong> option for relocating debug info to\r
2060    a common prefix (e.g. <strong>-fdebug-prefix-map=$PWD=.</strong>); or\r
2061 </p>\r
2062 </li>\r
2063 <li>\r
2064 <p>\r
2065 set <strong>hash_dir = false</strong>.\r
2066 </p>\r
2067 </li>\r
2068 </ul></div>\r
2069 </div></div>\r
2070 </li>\r
2071 <li>\r
2072 <p>\r
2073 If you use absolute paths anywhere on the command line (e.g. the source code\r
2074   file path or an argument to compiler options like <strong>-I</strong> and <strong>-MF</strong>), you must\r
2075   to set <strong>base_dir</strong> to an absolute path to a &#8220;base directory&#8221;. ccache will\r
2076   then rewrite absolute paths under that directory to relative before computing\r
2077   the hash.\r
2078 </p>\r
2079 </li>\r
2080 </ul></div>\r
2081 </div>\r
2082 </div>\r
2083 <div class="sect1">\r
2084 <h2 id="_precompiled_headers">Precompiled headers</h2>\r
2085 <div class="sectionbody">\r
2086 <div class="paragraph"><p>ccache has support for GCC&#8217;s precompiled headers. However, you have to do some\r
2087 things to make it work properly:</p></div>\r
2088 <div class="ulist"><ul>\r
2089 <li>\r
2090 <p>\r
2091 You must set <strong>sloppiness</strong> to <strong>pch_defines,time_macros</strong>. The reason is that\r
2092   ccache can&#8217;t tell whether <strong>__TIME__</strong> or <strong>__DATE__</strong> is used when using a\r
2093   precompiled header. Further, it can&#8217;t detect changes in <strong>#define</strong>s in the\r
2094   source code because of how preprocessing works in combination with\r
2095   precompiled headers.\r
2096 </p>\r
2097 </li>\r
2098 <li>\r
2099 <p>\r
2100 You must either:\r
2101 </p>\r
2102 <div class="openblock">\r
2103 <div class="content">\r
2104 <div class="ulist"><ul>\r
2105 <li>\r
2106 <p>\r
2107 use the <strong>-include</strong> compiler option to include the precompiled header\r
2108    (i.e., don&#8217;t use <strong>#include</strong> in the source code to include the header); or\r
2109 </p>\r
2110 </li>\r
2111 <li>\r
2112 <p>\r
2113 (for the Clang compiler) use the <strong>-include-pch</strong> compiler option to include\r
2114    the PCH file generated from the precompiled header; or\r
2115 </p>\r
2116 </li>\r
2117 <li>\r
2118 <p>\r
2119 add the <strong>-fpch-preprocess</strong> compiler option when compiling.\r
2120 </p>\r
2121 </li>\r
2122 </ul></div>\r
2123 <div class="paragraph"><p>If you don&#8217;t do this, either the non-precompiled version of the header file\r
2124 will be used (if available) or ccache will fall back to running the real\r
2125 compiler and increase the statistics counter &#8220;preprocessor error&#8221; (if the\r
2126 non-precompiled header file is not available).</p></div>\r
2127 </div></div>\r
2128 </li>\r
2129 </ul></div>\r
2130 </div>\r
2131 </div>\r
2132 <div class="sect1">\r
2133 <h2 id="_sharing_a_cache">Sharing a cache</h2>\r
2134 <div class="sectionbody">\r
2135 <div class="paragraph"><p>A group of developers can increase the cache hit rate by sharing a cache\r
2136 directory. To share a cache without unpleasant side effects, the following\r
2137 conditions should to be met:</p></div>\r
2138 <div class="ulist"><ul>\r
2139 <li>\r
2140 <p>\r
2141 Use the same cache directory.\r
2142 </p>\r
2143 </li>\r
2144 <li>\r
2145 <p>\r
2146 Make sure that the configuration setting <strong>hard_link</strong> is false (which is the\r
2147   default).\r
2148 </p>\r
2149 </li>\r
2150 <li>\r
2151 <p>\r
2152 Make sure that all users are in the same group.\r
2153 </p>\r
2154 </li>\r
2155 <li>\r
2156 <p>\r
2157 Set the configuration setting <strong>umask</strong> to 002. This ensures that cached files\r
2158   are accessible to everyone in the group.\r
2159 </p>\r
2160 </li>\r
2161 <li>\r
2162 <p>\r
2163 Make sure that all users have write permission in the entire cache directory\r
2164   (and that you trust all users of the shared cache).\r
2165 </p>\r
2166 </li>\r
2167 <li>\r
2168 <p>\r
2169 Make sure that the setgid bit is set on all directories in the cache. This\r
2170   tells the filesystem to inherit group ownership for new directories. The\r
2171   following command might be useful for this:\r
2172 </p>\r
2173 <div class="openblock">\r
2174 <div class="content">\r
2175 <div class="listingblock">\r
2176 <div class="content">\r
2177 <pre><code>find $CCACHE_DIR -type d | xargs chmod g+s</code></pre>\r
2178 </div></div>\r
2179 </div></div>\r
2180 </li>\r
2181 </ul></div>\r
2182 <div class="paragraph"><p>The reason to avoid the hard link mode is that the hard links cause unwanted\r
2183 side effects, as all links to a cached file share the file&#8217;s modification\r
2184 timestamp. This results in false dependencies to be triggered by\r
2185 timestamp-based build systems whenever another user links to an existing file.\r
2186 Typically, users will see that their libraries and binaries are relinked\r
2187 without reason.</p></div>\r
2188 <div class="paragraph"><p>You may also want to make sure that a base directory is set appropriately, as\r
2189 discussed in a previous section.</p></div>\r
2190 </div>\r
2191 </div>\r
2192 <div class="sect1">\r
2193 <h2 id="_sharing_a_cache_on_nfs">Sharing a cache on NFS</h2>\r
2194 <div class="sectionbody">\r
2195 <div class="paragraph"><p>It is possible to put the cache directory on an NFS filesystem (or similar\r
2196 filesystems), but keep in mind that:</p></div>\r
2197 <div class="ulist"><ul>\r
2198 <li>\r
2199 <p>\r
2200 Having the cache on NFS may slow down compilation. Make sure to do some\r
2201   benchmarking to see if it&#8217;s worth it.\r
2202 </p>\r
2203 </li>\r
2204 <li>\r
2205 <p>\r
2206 ccache hasn&#8217;t been tested very thoroughly on NFS.\r
2207 </p>\r
2208 </li>\r
2209 </ul></div>\r
2210 <div class="paragraph"><p>A tip is to set <strong>temporary_dir</strong> to a directory on the local host to avoid NFS\r
2211 traffic for temporary files.</p></div>\r
2212 </div>\r
2213 </div>\r
2214 <div class="sect1">\r
2215 <h2 id="_using_ccache_with_other_compiler_wrappers">Using ccache with other compiler wrappers</h2>\r
2216 <div class="sectionbody">\r
2217 <div class="paragraph"><p>The recommended way of combining ccache with another compiler wrapper (such as\r
2218 &#8220;distcc&#8221;) is by letting ccache execute the compiler wrapper. This is\r
2219 accomplished by defining the configuration setting <strong>prefix_command</strong>, for\r
2220 example by setting the environment variable <strong>CCACHE_PREFIX</strong> to the name of the\r
2221 wrapper (e.g. <strong>distcc</strong>). ccache will then prefix the command line with the\r
2222 specified command when running the compiler. To specify several prefix\r
2223 commands, set <strong>prefix_command</strong> to a colon-separated list of commands.</p></div>\r
2224 <div class="paragraph"><p>Unless you set <strong>compiler_check</strong> to a suitable command (see the description of\r
2225 that configuration option), it is not recommended to use the form <strong>ccache\r
2226 anotherwrapper compiler args</strong> as the compilation command. It&#8217;s also not\r
2227 recommended to use the masquerading technique for the other compiler wrapper.\r
2228 The reason is that by default, ccache will in both cases hash the mtime and\r
2229 size of the other wrapper instead of the real compiler, which means that:</p></div>\r
2230 <div class="ulist"><ul>\r
2231 <li>\r
2232 <p>\r
2233 Compiler upgrades will not be detected properly.\r
2234 </p>\r
2235 </li>\r
2236 <li>\r
2237 <p>\r
2238 The cached results will not be shared between compilations with and without\r
2239   the other wrapper.\r
2240 </p>\r
2241 </li>\r
2242 </ul></div>\r
2243 <div class="paragraph"><p>Another minor thing is that if <strong>prefix_command</strong> is used, ccache will not invoke\r
2244 the other wrapper when running the preprocessor, which increases performance.\r
2245 You can use the <strong>prefix_command_cpp</strong> configuration setting if you also want to\r
2246 invoke the other wrapper when doing preprocessing (normally by adding <strong>-E</strong>).</p></div>\r
2247 </div>\r
2248 </div>\r
2249 <div class="sect1">\r
2250 <h2 id="_caveats">Caveats</h2>\r
2251 <div class="sectionbody">\r
2252 <div class="ulist"><ul>\r
2253 <li>\r
2254 <p>\r
2255 The direct mode fails to pick up new header files in some rare scenarios. See\r
2256   <a href="#_the_direct_mode">THE DIRECT MODE</a> above.\r
2257 </p>\r
2258 </li>\r
2259 <li>\r
2260 <p>\r
2261 When run via ccache, warning messages produced by GCC 4.9 and newer will only\r
2262   be colored when the environment variable <strong>GCC_COLORS</strong> is set. An alternative\r
2263   to setting <strong>GCC_COLORS</strong> is to pass <code>-fdiagnostics-color</code> explicitly when\r
2264   compiling (but then color codes will also be present when redirecting stderr\r
2265   to a file).\r
2266 </p>\r
2267 </li>\r
2268 <li>\r
2269 <p>\r
2270 If ccache guesses that the compiler may emit colored warnings, then a\r
2271   compilation with stderr referring to a TTY will be considered different from\r
2272   a compilation with a redirected stderr, thus not sharing cache entries. This\r
2273   happens for clang by default and for GCC when <strong>GCC_COLORS</strong> is set as\r
2274   mentioned above. If you want to share cache hits, you can pass\r
2275   <code>-f[no-]diagnostics-color</code> (GCC) or <code>-f[no-]color-diagnostics</code> (clang)\r
2276   explicitly when compiling (but then color codes will be either on or off for\r
2277   both the TTY and the redirected case).\r
2278 </p>\r
2279 </li>\r
2280 </ul></div>\r
2281 </div>\r
2282 </div>\r
2283 <div class="sect1">\r
2284 <h2 id="_troubleshooting">Troubleshooting</h2>\r
2285 <div class="sectionbody">\r
2286 <div class="sect2">\r
2287 <h3 id="_general">General</h3>\r
2288 <div class="paragraph"><p>A general tip for getting information about what ccache is doing is to enable\r
2289 debug logging by setting <strong>log_file</strong>. The log contains executed commands,\r
2290 important decisions that ccache makes, read and written files, etc. Another way\r
2291 of keeping track of what is happening is to check the output of <strong>ccache -s</strong>.</p></div>\r
2292 </div>\r
2293 <div class="sect2">\r
2294 <h3 id="_performance">Performance</h3>\r
2295 <div class="paragraph"><p>ccache has been written to perform well out of the box, but sometimes you may\r
2296 have to do some adjustments of how you use the compiler and ccache in order to\r
2297 improve performance.</p></div>\r
2298 <div class="paragraph"><p>Since ccache works best when I/O is fast, put the cache directory on a fast\r
2299 storage device if possible. Having lots of free memory so that files in the\r
2300 cache directory stay in the disk cache is also preferable.</p></div>\r
2301 <div class="paragraph"><p>A good way of monitoring how well ccache works is to run <strong>ccache -s</strong> before and\r
2302 after your build and then compare the statistics counters. Here are some common\r
2303 problems and what may be done to increase the hit rate:</p></div>\r
2304 <div class="ulist"><ul>\r
2305 <li>\r
2306 <p>\r
2307 If &#8220;cache hit (preprocessed)&#8221; has been incremented instead of &#8220;cache hit\r
2308   (direct)&#8221;, ccache has fallen back to preprocessor mode, which is generally\r
2309   slower. Some possible reasons are:\r
2310 </p>\r
2311 <div class="ulist"><ul>\r
2312 <li>\r
2313 <p>\r
2314 The source code has been modified in such a way that the preprocessor output\r
2315    is not affected.\r
2316 </p>\r
2317 </li>\r
2318 <li>\r
2319 <p>\r
2320 Compiler arguments that are hashed in the direct mode but not in the\r
2321    preprocessor mode have changed (<strong>-I</strong>, <strong>-include</strong>, <strong>-D</strong>, etc) and they didn&#8217;t\r
2322    affect the preprocessor output.\r
2323 </p>\r
2324 </li>\r
2325 <li>\r
2326 <p>\r
2327 The compiler option <strong>-Xpreprocessor</strong> or <strong>-Wp,<em>X</em></strong> (except <strong>-Wp,-MD,<em>path</em></strong>,\r
2328    <strong>-Wp,-MMD,<em>path</em></strong>, and <strong>-Wp,-D_define_</strong>) is used.\r
2329 </p>\r
2330 </li>\r
2331 <li>\r
2332 <p>\r
2333 This was the first compilation with a new value of the base directory\r
2334    setting.\r
2335 </p>\r
2336 </li>\r
2337 <li>\r
2338 <p>\r
2339 A modification time of one of the include files is too new (created the same\r
2340    second as the compilation is being done). This check is made to avoid a race\r
2341    condition. To fix this, create the include file earlier in the build\r
2342    process, if possible, or set <strong>sloppiness</strong> to <strong>include_file_mtime</strong> if you are\r
2343    willing to take the risk. (The race condition consists of these events: the\r
2344    preprocessor is run; an include file is modified by someone; the new include\r
2345    file is hashed by ccache; the real compiler is run on the preprocessor&#8217;s\r
2346    output, which contains data from the old header file; the wrong object file\r
2347    is stored in the cache.)\r
2348 </p>\r
2349 </li>\r
2350 <li>\r
2351 <p>\r
2352 The <strong>__TIME__</strong> preprocessor macro is (potentially) being used. ccache\r
2353    turns off direct mode if &#8220;__TIME__&#8221; is present in the source code. This\r
2354    is done as a safety measure since the string indicates that a <strong>__TIME__</strong>\r
2355    macro <em>may</em> affect the output. (To be sure, ccache would have to run the\r
2356    preprocessor, but the sole point of the direct mode is to avoid that.) If\r
2357    you know that <strong>__TIME__</strong> isn&#8217;t used in practise, or don&#8217;t care if ccache\r
2358    produces objects where <strong>__TIME__</strong> is expanded to something in the past,\r
2359    you can set <strong>sloppiness</strong> to <strong>time_macros</strong>.\r
2360 </p>\r
2361 </li>\r
2362 <li>\r
2363 <p>\r
2364 The <strong>__DATE__</strong> preprocessor macro is (potentially) being used and the\r
2365    date has changed. This is similar to how <strong>__TIME__</strong> is handled. If\r
2366    &#8220;__DATE__&#8221; is present in the source code, ccache hashes the current\r
2367    date in order to be able to produce the correct object file if the\r
2368    <strong>__DATE__</strong> macro affects the output. If you know that <strong>__DATE__</strong> isn&#8217;t\r
2369    used in practise, or don&#8217;t care if ccache produces objects where\r
2370    <strong>__DATE__</strong> is expanded to something in the past, you can set <strong>sloppiness</strong>\r
2371    to <strong>time_macros</strong>.\r
2372 </p>\r
2373 </li>\r
2374 <li>\r
2375 <p>\r
2376 The <strong>__FILE__</strong> preprocessor macro is (potentially) being used and the\r
2377    file path has changed. If &#8220;__FILE__&#8221; is present in the source code,\r
2378    ccache hashes the current input file path in order to be able to produce the\r
2379    correct object file if the <strong>__FILE__</strong> macro affects the output. If you\r
2380    know that <strong>__FILE__</strong> isn&#8217;t used in practise, or don&#8217;t care if ccache\r
2381    produces objects where <strong>__FILE__</strong> is expanded to the wrong path, you can\r
2382    set <strong>sloppiness</strong> to <strong>file_macro</strong>.\r
2383 </p>\r
2384 </li>\r
2385 </ul></div>\r
2386 </li>\r
2387 <li>\r
2388 <p>\r
2389 If &#8220;cache miss&#8221; has been incremented even though the same code has been\r
2390   compiled and cached before, ccache has either detected that something has\r
2391   changed anyway or a cleanup has been performed (either explicitly or\r
2392   implicitly when a cache limit has been reached). Some perhaps unobvious\r
2393   things that may result in a cache miss are usage of <strong>__TIME__</strong> or\r
2394   <strong>__DATE__</strong> macros, or use of automatically generated code that contains a\r
2395   timestamp, build counter or other volatile information.\r
2396 </p>\r
2397 </li>\r
2398 <li>\r
2399 <p>\r
2400 If &#8220;multiple source files&#8221; has been incremented, it&#8217;s an indication that\r
2401   the compiler has been invoked on several source code files at once. ccache\r
2402   doesn&#8217;t support that. Compile the source code files separately if possible.\r
2403 </p>\r
2404 </li>\r
2405 <li>\r
2406 <p>\r
2407 If &#8220;unsupported compiler option&#8221; has been incremented, enable debug logging\r
2408   and check which option was rejected.\r
2409 </p>\r
2410 </li>\r
2411 <li>\r
2412 <p>\r
2413 If &#8220;preprocessor error&#8221; has been incremented, one possible reason is that\r
2414   precompiled headers are being used. See <a href="#_precompiled_headers">PRECOMPILED   HEADERS</a> for how to remedy this.\r
2415 </p>\r
2416 </li>\r
2417 <li>\r
2418 <p>\r
2419 If &#8220;can&#8217;t use precompiled header&#8221; has been incremented, see\r
2420   <a href="#_precompiled_headers">PRECOMPILED HEADERS</a>.\r
2421 </p>\r
2422 </li>\r
2423 </ul></div>\r
2424 </div>\r
2425 <div class="sect2">\r
2426 <h3 id="_corrupt_object_files">Corrupt object files</h3>\r
2427 <div class="paragraph"><p>It should be noted that ccache is susceptible to general storage problems. If a\r
2428 bad object file sneaks into the cache for some reason, it will of course stay\r
2429 bad. Some possible reasons for erroneous object files are bad hardware (disk\r
2430 drive, disk controller, memory, etc), buggy drivers or file systems, a bad\r
2431 <strong>prefix_command</strong> or compiler wrapper. If this happens, the easiest way of\r
2432 fixing it is this:</p></div>\r
2433 <div class="olist arabic"><ol class="arabic">\r
2434 <li>\r
2435 <p>\r
2436 Build so that the bad object file ends up in the build tree.\r
2437 </p>\r
2438 </li>\r
2439 <li>\r
2440 <p>\r
2441 Remove the bad object file from the build tree.\r
2442 </p>\r
2443 </li>\r
2444 <li>\r
2445 <p>\r
2446 Rebuild with <strong>CCACHE_RECACHE</strong> set.\r
2447 </p>\r
2448 </li>\r
2449 </ol></div>\r
2450 <div class="paragraph"><p>An alternative is to clear the whole cache with <strong>ccache -C</strong> if you don&#8217;t mind\r
2451 losing other cached results.</p></div>\r
2452 <div class="paragraph"><p>There are no reported issues about ccache producing broken object files\r
2453 reproducibly. That doesn&#8217;t mean it can&#8217;t happen, so if you find a repeatable\r
2454 case, please report it.</p></div>\r
2455 </div>\r
2456 </div>\r
2457 </div>\r
2458 <div class="sect1">\r
2459 <h2 id="_more_information">More information</h2>\r
2460 <div class="sectionbody">\r
2461 <div class="paragraph"><p>Credits, mailing list information, bug reporting instructions, source code,\r
2462 etc, can be found on ccache&#8217;s web site: <a href="https://ccache.samba.org">https://ccache.samba.org</a>.</p></div>\r
2463 </div>\r
2464 </div>\r
2465 <div class="sect1">\r
2466 <h2 id="_author">Author</h2>\r
2467 <div class="sectionbody">\r
2468 <div class="paragraph"><p>ccache was originally written by Andrew Tridgell and is currently developed and\r
2469 maintained by Joel Rosdahl. See AUTHORS.txt or AUTHORS.html and\r
2470 <a href="https://ccache.samba.org/credits.html">https://ccache.samba.org/credits.html</a> for a list of contributors.</p></div>\r
2471 </div>\r
2472 </div>\r
2473 </div>\r
2474 <div id="footnotes"><hr /></div>\r
2475 <div id="footer">\r
2476 <div id="footer-text">\r
2477 Version 3.4<br />\r
2478 Last updated\r
2479  2018-02-06 21:44:11 CET\r
2480 </div>\r
2481 </div>\r
2482 </body>\r
2483 </html>\r