How to enable ccache on Linux

Arky picture Arky · Dec 18, 2012 · Viewed 19.5k times · Source

There is very little documentation on enabling ccache on GNU/Linux. Here is a response from launchpad.net:

At the moment, I think the best way to enable ccache is to add "/usr/lib/ccache" to the front of your path. If you want to enable it for all users by default, change the PATH variable in /etc/environment.

Can someone give me more information on enabling ccache?

Answer

Ankit Raj picture Ankit Raj · Jan 6, 2016

Download latest version of ccache for better performance.

After Downloading, Follow the steps as mentioned below:

A) Tar the file using the following command :

 $tar -xvf ccache-3.2.4.tar.bz2
 
 Note : I'm using ccache 3.2.4 Version.You can download the latest one.

B) Go inside ccache-3.2.4 folder and run the following commands:

 $./configure
 $./make 
 $ sudo make install

C) Go to your .bashrc and insert the following :

 export CCACHE_DIR=/home/user_name/.ccache
 export CCACHE_TEMPDIR=/home/user_name/.ccache

 Note : Fill user_name with your User Name

D) Save your Bashrc and source it

 $ source ~/.bashrc

E) To check ccache is working or not type :

 ccache -M 10G : To Set the ccache Size to 10GB

F) To check ccache is working or not type :

 ccache -s : To check ccache statistics