Difference between revisions of "Ccache"

From CBLFS
Jump to navigationJump to search
(New page: {| style="text-align: left; background-color: AliceBlue;" |-valign="top" !Download Source: | http://samba.org/ftp/ccache/ccache-{{Ccache-Version}}.tar.gz |} ---- {{Package-Introduction|c...)
 
(Configuring)
Line 56: Line 56:
  
 
== Configuring ==
 
== 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 enviornment 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/gcc /opt/ccache/bin/gcc
 +
ln -sfv ../../../usr/bin/cc /opt/ccache/bin/cc
 +
ln -sfv ../../../usr/bin/g++ /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}"
 +
 +
# 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 =
 
= Contents =

Revision as of 05:00, 4 August 2007

Download Source: http://samba.org/ftp/ccache/ccache-2.4.tar.gz

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.

32Bit

Compile the package:

CC="gcc ${BUILD32}" ./configure --prefix=/usr &&
make

Install the package:

make install

N32

Compile the package:

CC="gcc ${BUILDN32}" ./configure --prefix=/usr &&
make

Install the package:

make install

64Bit

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 enviornment 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/gcc /opt/ccache/bin/gcc
ln -sfv ../../../usr/bin/cc /opt/ccache/bin/cc
ln -sfv ../../../usr/bin/g++ /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}"

# 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
Retrieved from "?title=Ccache&oldid=10787"