Ccache

From LQWiki
Jump to navigation Jump to search

ccache

As its name implies ccache is a program used to cache programs in C so that they will compile faster.

Command line

In order to use ccache when you are compiling from the command line add the following line to your users .bash_profile

PATH="/usr/lib/ccache/bin:/opt/bin:${PATH}"

Portage and ccache

Since Gentoo is a source based distribution it naturally involves a lot of compiling. In order to get Portage to use ccache when compiling programs add this line to your make.conf

CCACHE_SIZE="2G"

and then make sure that you add "ccache" as a feature.

Paludis and ccache

Paludis, a Portage replacement can of course use ccache as well in order to help improve compile times. For Paludis all you need to do is add the following to /etc/paludis/bashrc

export PATH="/usr/lib/ccache/bin/:$PATH" 
export CCACHE_DIR="/var/tmp/ccache"
export CC="/usr/lib/ccache/bin/gcc"
export CXX="/usr/lib/ccache/bin/g++"

See also