LinuxCommandLibrary

distccd

Distribute C/C++ compilation across multiple machines

TLDR

Start a daemon with the default settings

$ distccd --daemon
copy

Start a daemon, accepting connections from IPv4 private network ranges
$ distccd --daemon --allow-private
copy

Start a daemon, accepting connections from a specific network address or address range
$ distccd --daemon [[-a|--allow]] [ip_address|network_prefix]
copy

Start a daemon with a lowered priority that can run a maximum of 4 tasks at a time
$ distccd --daemon [[-j|--jobs]] [4] [[-N|--nice]] [5]
copy

Start a daemon and register it via mDNS/DNS-SD (Zeroconf)
$ distccd --daemon --zeroconf
copy

SYNOPSIS

distccd [options]

PARAMETERS

--daemon
    Start distccd in daemon mode (detach from terminal).

--listen address
    Specify the address to listen on (default is all interfaces).

--port port
    Specify the port to listen on (default is 3632).

--user user
    Run distccd as the specified user.

--group group
    Run distccd as the specified group.

--nice level
    Set the process priority (niceness).

--allow network
    Allow connections from the specified network (CIDR notation).

--deny network
    Deny connections from the specified network (CIDR notation).

--pid-file file
    Specify the PID file.

--log-file file
    Specify the log file.

--stats
    Enable statistics logging.

--verbose
    Enable verbose logging.

--version
    Show version information and exit.

--help
    Display help information and exit.

DESCRIPTION

distccd is a daemon designed to distribute C, C++, and Objective-C compiler tasks across multiple machines on a network. By offloading compilation to idle or less burdened servers, distccd can significantly reduce build times, especially for large projects. It achieves this by intercepting compiler invocations and forwarding them to available distccd servers, which perform the actual compilation and return the results. distccd is transparent to the user, as it integrates seamlessly with existing build systems like make. It is particularly useful in environments with multiple developers working on the same codebase, allowing them to share computational resources and accelerate the development cycle. The configuration of distccd involves setting up both a client (the machine initiating the build) and one or more servers (the machines performing the compilation). The daemon handles task scheduling and communication between the client and servers, ensuring efficient resource utilization. Secure access and authentication measures are crucial when deploying distccd in shared environments to prevent unauthorized access and maintain build integrity.

CAVEATS

Security considerations are paramount. Ensure proper authentication and access controls are in place to prevent unauthorized code execution on the distccd servers.
Firewall rules should be configured to restrict access to the distccd port.

CONFIGURATION

The client configuration typically involves setting the CC and CXX environment variables to point to distcc wrappers (e.g., distcc gcc, distcc g++). The --hosts option can also be used to specify the distccd servers.
Server configuration mainly concerns allowing or denying networks using the --allow and --deny options, defining the listening port and user/group.

TROUBLESHOOTING

Common issues include network connectivity problems, incorrect host configurations, and permission errors. Checking the distccd logs and using tools like ping and telnet can help diagnose these problems.

HISTORY

distccd was created to address the slow compilation times experienced in large software projects. Its development focused on providing a simple and efficient way to distribute the compilation workload across a network of machines. It has seen widespread adoption in open-source projects and commercial environments where faster build times are critical. Over time, various improvements have been made to enhance its performance, security, and ease of configuration.

SEE ALSO

gcc(1), make(1), ccache(1)

Copied to clipboard