View Single Post
  #5   (View Single Post)  
Old 9th October 2008
MetalHead MetalHead is offline
Port Guard
 
Join Date: Sep 2008
Posts: 24
Default

What is the point of ccache?
Anyone had any luck with this program?

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.



To use ccache add the following to /etc/make.conf

.if (!empty(.CURDIR:M/usr/src*) || !empty(.CURDIR:M/usr/obj*)) && !defined(NOCCACHE)
CC=/usr/local/libexec/ccache/world-cc
CXX=/usr/local/libexec/ccache/world-c++
.endif

For Korn/Bourne shells Add the following to /etc/profile:
export PATH=/usr/local/libexec/ccache:$PATH
export CCACHE_PATH=/usr/bin:/usr/local/bin

For csh/tcsh Add the following to /etc/csh.cshrc:
setenv PATH /usr/local/libexec/ccache:$PATH
setenv CCACHE_PATH /usr/bin:/usr/local/bin

For icc users:
Add /usr/local/intel_cc_80/bin to CCACHE_PATH

--

To use distcc:

For Korn/Bourne shells Add the following to /etc/profile:
export CCACHE_PREFIX=distcc
export DISTCC_HOSTS="localhost host1 host2"

For csh/tcsh Add the following to /etc/csh.cshrc:
setenv CCACHE_PREFIX distcc
setenv DISTCC_HOSTS "localhost host1 host2"

--

If you have a problem building world
define NOCCACHE and try again.

If you have a problem building a port
reset PATH=$CCACHE_PATH and try again.

--

Ccache has installed links for the following compilers
cc c++ gcc g++ gcc32 gcc33 gcc34 gcc40 gcc41 gcc42 gcc43 gcc44 gcc-ooo g++32 g++33 g++34 g++40 g++41 g++42 g++43 g++44 g++-ooo
in /usr/local/libexec/ccache

!!! WARNING !!!
Please make sure you have the compiler installed before you do this or your
build will fail because it will not be able to find the compiler.

Any time you change CC/CXX you need to reinstall devel/libtool15 or you
will run in to problems.

--

Ccache's default cache size is 1GB and this is larger than the default size of
the root partition (/) on FreeBSD. To over come this you may specify a new
cache location on a different partition with the following examples.

For Korn/Bourne shells Add the following to /etc/profile:
export CCACHE_DIR=/usr/.ccache

For csh/tcsh Add the following to /etc/csh.cshrc
setenv CCACHE_DIR "/usr/.ccache"
Reply With Quote