Note

The Funtoo Linux project has transitioned to "Hobby Mode" and this wiki is now read-only.

Difference between revisions of "Package:CCache"

From Funtoo
Jump to navigation Jump to search
m (Updated the <code> and <console> tags on the page to {{c}} and {{console}} templates. Changed the wording in a few places.)
 
(One intermediate revision by one other user not shown)
Line 3: Line 3:
|CatPkg=dev-util/ccache
|CatPkg=dev-util/ccache
|Maintainer=
|Maintainer=
|Repository=
|Repository=Gentoo Portage Tree
}}
}}
{{fancynote| '''CCACHE can cause build failures'''. If it does, please try to compile the application without CCACHE enabled. Bug reports reported with CCACHE enabled will be closed.}}
{{Note|'''CCACHE can cause build failures'''. If it does, please try to compile the application without CCACHE enabled. Bug reports reported with CCACHE enabled will be closed.}}


== Installing CCACHE ==
== Installing CCACHE ==
To emerge {{Package|dev-util/ccache}}, run the following:
To emerge {{Package|dev-util/ccache}}, run the following:
<console>
{{console|body=
# ##i##emerge ccache
###i## emerge ccache
</console>
}}
 
Once it finishes emerging, enable it in portage. This is very easy. Just open up {{c|/etc/portage/make.conf}} with your favorite text editor and add the following:
Once it finishes emerging, enable it in portage. This is very easy. Just open up <code>/etc/portage/make.conf</code> with your favorite text editor and add the following:
{{file|name=/etc/portage/make.conf|lang=bash|desc=|body=
 
<pre>
FEATURES="ccache"
FEATURES="ccache"
</pre>
}}


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:
That's it. If you want to check how much space the cache is taking up on your disk and other info about the cache, run the following command:
<console>
{{console|body=
###i## CCACHE_DIR="/var/tmp/ccache" ccache -s
###i## CCACHE_DIR="/var/tmp/ccache" ccache -s
</console>
}}


You must pass the <code>CCACHE_DIR</code> option since ccache normally defaults to the user's home directory, and portage uses <code>/var/tmp/ccache</code>.
You must pass the {{c|CCACHE_DIR}} option since ccache normally defaults to the user's home directory, and portage uses {{c|/var/tmp/ccache}}.


== Tweaking CCACHE ==
== Tweaking CCACHE ==
=== Disabling the CACHE limit ===
=== 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:
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:
<console>
{{console|body=
###i## CCACHE_DIR="/var/tmp/ccache" ccache -M 0
###i## CCACHE_DIR="/var/tmp/ccache" ccache -M 0
</console>
}}
 
This will let the cache grow to whatever size it needs to grow to over time.
 
== Tricks ==
== Tricks ==
===  Using CCACHE to compile your kernel faster ===
===  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 <code>build.sh</code> and put the following inside of it:
In order to use {{c|CCACHE}} to compule your kernel more quickly, 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, make a new file called {{c|build.sh}} and put the following inside of it:
 
{{file|name=build.sh|lang=bash|body=
<pre>
#!/bin/bash
#!/bin/bash


Line 49: Line 41:
cd /usr/src/linux
cd /usr/src/linux
time make bzImage modules
time make bzImage modules
</pre>
}}


Give the file execute permission:
Give the file execute permission:
{{console|body=
$##bl## chmod u+x build.sh
}}
This will temporarily export the variables neccessary, then go into the {{c|/usr/src/linux}} folder (whatever you declared with 'eselect kernel') and then compile the kernel.


<console>
[[Category:HOWTO]]
###i## chmod u+x build.sh
[[Category:Ebuilds]]
</console>
 
This will temporarily export the variables neccessary, then go into the <code>/usr/src/linux</code> folder (whatever you declared with 'eselect kernel') and then compile the kernel.[[Category:HOWTO]]
 
{{EbuildFooter}}
{{EbuildFooter}}
[[Category:Ebuilds]]

Latest revision as of 17:53, June 24, 2015

CCache

   Tip

We welcome improvements to this page. To edit this page, Create a Funtoo account. Then log in and then click here to edit this page. See our editing guidelines to becoming a wiki-editing pro.

   Note

CCACHE can cause build failures. If it does, please try to compile the application without CCACHE enabled. Bug reports reported with CCACHE enabled will be closed.

Installing CCACHE

To emerge dev-util/ccache, run the following:

root # emerge ccache

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

   /etc/portage/make.conf (bash source code)
FEATURES="ccache"

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

root # 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:

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

Tricks

Using CCACHE to compile your kernel faster

In order to use CCACHE to compule your kernel more quickly, 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, make a new file called build.sh and put the following inside of it:

   build.sh (bash source code)
#!/bin/bash

export CCACHE_DIR="/var/tmp/ccache"
export PATH="/usr/lib/ccache/bin:${PATH}"

cd /usr/src/linux
time make bzImage modules

Give the file execute permission:

user $ 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.