Difference between revisions of "CCACHE"

From Funtoo Linux
Jump to: navigation, search
(Created page with "CCACHE is an application that caches compilation results and reuses it in future compilations in order to achieve faster compile times. This short tutorial will show you how t...")
 
(Using CCACHE to compile your kernel faster)
Line 38: Line 38:
  
 
<console>
 
<console>
#!/bin/bashexport CCACHE_DIR="/var/tmp/ccache"export CC="ccache gcc"export CXX="ccache g++"export PATH="/usr/lib/ccache:$PATH"cd /usr/src/linuxtime make bzImage modules
+
#!/bin/bash
 +
 
 +
export CCACHE_DIR="/var/tmp/ccache"
 +
export CC="ccache gcc"
 +
export CXX="ccache g++"
 +
export PATH="/usr/lib/ccache:$PATH"
 +
 
 +
cd /usr/src/linux
 +
time make bzImage modules
 +
</console>
 +
 
 +
Give the file execute permission:
 +
 
 +
<console>
 +
# ##i##chmod u+x build.sh
 
</console>
 
</console>
  
 
This will temporarily export the variables neccessary, then go into the /usr/src/linux folder (whatever you declared with 'eselect kernel') and then compile the kernel.[[Category:HOWTO]]
 
This will temporarily export the variables neccessary, then go into the /usr/src/linux folder (whatever you declared with 'eselect kernel') and then compile the kernel.[[Category:HOWTO]]

Revision as of 03:46, 10 March 2013

CCACHE is an application that caches compilation results and reuses it in future compilations in order to achieve faster compile times. This short tutorial will show you how to use it on your system.

Contents

Installing CCACHE

# emerge ccache

Once it finishes emerging, we will enable it in portage. This is very easy. Just open up /etc/portage/make.conf with your favorite text editor and add the following:

# FEATURES="ccache"

That's it. If you want to check how much the cache is taking up on your disk and other info, you can run the following command:

# CCACHE_DIR="/var/tmp/ccache" ccache -s

You must pass the CCACHE_DIR option since ccache normally defaults to the user's home directory, and portage uses /var/tmp/ccache.

Tweaking CCACHE

Disabling the CACHE limit

If you want to let the cache have the flexibility to grow to whatever size it needs to (unlimited size cache), just do the following:

# CCACHE_DIR="/var/tmp/ccache" ccache -M 0

This will let the cache grow to whatever size it needs to grow over time.

Using CCACHE to compile your kernel faster

In order to do this you need to change a few variables, you probably only want to change these variables temporarily, but you could change them permanently if you want to. Since we just want to do this temporarily for this example, make a new file called "build.sh" and put the following inside of it:

#!/bin/bash

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

cd /usr/src/linux
time make bzImage modules

Give the file execute permission:

# chmod u+x build.sh

This will temporarily export the variables neccessary, then go into the /usr/src/linux folder (whatever you declared with 'eselect kernel') and then compile the kernel.

Personal tools
Namespaces

Variants
Actions
Categories
Toolbox
Stuff