Difference between revisions of "Ccache"
Weibullguy (talk | contribs) |
|||
(One intermediate revision by one other user not shown) | |||
Line 22: | Line 22: | ||
== Multilib == | == Multilib == | ||
'''''This package does not install any libraries so only one installation is needed.''''' | '''''This package does not install any libraries so only one installation is needed.''''' | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
Compile the package: | Compile the package: | ||
Line 63: | Line 40: | ||
==== Method 1 ==== | ==== Method 1 ==== | ||
− | To prefix the compiler with ccache you would need to set the following | + | To prefix the compiler with ccache you would need to set the following environment variables where appropriate: |
CC="ccache gcc" | CC="ccache gcc" | ||
Line 114: | Line 91: | ||
| None | | None | ||
|} | |} | ||
+ | |||
+ | [[Category:Programming]] |
Latest revision as of 02:47, 28 October 2010
Download Source: | http://samba.org/ftp/ccache/ccache-2.4.tar.gz |
---|
Contents
Introduction to Ccache
ccache is a compiler cache. It acts as a caching pre-processor to C/C++ compilers, using the -E compiler switch and a hash to detect when a compilation can be satisfied from cache. This often results in a 5 to 10 times speedup in common compilations.
Project Homepage: http://ccache.samba.org/
Non-Multilib
Compile the package:
./configure --prefix=/usr && make
Install the package:
make install
Multilib
This package does not install any libraries so only one installation is needed.
Compile the package:
CC="gcc ${BUILD64}" ./configure --prefix=/usr && make
Install the package:
make install
Configuring
Using ccache
There are 2 ways to configure ccache. Either to prefix the compiler with ccache or to create alternate symlinks.
Method 1
To prefix the compiler with ccache you would need to set the following environment variables where appropriate:
CC="ccache gcc" CXX="ccache g++"
Or on multilib
CC="ccache gcc ${BUILD32}" CXX="ccache g++ ${BUILD32}"
Method 2
The second way would be to create some compatibility symlinks.
install -dv -m755 /opt/ccache/bin && ln -sfv ../../../usr/bin/ccache /opt/ccache/bin/gcc && ln -sfv ../../../usr/bin/ccache /opt/ccache/bin/cc && ln -sfv ../../../usr/bin/ccache /opt/ccache/bin/g++
Then put those links at the top of your path each time you login.
cat > /etc/profile.d/50-ccache.sh << "EOF" # Begin /etc/profile.d/50-ccache.sh export PATH="/opt/ccache/bin:${PATH}" export CCACHE_PATH="/usr/bin" # End /etc/profile.d/50-ccache.sh EOF
Using ccache with distcc
In addition to the above section. The CCACHE_PREFIX variable is a prefix tagged onto the command that ccache would run to compile code.
export CCACHE_PREFIX="distcc"
Contents
Installed Programs: | ccache |
---|---|
Installed Libraries: | None |
Installed Directories: | None |