📄 ccache-man.html
字号:
used.<p><p></p><dt><strong><strong>CCACHE_NOSTATS</strong></strong><dd> If you set the environment variableCCACHE_NOSTATS then ccache will not update the statistics files oneach compile.<p><p></p><dt><strong><strong>CCACHE_NLEVELS</strong></strong><dd> The environment variable CCACHE_NLEVELS allowsyou to choose the number of levels of hash in the cache directory. Thedefault is 2. The minimum is 1 and the maximum is 8. <p><p></p><dt><strong><strong>CCACHE_HARDLINK</strong></strong><dd> If you set the environment variableCCACHE_HARDLINK then ccache will attempt to use hard links from thecache directory when creating the compiler output rather than using afile copy. Using hard links is faster, but can confuse programs like'make' that rely on modification times.<p><p></p><dt><strong><strong>CCACHE_RECACHE</strong></strong><dd> This forces ccache to not use any cachedresults, even if it finds them. New results are still cached, butexisting cache entries are ignored.<p><p></p><dt><strong><strong>CCACHE_UMASK</strong></strong><dd> This sets the umask for ccache and all childprocesses (such as the compiler). This is mostly useful when you wishto share your cache with other users. Note that this also affects thefile permissions set on the object files created from yourcompilations.<p><p></p><dt><strong><strong>CCACHE_HASHDIR</strong></strong><dd> This tells ccache to hash the current workingdirectory when calculating the hash that is used to distinguish twocompiles. This prevents a problem with the storage of the currentworking directory in the debug info of a object file, which can leadccache to give a cached object file that has the working directory inthe debug info set incorrectly. This option is off by default as theincorrect setting of this debug info rarely causes problems. If youstrike problems with gdb not using the correct directory then enablethis option.<p><p></p><dt><strong><strong>CCACHE_UNIFY</strong></strong><dd> If you set the environment variable CCACHE_UNIFYthen ccache will use the C/C++ unifier when hashing the pre-processoroutput if -g is not used in the compile. The unifier is slower than anormal hash, so setting this environment variable loses a little bitof speed, but it means that ccache can take advantage of notrecompiling when the changes to the source code consist ofreformatting only. Note that using CCACHE_UNIFY changes the hash, socached compiles with CCACHE_UNIFY set cannot be used whenCCACHE_UNIFY is not set and vice versa. The reason the unifier is offby default is that it can give incorrect line number information incompiler warning messages.<p><p></p><dt><strong><strong>CCACHE_EXTENSION</strong></strong><dd> Normally ccache tries to automaticallydetermine the extension to use for intermediate C pre-processor filesbased on the type of file being compiled. Unfortunately this sometimesdoesn't work, for example when using the aCC compiler on HP-UX. Onsystems like this you can use the CCACHE_EXTENSION option to overridethe default. On HP-UX set this environment variable to "i" if you usethe aCC compiler.<p></dl><p><h2>CACHE SIZE MANAGEMENT</h2> <p>By default ccache has a one gigabyte limit on the cache size and nomaximum number of files. You can set a different limit using the"ccache -M" and "ccache -F" options, which set the size and number offiles limits.<p>When these limits are reached ccache will reduce the cache to 20%below the numbers you specified in order to avoid doing the cacheclean operation too often.<p><h2>HOW IT WORKS</h2> <p>The basic idea is to detect when you are compiling exactly the samecode a 2nd time and use the previously compiled output. You detectthat it is the same code by forming a hash of:<p><ul> <li > the pre-processor output from running the compiler with -E <li > the command line options <li > the real compilers size and modification time <li > any stderr output generated by the compiler</ul><p>These are hashed using md4 (a strong hash) and a cache file is formedbased on that hash result. When the same compilation is done a secondtime ccache is able to supply the correct compiler output (includingall warnings etc) from the cache.<p>ccache has been carefully written to always produce exactly the samecompiler output that you would get without the cache. If you everdiscover a case where ccache changes the output of your compiler thenplease let me know.<p><h2>USING CCACHE WITH DISTCC</h2> <p>distcc is a very useful program for distributing compilation across arange of compiler servers. It is often useful to combine distcc withccache, so that compiles that are done are sped up by distcc, but thatccache avoids the compile completely where possible.<p>To use distcc with ccache I recommend using the CCACHE_PREFIXoption. You just need to set the environment variable CCACHE_PREFIX to'distcc' and ccache will prefix the command line used with thecompiler with the command 'distcc'. <p><h2>SHARING A CACHE</h2> <p>A group of developers can increase the cache hit rate by sharing acache directory. The hard links however cause unwanted side effects,as all links to a cached file share the file's modification timestamp.This results in false dependencies to be triggered by timestamp-basedbuild systems whenever another user links to an existingfile. Typically, users will see that their libraries and binaries arerelinked without reason. To share a cache without side effects, thefollowing conditions need to be met:<p><ul> <li > Use the same <strong>CCACHE_DIR</strong> environment variable setting <li > Set the <strong>CCACHE_NOLINK</strong> environment variable <li > Make sure everyone sets the CCACHE_UMASK environment variable to 002, this ensures that cached files are accessible to everyone in the group. <li > Make sure that all users have write permission in the entire cache directory (and that you trust all users of the shared cache). <li > Make sure that the setgid bit is set on all directories in the cache. This tells the filesystem to inherit group ownership for new directories. The command "chmod g+s `find $CCACHE_DIR -type d`" might be useful for this.</ul><p><h2>HISTORY</h2> <p>ccache was inspired by the compilercache shell script script writtenby Erik Thiele and I would like to thank him for an excellent piece ofwork. See <a href="http://www.erikyyy.de/compilercache/">http://www.erikyyy.de/compilercache/</a>for the Erik's scripts.<p>I wrote ccache because I wanted to get a bit more speed out of acompiler cache and I wanted to remove some of the limitations of theshell-script version.<p><h2>DIFFERENCES FROM COMPILERCACHE</h2> <p>The biggest differences between Erik's compilercache script and ccacheare:<ul><li > ccache is written in C, which makes it a bit faster (calling out to external programs is mostly what slowed down the scripts).<li > ccache can automatically find the real compiler<li > ccache keeps statistics on hits/misses<li > ccache can do automatic cache management<li > ccache can cache compiler output that includes warnings. In many cases this gives ccache a much higher cache hit rate.<li > ccache can handle a much wider ranger of compiler options<li > ccache avoids a double call to cpp on a cache miss</ul><p><h2>BUGS</h2> <p>When the cache is stored on an NFS filesystem, the filesystem must beexported with the <strong>no_subtree_check</strong> option to make renames betweendirectories reliable.<p><h2>CREDITS</h2> <p>Thanks to the following people for their contributions to ccache<ul> <li > Erik Thiele for the original compilercache script <li > Luciano Rocha for the idea of compiling the pre-processor output to avoid a 2nd cpp pass <li > Paul Russell for many suggestions and the debian packaging</ul><p><h2>AUTHOR</h2> <p>ccache was written by Andrew Tridgell<a href="http://samba.org/~tridge/">http://samba.org/~tridge/</a><p>If you wish to report a problem or make a suggestion then please emailbugs@ccache.samba.org<p>ccache is released under the GNU General Public License version 2 orlater. Please see the file COPYING for license details.</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -