Install ccache to speed up compile times for compiling c and c++ code. Installation on fedora is simple.
Before installation, your compilers were found in /usr/bin
/usr/bin/gcc /usr/bin/cc
After installing ccache, each binary got replaced by a softlink to ccache.
c++ -> ../../bin/ccache cc -> ../../bin/ccache g++ -> ../../bin/ccache gcc -> ../../bin/ccache x86_64-redhat-linux-c++ -> ../../bin/ccache x86_64-redhat-linux-g++ -> ../../bin/ccache x86_64-redhat-linux-gcc -> ../../bin/ccache
This would be simple to install from scratch. You would need to move the binaries and create each softlink yourself. The other way to run it is to replace your calls to the compilers with ccache. But that would require you edit each project individually. I like the softlinks because it just works right out of the box.
To make sure it’s working, check out the statistics, or just build something that normally takes a long time to compile!
Before:
cache directory /var/cache/ccache cache hit 0 cache miss 0 files in cache 1772 cache size 27.0 Mbytes max cache size 976.6 Mbytes
After compiling something:
cache directory /var/cache/ccache cache hit 166 cache miss 886 called for link 40 multiple source files 2 compile failed 15 preprocessor error 90 not a C/C++ file 24 autoconf compile/link 95 no input file 903 files in cache 1772 cache size 27.0 Mbytes max cache size 976.6 Mbytes