Search:  
Gentoo Wiki

HOWTO_use_ccache_and_distcc_with_scons_build_tool_using_the_Gentoo_environment


This article is part of the HOWTO series.
Installation Kernel & Hardware Networks Portage Software System X Server Gaming Non-x86 Emulators Misc

CCACHE & DISTCC

After a successfull ccache and distcc packages merge, and after issuing the commands:

Code: At the shell prompt
$ env-update && source /etc/profile

you must have a PATH environment variable looking like this:

Code: At the shell prompt
$ echo $PATH
/usr/lib/ccache/bin:/usr/lib/distcc/bin:/usr/local/bin:/usr/bin:/bin:/opt/bin:/u
sr/i686-pc-linux-gnu/gcc-bin/3.3.6:/opt/blackdown-jdk-1.4.2.02/bin:/opt/blackdow
n-jdk-1.4.2.02/jre/bin:/usr/qt/3/bin:/usr/games/bin

Check to see if you also have the following environment variables (just as samples):

Code: At the shell prompt
$ echo $DISTCC_HOSTS
localhost 10.2.1.122 10.2.1.125 10.2.1.126 10.2.1.132 10.2.1.11

$ echo $CCACHE_DIR
/home/me/.ccache


Tip: If you don't have some of the above environment variables, check the manpages or other HOWTOs about ccache and distcc .

Gentoo Distcc Documentation

Scons

Then, you only need to add lines like the ones below to make your scons builds use object caching and distributed compilation:

Code: SConstruct segment
  if os.path.exists('/usr/lib/distcc/bin'):
    os.environ['PATH']         = '/usr/lib/distcc/bin:' + os.environ['PATH']
    env['ENV']['DISTCC_HOSTS'] = os.environ['DISTCC_HOSTS']
  
  if os.path.exists('/usr/lib/ccache/bin'):
    os.environ['PATH']         = '/usr/lib/ccache/bin:' + os.environ['PATH']
    env['ENV']['CCACHE_DIR']   = os.environ['CCACHE_DIR']
  
  env['ENV']['PATH'] = os.environ['PATH']
  env['ENV']['HOME'] = os.environ['HOME']

and call scons with the option -j n, with n being the number of distccd servers, including your localhost

That's it.

Retrieved from "http://www.gentoo-wiki.info/HOWTO_use_ccache_and_distcc_with_scons_build_tool_using_the_Gentoo_environment"

Last modified: Fri, 05 Sep 2008 03:53:00 +0000 Hits: 10,108