Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to enable ccache on Linux

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?

like image 373
Arky Avatar asked Dec 18 '12 09:12

Arky


2 Answers

The ccache manual has a section called Run modes which describes the official ways of activating ccache, so I suggest reading the manual.

Also, as you already noted, Linux distributions often set up a /usr/lib/ccache directory which is designed to be prepended to PATH.

like image 103
Joel Rosdahl Avatar answered Oct 02 '22 23:10

Joel Rosdahl


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 
like image 21
Ankit Raj Avatar answered Oct 02 '22 22:10

Ankit Raj