How To Install ccache on CentOS 8

ccache is C/C++ compiler cache

Introduction

In this tutorial we learn how to install ccache on CentOS 8.

What is ccache

ccache is a compiler cache. It speeds up recompilation of C/C++ code by caching previous compiles and detecting when the same compile is being done again. The main focus is to handle the GNU C/C++ compiler (GCC), but it may also work with compilers that mimic GCC good enough.

We can use yum or dnf to install ccache on CentOS 8. In this tutorial we discuss both methods but you only need to choose one of method to install ccache.

Install ccache on CentOS 8 Using dnf

Update yum database with dnf using the following command.

sudo dnf makecache --refresh

The output should look something like this:

CentOS Linux 8 - AppStream                                       43 kB/s | 4.3 kB     00:00    
CentOS Linux 8 - BaseOS                                          65 kB/s | 3.9 kB     00:00    
CentOS Linux 8 - ContinuousRelease                               43 kB/s | 3.0 kB     00:00    
CentOS Linux 8 - Extras                                          23 kB/s | 1.5 kB     00:00    
CentOS Linux 8 - FastTrack                                       40 kB/s | 3.0 kB     00:00    
CentOS Linux 8 - HighAvailability                                36 kB/s | 3.9 kB     00:00    
CentOS Linux 8 - Plus                                            24 kB/s | 1.5 kB     00:00    
CentOS Linux 8 - PowerTools                                      50 kB/s | 4.3 kB     00:00    
Extra Packages for Enterprise Linux Modular 8 - x86_64           13 kB/s | 9.2 kB     00:00    
Extra Packages for Enterprise Linux 8 - x86_64                   24 kB/s | 8.5 kB     00:00    
Metadata cache created.

After updating yum database, We can install ccache using dnf by running the following command:

sudo dnf -y install ccache

Install ccache on CentOS 8 Using yum

Update yum database with yum using the following command.

sudo yum makecache --refresh

The output should look something like this:

CentOS Linux 8 - AppStream                                       43 kB/s | 4.3 kB     00:00    
CentOS Linux 8 - BaseOS                                          65 kB/s | 3.9 kB     00:00    
CentOS Linux 8 - ContinuousRelease                               43 kB/s | 3.0 kB     00:00    
CentOS Linux 8 - Extras                                          23 kB/s | 1.5 kB     00:00    
CentOS Linux 8 - FastTrack                                       40 kB/s | 3.0 kB     00:00    
CentOS Linux 8 - HighAvailability                                36 kB/s | 3.9 kB     00:00    
CentOS Linux 8 - Plus                                            24 kB/s | 1.5 kB     00:00    
CentOS Linux 8 - PowerTools                                      50 kB/s | 4.3 kB     00:00    
Extra Packages for Enterprise Linux Modular 8 - x86_64           13 kB/s | 9.2 kB     00:00    
Extra Packages for Enterprise Linux 8 - x86_64                   24 kB/s | 8.5 kB     00:00    
Metadata cache created.

After updating yum database, We can install ccache using yum by running the following command:

sudo yum -y install ccache

How To Uninstall ccache on CentOS 8

To uninstall only the ccache package we can use the following command:

sudo dnf remove ccache

ccache Package Contents on CentOS 8

/etc/profile.d/ccache.csh
/etc/profile.d/ccache.sh
/usr/bin/ccache
/usr/lib/.build-id
/usr/lib/.build-id/d6
/usr/lib/.build-id/d6/2a9d0b0a994c27e7eb683dbb473554e515f016
/usr/lib64/ccache
/usr/lib64/ccache/aarch64-linux-gnu-c++
/usr/lib64/ccache/aarch64-linux-gnu-cc
/usr/lib64/ccache/aarch64-linux-gnu-g++
/usr/lib64/ccache/aarch64-linux-gnu-gcc
/usr/lib64/ccache/alpha-linux-gnu-c++
/usr/lib64/ccache/alpha-linux-gnu-cc
/usr/lib64/ccache/alpha-linux-gnu-g++
/usr/lib64/ccache/alpha-linux-gnu-gcc
/usr/lib64/ccache/arm-gp2x-linux-c++
/usr/lib64/ccache/arm-gp2x-linux-cc
/usr/lib64/ccache/arm-gp2x-linux-g++
/usr/lib64/ccache/arm-gp2x-linux-gcc
/usr/lib64/ccache/arm-linux-gnu-c++
/usr/lib64/ccache/arm-linux-gnu-cc
/usr/lib64/ccache/arm-linux-gnu-g++
/usr/lib64/ccache/arm-linux-gnu-gcc
/usr/lib64/ccache/arm-none-eabi-c++
/usr/lib64/ccache/arm-none-eabi-cc
/usr/lib64/ccache/arm-none-eabi-g++
/usr/lib64/ccache/arm-none-eabi-gcc
/usr/lib64/ccache/athlon-redhat-linux-c++
/usr/lib64/ccache/athlon-redhat-linux-cc
/usr/lib64/ccache/athlon-redhat-linux-g++
/usr/lib64/ccache/athlon-redhat-linux-gcc
/usr/lib64/ccache/avr-c++
/usr/lib64/ccache/avr-cc
/usr/lib64/ccache/avr-g++
/usr/lib64/ccache/avr-gcc
/usr/lib64/ccache/avr32-linux-gnu-c++
/usr/lib64/ccache/avr32-linux-gnu-cc
/usr/lib64/ccache/avr32-linux-gnu-g++
/usr/lib64/ccache/avr32-linux-gnu-gcc
/usr/lib64/ccache/bfin-linux-gnu-c++
/usr/lib64/ccache/bfin-linux-gnu-cc
/usr/lib64/ccache/bfin-linux-gnu-g++
/usr/lib64/ccache/bfin-linux-gnu-gcc
/usr/lib64/ccache/c++
/usr/lib64/ccache/c++32
/usr/lib64/ccache/c++34
/usr/lib64/ccache/c++4
/usr/lib64/ccache/c++44
/usr/lib64/ccache/c6x-linux-gnu-c++
/usr/lib64/ccache/c6x-linux-gnu-cc
/usr/lib64/ccache/c6x-linux-gnu-g++
/usr/lib64/ccache/c6x-linux-gnu-gcc
/usr/lib64/ccache/cc
/usr/lib64/ccache/cc32
/usr/lib64/ccache/cc34
/usr/lib64/ccache/cc4
/usr/lib64/ccache/cc44
/usr/lib64/ccache/clang
/usr/lib64/ccache/clang++
/usr/lib64/ccache/cris-linux-gnu-c++
/usr/lib64/ccache/cris-linux-gnu-cc
/usr/lib64/ccache/cris-linux-gnu-g++
/usr/lib64/ccache/cris-linux-gnu-gcc
/usr/lib64/ccache/frv-linux-gnu-c++
/usr/lib64/ccache/frv-linux-gnu-cc
/usr/lib64/ccache/frv-linux-gnu-g++
/usr/lib64/ccache/frv-linux-gnu-gcc
/usr/lib64/ccache/g++
/usr/lib64/ccache/g++32
/usr/lib64/ccache/g++34
/usr/lib64/ccache/g++4
/usr/lib64/ccache/g++44
/usr/lib64/ccache/gcc
/usr/lib64/ccache/gcc32
/usr/lib64/ccache/gcc34
/usr/lib64/ccache/gcc4
/usr/lib64/ccache/gcc44
/usr/lib64/ccache/geode-redhat-linux-c++
/usr/lib64/ccache/geode-redhat-linux-cc
/usr/lib64/ccache/geode-redhat-linux-g++
/usr/lib64/ccache/geode-redhat-linux-gcc
/usr/lib64/ccache/h8300-linux-gnu-c++
/usr/lib64/ccache/h8300-linux-gnu-cc
/usr/lib64/ccache/h8300-linux-gnu-g++
/usr/lib64/ccache/h8300-linux-gnu-gcc
/usr/lib64/ccache/hppa-linux-gnu-c++
/usr/lib64/ccache/hppa-linux-gnu-cc
/usr/lib64/ccache/hppa-linux-gnu-g++
/usr/lib64/ccache/hppa-linux-gnu-gcc
/usr/lib64/ccache/hppa64-linux-gnu-c++
/usr/lib64/ccache/hppa64-linux-gnu-cc
/usr/lib64/ccache/hppa64-linux-gnu-g++
/usr/lib64/ccache/hppa64-linux-gnu-gcc
/usr/lib64/ccache/i386-redhat-linux-c++
/usr/lib64/ccache/i386-redhat-linux-cc
/usr/lib64/ccache/i386-redhat-linux-g++
/usr/lib64/ccache/i386-redhat-linux-gcc
/usr/lib64/ccache/i486-redhat-linux-c++
/usr/lib64/ccache/i486-redhat-linux-cc
/usr/lib64/ccache/i486-redhat-linux-g++
/usr/lib64/ccache/i486-redhat-linux-gcc
/usr/lib64/ccache/i586-redhat-linux-c++
/usr/lib64/ccache/i586-redhat-linux-cc
/usr/lib64/ccache/i586-redhat-linux-g++
/usr/lib64/ccache/i586-redhat-linux-gcc
/usr/lib64/ccache/i686-redhat-linux-c++
/usr/lib64/ccache/i686-redhat-linux-cc
/usr/lib64/ccache/i686-redhat-linux-g++
/usr/lib64/ccache/i686-redhat-linux-gcc
/usr/lib64/ccache/ia64-linux-gnu-c++
/usr/lib64/ccache/ia64-linux-gnu-cc
/usr/lib64/ccache/ia64-linux-gnu-g++
/usr/lib64/ccache/ia64-linux-gnu-gcc
/usr/lib64/ccache/m32r-linux-gnu-c++
/usr/lib64/ccache/m32r-linux-gnu-cc
/usr/lib64/ccache/m32r-linux-gnu-g++
/usr/lib64/ccache/m32r-linux-gnu-gcc
/usr/lib64/ccache/m68k-linux-gnu-c++
/usr/lib64/ccache/m68k-linux-gnu-cc
/usr/lib64/ccache/m68k-linux-gnu-g++
/usr/lib64/ccache/m68k-linux-gnu-gcc
/usr/lib64/ccache/microblaze-linux-gnu-c++
/usr/lib64/ccache/microblaze-linux-gnu-cc
/usr/lib64/ccache/microblaze-linux-gnu-g++
/usr/lib64/ccache/microblaze-linux-gnu-gcc
/usr/lib64/ccache/mips64-linux-gnu-c++
/usr/lib64/ccache/mips64-linux-gnu-cc
/usr/lib64/ccache/mips64-linux-gnu-g++
/usr/lib64/ccache/mips64-linux-gnu-gcc
/usr/lib64/ccache/mn10300-linux-gnu-c++
/usr/lib64/ccache/mn10300-linux-gnu-cc
/usr/lib64/ccache/mn10300-linux-gnu-g++
/usr/lib64/ccache/mn10300-linux-gnu-gcc
/usr/lib64/ccache/msp430-c++
/usr/lib64/ccache/msp430-cc
/usr/lib64/ccache/msp430-g++
/usr/lib64/ccache/msp430-gcc
/usr/lib64/ccache/nios2-linux-gnu-c++
/usr/lib64/ccache/nios2-linux-gnu-cc
/usr/lib64/ccache/nios2-linux-gnu-g++
/usr/lib64/ccache/nios2-linux-gnu-gcc
/usr/lib64/ccache/pentium3-redhat-linux-c++
/usr/lib64/ccache/pentium3-redhat-linux-cc
/usr/lib64/ccache/pentium3-redhat-linux-g++
/usr/lib64/ccache/pentium3-redhat-linux-gcc
/usr/lib64/ccache/pentium4-redhat-linux-c++
/usr/lib64/ccache/pentium4-redhat-linux-cc
/usr/lib64/ccache/pentium4-redhat-linux-g++
/usr/lib64/ccache/pentium4-redhat-linux-gcc
/usr/lib64/ccache/powerpc64-linux-gnu-c++
/usr/lib64/ccache/powerpc64-linux-gnu-cc
/usr/lib64/ccache/powerpc64-linux-gnu-g++
/usr/lib64/ccache/powerpc64-linux-gnu-gcc
/usr/lib64/ccache/powerpc64le-linux-gnu-c++
/usr/lib64/ccache/powerpc64le-linux-gnu-cc
/usr/lib64/ccache/powerpc64le-linux-gnu-g++
/usr/lib64/ccache/powerpc64le-linux-gnu-gcc
/usr/lib64/ccache/ppc64-linux-gnu-c++
/usr/lib64/ccache/ppc64-linux-gnu-cc
/usr/lib64/ccache/ppc64-linux-gnu-g++
/usr/lib64/ccache/ppc64-linux-gnu-gcc
/usr/lib64/ccache/ppc64le-linux-gnu-c++
/usr/lib64/ccache/ppc64le-linux-gnu-cc
/usr/lib64/ccache/ppc64le-linux-gnu-g++
/usr/lib64/ccache/ppc64le-linux-gnu-gcc
/usr/lib64/ccache/s390x-linux-gnu-c++
/usr/lib64/ccache/s390x-linux-gnu-cc
/usr/lib64/ccache/s390x-linux-gnu-g++
/usr/lib64/ccache/s390x-linux-gnu-gcc
/usr/lib64/ccache/sh-linux-gnu-c++
/usr/lib64/ccache/sh-linux-gnu-cc
/usr/lib64/ccache/sh-linux-gnu-g++
/usr/lib64/ccache/sh-linux-gnu-gcc
/usr/lib64/ccache/sh64-linux-gnu-c++
/usr/lib64/ccache/sh64-linux-gnu-cc
/usr/lib64/ccache/sh64-linux-gnu-g++
/usr/lib64/ccache/sh64-linux-gnu-gcc
/usr/lib64/ccache/sparc64-linux-gnu-c++
/usr/lib64/ccache/sparc64-linux-gnu-cc
/usr/lib64/ccache/sparc64-linux-gnu-g++
/usr/lib64/ccache/sparc64-linux-gnu-gcc
/usr/lib64/ccache/tile-linux-gnu-c++
/usr/lib64/ccache/tile-linux-gnu-cc
/usr/lib64/ccache/tile-linux-gnu-g++
/usr/lib64/ccache/tile-linux-gnu-gcc
/usr/lib64/ccache/x86_64-linux-gnu-c++
/usr/lib64/ccache/x86_64-linux-gnu-cc
/usr/lib64/ccache/x86_64-linux-gnu-g++
/usr/lib64/ccache/x86_64-linux-gnu-gcc
/usr/lib64/ccache/x86_64-redhat-linux-c++
/usr/lib64/ccache/x86_64-redhat-linux-cc
/usr/lib64/ccache/x86_64-redhat-linux-g++
/usr/lib64/ccache/x86_64-redhat-linux-gcc
/usr/lib64/ccache/xtensa-linux-gnu-c++
/usr/lib64/ccache/xtensa-linux-gnu-cc
/usr/lib64/ccache/xtensa-linux-gnu-g++
/usr/lib64/ccache/xtensa-linux-gnu-gcc
/usr/share/doc/ccache
/usr/share/doc/ccache/AUTHORS.adoc
/usr/share/doc/ccache/AUTHORS.html
/usr/share/doc/ccache/MANUAL.adoc
/usr/share/doc/ccache/MANUAL.html
/usr/share/doc/ccache/NEWS.adoc
/usr/share/doc/ccache/NEWS.html
/usr/share/doc/ccache/README.md
/usr/share/licenses/ccache
/usr/share/licenses/ccache/GPL-3.0.txt
/usr/share/licenses/ccache/LICENSE.adoc
/usr/share/licenses/ccache/LICENSE.html
/usr/share/man/man1/ccache.1.gz
/var/cache/ccache

References

Summary

In this tutorial we learn how to install ccache on CentOS 8 using yum and dnf.