Distcc


Resources

Distcc is a program designed to distribute compiling tasks across a network to participating hosts. It comprises a server, distccd, and a client program, distcc. Distcc can work transparently with ccache, Portage, and Automake with a small amount of setup.

When planning on using distcc to help bootstrap a Gentoo installation, make sure to read Using distcc to bootstrap.

Installation[edit | edit source]

Before configuring distcc, let's first look into the installation of the sys-devel/distcc package on all hosts.

Requirements across all hosts[edit | edit source]

In order to use distcc, all of the computers on the network need to have the same GCC versions. For example, mixing 3.3.x (where the x varies) is okay, but mixing 3.3.x with 3.2.x may result in compilation errors or runtime errors.

Verify that all systems use the same version of binutils (eselect binutils list) or many packages will fail linking with various errors like text relocation.

USE flags[edit | edit source]

USE flags for sys-devel/distcc Distribute compilation of C code across several machines on a network

gssapi Enable support for net-libs/libgssglue
gtk Add support for x11-libs/gtk+ (The GIMP Toolkit)
hardened Activate default security enhancements for toolchain (gcc, glibc, binutils)
ipv6 Add support for IP version 6
selinux !!internal use only!! Security Enhanced Linux support, this must be set by the selinux profile or breakage will occur
xinetd Add support for the xinetd super-server
zeroconf Support for DNS Service Discovery (DNS-SD)

Emerge[edit | edit source]

Distcc ships with a graphical monitor to monitor tasks that a computer is sending away for compilation. This monitor is enabled when the gtk USE flag is set.

After configuring the USE setting, install the sys-devel/distcc package:

root #emerge --ask sys-devel/distcc
Important
Remember to install sys-devel/distcc on all of the participating machines.

Configuration[edit | edit source]

Service[edit | edit source]

In order to have distccd started automatically follow the next set of instructions.

OpenRC[edit | edit source]

Edit /etc/conf.d/distccd and make sure to set the --allow directive to allow only trusted clients. For added security, use the --listen directive to tell the distccd daemon what IP to listen on (for multi-homed systems). More information on distcc security can be found at Distcc security notes.

Warning
Anyone who can connect to the distcc server port can run arbitrary commands on that machine as the distccd user.

The following example allows the distcc clients running at 192.168.0.4 and 192.168.0.5 to connect to the distccd server running locally:

FILE /etc/conf.d/distccdAllowing specific clients to connect to distccd
DISTCCD_OPTS="--port 3632 --log-level notice --log-file /var/log/distccd.log -N 15 --allow 192.168.0.4 --allow 192.168.0.5"

When logging to a file in /var/log, create the log and give appropriate permissions:

root #touch /var/log/distccd.log
root #chown distcc:root /var/log/distccd.log
Important
It is important to use --allow and --listen. Please read the distccd man page or the above security document for more information.

Now start the distccd daemon on all the participating computers:

root #rc-update add distccd default
root #rc-service distccd start

systemd[edit | edit source]

Edit the /etc/systemd/system/distccd.service.d/00gentoo.conf file to add the allowed clients in CIDR format. Matching the example will add all IP addresses in the 192.168.1.xxx range:

FILE /etc/systemd/system/distccd.service.d/00gentoo.confSetting ALLOWED_SERVERS
Environment="ALLOWED_SERVERS=192.168.1.0/24"
Note
The name "ALLOWED_SERVERS" here is rather confusing as it refers to the clients that are allowed to connect to the local distccd server. Nevertheless, it is this variable which is used in the distccd service as value for the --allow option – see the /usr/lib/systemd/system/distccd.service file for additional information.

Reload the unit files after making such changes:

root #systemctl daemon-reload

Enable auto-starting distccd and then start the service:

root #systemctl enable distccd
root #systemctl start distccd

Specifying participating hosts[edit | edit source]

Use the distcc-config command to set the list of hosts.

The following is an example list of host definitions. In most cases, variants of lines 1 and 2 suffice. The latter uses the /limit syntax to inform distcc about the maximum amount of jobs to be launched on this node. More information about the syntax used in lines 3 and 4 can be found in the distcc manual page.

CODE Examples of host definitions
192.168.0.1          192.168.0.2                       192.168.0.3
192.168.0.1/2        192.168.0.2                       192.168.0.3/10
192.168.0.1:4000/2   192.168.0.2/1                     192.168.0.3:3632/4
@192.168.0.1         @192.168.0.2:/usr/bin/distccd     192.168.0.3

There are also several other methods of setting up hosts. See the distcc man page (man distcc) for more details.

If compilations should also occur on the local machine, put localhost in the hosts list. Conversely if the local machine is not to be used to compile, omit it from the hosts list. On a slow machine using localhost may actually slow things down. Make sure to test the settings for performance.

Let's configure distcc to use the hosts mentioned on the first line in the example:

root #/usr/bin/distcc-config --set-hosts "192.168.0.1 192.168.0.2 192.168.0.3"

Distcc also supports a pump mode, by invoking the pump command. This may significantly reduce build time when multiple files are compiled in parallel. It caches preprocessed headers on the server side and, as a result, gets rid of repeated uploading and preprocessing of these header files.

To configure a host for pump mode, add the ,cpp,lzo suffix to the hosts definitions. Pump mode requires both cpp and lzo flags (regardless of the files being C or C++).

root #/usr/bin/distcc-config --set-hosts "192.168.0.1,cpp,lzo 192.168.0.2,cpp,lzo 192.168.0.3,cpp,lzo"

Hosts also need to be in:

FILE /etc/distcc/hostsShould match --set-hosts
192.168.0.1
192.168.0.2
192.168.0.3

Usage[edit | edit source]

With Portage[edit | edit source]

Setting up Portage to use distcc is easy. It is a matter of enabling the distcc feature, and setting a decent value for the number of simultaneous build jobs (as distcc increases the amount of build resources).

Set the MAKEOPTS variable and FEATURES variable as shown below.

A common strategy is to

  • set the value of N to twice the number of total (local + remote) CPU cores + 1, and
  • set the value of M to the number of local CPU cores

The use of -lM in the MAKEOPTS variable will prevent spawning too many tasks when some of the distcc cluster hosts are unavailable (increasing the amount of simultaneous jobs on the other systems) or when an ebuild is configured to disallow remote builds (such as with gcc). This is accomplished by refusing to start additional jobs when the system load is at or above the value of M.

FILE /etc/portage/make.confSetting MAKEOPTS and FEATURES
# Replace N and M with the right value as calculated previously
MAKEOPTS="-jN -lM"
FEATURES="distcc"
Warning
distcc-pump is not supported in Portage anymore: bug #702146

For instance, when there are two quad-core host PCs running distccd and the local PC has a dual core CPU, then the MAKEOPTS variable could look like this:

FILE /etc/portage/make.confMAKEOPTS example for 2 quad-core (remote) and one dual core (local) PC
# 2 remote hosts with 4 cores each = 8 cores remote
# 1 local host with 2 cores = 2 cores local
# total number of cores is 10, so N = 2*10+1 and M=2
MAKEOPTS="-j21 -l2"

CFLAGS and CXXFLAGS[edit | edit source]

While editing the make.conf file, make sure that it does not have -march=native in the CFLAGS or CXXFLAGS variables. distccd will not distribute work to other machines if march is set to native. Instead it should list exact platform and a few extra flags your CPU needs. Something like:

FILE /etc/portage/make.confinlined *FLAGS
# Minimal list of flags is generated with:
#   $ diff -U0 <(LANG=C gcc -Q -O2 -march=sandybridge --help=target) <(LANG=C gcc -Q -O2 -march=native --help=target)
COMMON_FLAGS="-march=sandybridge -mtune=sandybridge -maes" # don't use -march=native!
CFLAGS="${COMMON_FLAGS}"
CXXFLAGS="${COMMON_FLAGS}"

See Inlining -march=native for distcc for more information.

With automake[edit | edit source]

This is, in some cases, easier than the Portage setup. All that is needed is to update the PATH variable to include /usr/lib/distcc/bin/ in front of the directory that contains gcc (/usr/bin/). However, there is a caveat. If ccache is used, then put the distcc location after the ccache one:

root #export PATH="/usr/lib/ccache/bin:/usr/lib/distcc/bin:${PATH}"

Put this in the user's ~/.bashrc or equivalent file to have the PATH set every time the user logs in, or set it globally through an /etc/env.d/ file.

Instead of calling make alone, add in -jN (where N is an integer). The value of N depends on the network and the types of computers that are used to compile. A heuristic approach to the right value is given earlier in this article.

With ccache[edit | edit source]

To make Ccache work with distcc, some prerequisites must be fulfilled:

  • Ccache is successfully set up locally
  • is successfully set up on the desired hosts

The following setup will work as follows:

CODE Flow diagram
[client]                                                      [remote]
ccache <miss?> → compile it and save cache files,
<hit?>           also distribute other source code → distccccache <miss?> → compile it, save cache files, return cache file to client
  ↓                                                           <hit?>
use the local cache file                                        ↓
                                                 return local cache file to client
Warning
The following configuration must be done on all desired hosts!

Configure distccd[edit | edit source]

In order to let the daemon distccd use ccache, it must masquerade the path /usr/bin with /usr/lib/ccache/bin. Furthermore, when it uses ccache, ccache should use the prefix distcc:

FILE /etc/conf.d/distccd
PATH="/usr/lib/ccache/bin:${PATH}"
CCACHE_PREFIX="distcc"

Additionally distccd must be aware of the environment variables DISTCC_DIR and CCACHE_DIR:

Warning
These variables must be set somewhere in /etc/env.d/, otherwise ccache tries to put cache files in ${HOME}/.ccache/, which might result in a COMPILE_ERROR, due to insufficient permissions. To pinpoint this, use the testing example mentioned below and export DISTCC_SAVE_TEMPS="1" as mentioned here. This will provide error logs from the remote site in /tmp/ by default. The logs will look like this: distcc_server_stderr_*.txt. Be aware, that these environment variables cannot be set in /etc/conf.d/distccd, since they will not be read from distccd for some reason.
FILE /etc/env.d/03distcc_ccache
CCACHE_DIR="/var/cache/ccache"
DISTCC_DIR="/var/tmp/portage/.distcc"

Next, update the environment variables:

root #env-update
>>> Regenerating /etc/ld.so.cache...

Finally, restart the daemon distccd to adapt all changes:

root #rc-service distccd restart

Configure ccache[edit | edit source]

Warning
When using distcc with ccache, it is necessary to prepare the cache directories manually, since the daemon distccd only works with the user distcc for some reason and it cannot create directories within /var/cache/ccache/. It is not sufficient to add this user to the group portage. Also be aware, that the variable cache_dir_levels, defined in ccache.conf, specifies how many subdirectories have to be created. The following example uses the default, which is 2.

First, prepare the cache directories:

root #cd "/var/cache/ccache/"
root #mkdir {a..z} {0..9} tmp
root #for first_level_directory in $(find . -maxdepth 1 -type d -not -name "." -and -not -name "tmp"); do pushd "${first_level_directory}" >/dev/null; mkdir {a..z} {0..9}; popd >/dev/null; done

The second command (mkdir) will create the first level directories from a to z, 0 to 9 and tmp. The following for loop will then look for the first level directories (find . -maxdepth 1 -type d), excluding the current directory . and tmp (-not -name "." -and -not -name "tmp"). It then descends into each of them (pushd), creates the second level directories from a to z and 0 to 9 (mkdir) and goes back to the previous directory (popd), which is /var/cache/ccache/.

Important
The current directory . must be excluded with -not -name ".", otherwise the first pushd command will go to the current directory . and then goes back to whatever directory is currently on the stack via popd. It will navigate through the entire stack until it is empty, creating directories, where each pushd command fails. If this happens, one can search for them using find / -type d -name "0" and remove them with rm --recursive [a-z] [0-9]. It is advised to this manually!

When the preparation is done, every directory - including the directory ccache itself - must be owned by the user distcc:

root #find /var/cache/ccache -type d -exec chown distcc:portage "{}" +

Configure portage[edit | edit source]

To use emerge with distcc and ccache, make sure, that both features are enabled and that CCACHE_DIR is set in /etc/portage/make.conf:

FILE /etc/portage/make.conf
[...]
FEATURES="distcc ccache"
CCACHE_DIR="/var/cache/ccache"

It might be redundant to set CCACHE_DIR here, since it is already defined in /etc/env.d/03distcc_ccache, mentioned here. But to make absolutely sure, configure it like that.

Testing distcc with ccache manually[edit | edit source]

Remote[edit | edit source]

First enable verbose logging by setting --log-level to debug in /etc/conf.d/distccd:

FILE /etc/conf.d/distccd
[...]
DISTCCD_OPTS="${DISTCCD_OPTS} --log-level debug"
[...]

After that, restart the daemon to adapt the changes:

root #rc-service distccd restart

Also check, if there are directories in /var/cache/ccache - including the directory ccache itself - which are not owned by the user distcc and correct their owner permissions:

root #chown -R distcc:portage /var/cache/ccache
Client[edit | edit source]

Make sure, that the following environment variables are present in the current shell:

root #export PATH="/usr/lib/ccache/bin:${PATH}"
root #export CCACHE_DIR="/var/cache/ccache"
root #export DISTCC_DIR="/var/tmp/portage/.distcc"
root #export DISTCC_SAVE_TEMPS="1"
root #export DISTCC_VERBOSE="1"

After that, navigate to a temporary directory within /tmp/ and compile the example mentioned below:

root #cd $(mktemp --directory)
root #distcc gcc -c main.c -o main.o

This will provide a verbose output, while also keeping temporary files receiving from the remote site in /tmp/ by default:

CODE
[...]
distcc[29466] (dcc_cleanup_tempfiles_inner) skip cleanup of /tmp/distcc_9c42f0a6.i
distcc[29466] (dcc_cleanup_tempfiles_inner) skip cleanup of /tmp/distcc_server_stderr_9cc0f0a6.txt
[...]

Any occuring error from the remote site are saved in /tmp/distcc_server_stderr_*.txt.

If the compilation was successful, the following line will be shown.

CODE
[...]
distcc[29466] compile main.c on 192.168.0.4 completed ok
[...]

On the remote site, it will look like this:

CODE
[...]
distccd[13296] (dcc_check_compiler_masq) /usr/lib/ccache/bin/gcc is a safe symlink to /usr/bin/ccache
[...]
distccd[13296] (dcc_job_summary) client: 192.168.0.4:33880 COMPILE_OK exit:0 sig:0 core:0 ret:0 time:20ms gcc main.c

The important part here, is, that any symlink of /usr/lib/ccache/bin/ is a save symlink to /usr/bin/ccache.

Also, on the remote site, there should be the cached file 2beaa22dc2a2873d6869d69411840c-17229.o in /var/cache/ccache/c/0/, assuming, the example with its filename was copied from this wiki article. Generally, one can monitor the ccache size using watch "ccache --show-stats", while compiling.

Testing distcc with ccache using emerge[edit | edit source]

Check, if necessary environment variables are present for the current shell, see here and that /etc/portage/make.conf was configured properly, see here.

To produce some cached files on the remote site, one can compile small packages like htop and bzip2 on the client:

root #emerge --ask htop bzip2

Future usage[edit | edit source]

Make sure, that the following environment variables are always set in the desired shell:

CODE
PATH="/usr/lib/ccache/bin:${PATH}"
CCACHE_DIR="/var/cache/ccache"
DISTCC_DIR="/var/tmp/portage/.distcc"

To bootstrap[edit | edit source]

Using distcc to bootstrap (i.e. build a working toolchain before installing the remainder of the system) requires some additional steps to take.

Step 1: Configure Portage[edit | edit source]

Boot the new box with a Gentoo Linux LiveCD and follow the installation instructions, while keeping track of the instructions in the Gentoo FAQ for information about bootstrapping. Then configure Portage to use distcc:

FILE /etc/portage/make.confConfigure Portage to use distcc
FEATURES="distcc"
MAKEOPTS="-jN"

Update the PATH variable in the installation session as well:

root #export PATH="/usr/lib/ccache/bin:/usr/lib/distcc/bin:${PATH}"

Step 2: Getting distcc[edit | edit source]

Install sys-devel/distcc:

root #USE='-*' emerge --nodeps sys-devel/distcc

You may receive an error similar to the following when attempting to install distcc:

!!! Problem resolving dependencies for sys-devel/distcc

!!! The ebuild selected to satisfy "sys-devel/distcc" has unmet requirements.
- sys-devel/distcc-3.2_rc1-r4::gentoo USE="-crossdev -gnome -gssapi -gtk -hardened -ipv6 (-selinux) -xinetd -zeroconf" ABI_X86="(64)" PYTHON_TARGETS="-python2_7"

  The following REQUIRED_USE flag constraints are unsatisfied:
    python_targets_python2_7

This can be fixed using the following command:

root #USE='-* python_targets_python2_7' emerge --nodeps sys-devel/distcc

Step 3: Setting up distcc[edit | edit source]

Run distcc-config to setup distcc; substitute the host# in the example with the IP addresses or hostnames of the participating nodes.

root #/usr/bin/distcc-config --set-hosts "localhost host1 host2 host3 ..."

Distcc is now set up to bootstrap! Continue with the proper installation instructions and do not forget to run emerge distcc after running emerge @system. This is to make sure that all of the necessary dependencies are installed.

Note
During bootstrap and emerge @system distcc may not appear to be used. This is expected as some ebuilds do not work well with distcc, so they intentionally disable it.

Extras[edit | edit source]

The distcc application has additional features and applications to support working in a distcc environment.

Monitoring utilities[edit | edit source]

Distcc ships with two monitoring utilities. The text-based monitoring utility is always built and is called distccmon-text. Running it for the first time can be a bit confusing, but it is really quite easy to use. If the program is run with no parameter it will run just once. However, if it is passed a number it will update every N seconds, where N is the argument that was passed.

user $distccmon-text 10

The other monitoring utility is only enabled when the gtk USE flag is set. This one is GTK based, runs in an X environment, and it is quite lovely. For Gentoo, the GUI monitor has been renamed to distccmon-gui to make it less confusing (it is originally called distccmon-gnome).

user $distccmon-gui

To monitor Portage's distcc usage:

root #DISTCC_DIR="/var/tmp/portage/.distcc/" distccmon-text 10
root #DISTCC_DIR="/var/tmp/portage/.distcc/" distccmon-gui
Important
If the distcc directory is elsewhere, change the DISTCC_DIR variable accordingly.

A trick is to set DISTCC_DIR in environment variables:

root #echo 'DISTCC_DIR="/var/tmp/portage/.distcc/"' >> /etc/env.d/03distcc_custom
Important
Be aware that DISTCC_DIR must be set somewhere else than /etc/env.d/02distcc, as it gets overwritten everytime, when using distcc-config!. distcc-config --set-env DISTCC_DIR <some_path> does not work.

Now update the environment:

root #env-update
root #source /etc/profile

Finally, start the GUI application:

root #distccmon-gui

SSH for communication[edit | edit source]

Setting up distcc via SSH includes some pitfalls. First, generate an SSH key pair without password setup. Be aware that portage compiles programs as the Portage user (or as root if FEATURES="userpriv" is not set). The home folder of the Portage user is /var/tmp/portage/, which means the keys need to be stored in /var/tmp/portage/.ssh/

Warning
Home folder of the Portage user changed in recent versions to /var/lib/portage/home, but this folder cannot be used for distcc via SSH because it is out of the accessible path during compilation. You should then update it:
root #usermod -d /var/tmp/portage portage
root #ssh-keygen -b 2048 -t rsa -f /var/tmp/portage/.ssh/id_rsa

Second, create a section for each host in the SSH configuration file:

FILE /var/tmp/portage/.ssh/configAdd per-host sections
Host test1
    HostName 123.456.789.1
    Port 1234
    User UserName
 
Host test2
    HostName 123.456.789.2
    Port 1234
    User UserName

Send the public key to each compilation node:

root #ssh-copy-id -i /var/tmp/portage/.ssh/id_rsa.pub UserName@CompilationNode

Also make sure that each host is available in the known_hosts file:

root #ssh-keyscan -t rsa <compilation-node-1> <compilation-node-2> [...] > /var/tmp/portage/.ssh/known_hosts

Fix the file ownership as follows:

root #chown -R portage:portage /var/tmp/portage/.ssh/

To set up the hosts test1 and test2, run:

root #/usr/bin/distcc-config --set-hosts "@test1 @test2"

Please note the @ (@ sign), which specifies ssh hosts for distcc.

Finally, tell distcc which SSH binary to use:

FILE /etc/portage/make.conf
DISTCC_SSH="ssh"

It is not necessary to run the distccd initscript on the hosts when distcc communicates via SSH.

Testing[edit | edit source]

To test distcc, write a simple Hello distcc program and run distcc in verbose mode to see if it communicates properly.

FILE main.c
#include <stdio.h>
 
int main() {
    printf("Hello distcc!\n");
    return 0;
}

Next, turn on verbose mode, compile the program using distcc and link the generated object file into an executable:

user $export DISTCC_VERBOSE=1
user $distcc gcc -c main.c -o main.o # or 'pump distcc <...>'
user $gcc main.o -o main
Note
Replace distcc command with pump distcc for use pump mode.

There should be a bunch of output about distcc finding its configuration, selecting the host to connect to, starting to connect to it, and ultimately compile main.c. If the output does not list the desired distcc hosts, check the configuration.

Finally, ensure the compiled program works properly. To test each host, enumerate each compile host in the hosts file.

user $./main
Hello distcc!

Troubleshooting[edit | edit source]

If a problem occurs while using distcc, then this section might help in resolving the problem.

ERROR: failed to open /var/log/distccd.log[edit | edit source]

As of January 22nd, 2015 emerging fails to create the proper distccd.log file in /var/log/. This apparently only effects version 3.1-r8 of distcc. This bug is in the process of being corrected (see bug #477630). It is possible to work around this by manually creating the log file, giving it proper ownership, and restarting the distccd daemon:

root #mkdir -p /var/log/distcc
root #touch /var/log/distcc/distccd.log
root #chown distcc:daemon /var/log/distcc/distccd.log

Next update the /var/log path of the distccd configuration file in /etc/conf.d/distccd to the distcc directory created in the step before:

FILE /etc/conf.d/distccdUpdating log path
DISTCCD_OPTS="--port 3632 --log-level notice --log-file /var/log/distcc/distccd.log -N 15

Finally, restart the distccd service:

root #/etc/init.d/distccd restart

Some packages do not use distcc[edit | edit source]

As various packages are installed, users will notice that some of them aren't being distributed (and aren't being built in parallel). This may happen because the package' Makefile doesn't support parallel operations, or the maintainer of the ebuild has explicitly disabled parallel operations due to a known problem.

Sometimes distcc might cause a package to fail to compile. If this happens, please report it.

Mixed GCC versions[edit | edit source]

If the environment hosts different GCC versions, there will likely be very weird problems. The solution is to make certain all hosts have the same GCC version.

Recent Portage updates have made Portage use ${CHOST}-gcc (minus gcc) instead of gcc. This means that if i686 machines are mixed with other types (i386, i586) then the builds will run into troubles. A workaround for this may be to run:

root #export CC='gcc' CXX='c++'

It is also possible to set the CC and CXX variables in /etc/portage/make.conf to the values list in the command above.

Important
Doing this explicitly redefines some behavior of Portage and may have some weird results in the future. Only do this if mixing CHOSTs is unavoidable.
Note
Having the right version of gcc as a slot on a server isn’t enough. Portage uses distcc as a replacement for the compiler referenced by the CHOST variable (i.e. x86_64-pc-linux-gnu) and distccd invokes it by exactly same name. The right version of gcc should be a default system’s compiler on all involved compilation hosts.

-march=native[edit | edit source]

Starting with GCC 4.3.0, the compiler supports the -march=native option which turns on CPU auto-detection and optimizations that are worth being enabled on the processor on which GCC is running. This creates a problem when using distcc because it allows the mixing of code optimized for different processors. For example, running distcc with -march=native on a system that has an AMD Athlon processor and doing the same on another system that has an Intel Pentium processor will mix code compiled on both processors together.

Heed the following warning:

Warning
Do not use -march=native or -mtune=native in the CFLAGS or CXXFLAGS variables of make.conf when compiling with distcc.

See the CFLAGS and CXXFLAGS section and Inlining -march=native for distcc for more information.

Network is unreachable[edit | edit source]

Note
When using SSH connection, you may also face the error: ssh: Could not resolve hostname: Temporary failure in name resolution.

Due to network restrictions introduced by the feature network-sandbox, you may run into this issue. Since distcc contradicts with this security feature, you have to disable it:

FILE /etc/portage/make.confDisabling network-sandbox feature
FEATURES="${FEATURES} -network-sandbox"

Get more output from emerge logs[edit | edit source]

It is possible to obtain more logging by enabling verbose mode. This is accomplished by adding DISTCC_VERBOSE to /etc/portage/bashrc:

FILE /etc/portage/bashrcEnabling verbose logging
export DISTCC_VERBOSE=1

The verbose logging can then be found in /var/tmp/portage/$CATEGORY/$PF/temp/build.log.

Keep in mind that the first distcc invocation visible in build.log isn’t necessary the first distcc call during a build process. For example a build server can get a one-minute backoff period during the configuration stage when some checks are performed using a compiler (distcc sets a backoff period when compilation on a remote server failed, it doesn’t matter whether it failed on local machine or not).

Dig into the /var/tmp/portage/$CATEGORY/$PF/work/ directory to investigate such situations. Find other logs, or call make explicitly from within the working directory.

Another interesting variable to use is DISTCC_SAVE_TEMPS. When set, it saves the standard output/error from a remote compiler which, for Portage builds, results in files in the /var/tmp/portage/$CATEGORY/$PF/temp/ directory.

FILE /etc/portage/bashrcSaving temporary output
export DISTCC_SAVE_TEMPS=1

See also[edit | edit source]

  • Distcc/Cross-Compiling — shows the reader how to set up distcc for cross-compiling across different processor architectures.

External resources[edit | edit source]


This page is based on a document formerly found on our main website gentoo.org.
The following people contributed to the original document: Lisa Seelye, SMW::offMike Gilbert (floppym)SMW::on, Erwin, SMW::offSven Vermeulen (SwifT)SMW::on, Lars Weiler, Tiemo Kieft, and
They are listed here because wiki history does not allow for any external attribution. If you edit the wiki article, please do not add yourself here; your contributions are recorded on each article's associated history page.

This article is issued from Gentoo. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.