distccd
Distribute C/C++ compilation across multiple machines
TLDR
Start a daemon with the default settings
Start a daemon, accepting connections from IPv4 private network ranges
Start a daemon, accepting connections from a specific network address or address range
Start a daemon with a lowered priority that can run a maximum of 4 tasks at a time
Start a daemon and register it via mDNS/DNS-SD (Zeroconf)
SYNOPSIS
distccd [options]
PARAMETERS
--port PORT
Specifies the TCP port distccd should listen on (default is 3632).
--allow IP/MASK
Restricts connections to specified IP addresses or network ranges (e.g., 192.168.1.0/24). Essential for security.
--listen IP
Specifies the IP address distccd will bind to for listening.
--jobs N
Limits the number of concurrent compilation jobs distccd will process at any given time.
--log-file FILE
Redirects logging output to a specified file instead of standard error.
--verbose
Increases the verbosity of log messages, providing more detailed information.
--user USER
Drops privileges to run as a specified user after startup. Highly recommended for security.
--daemon
Detaches distccd from the controlling terminal and runs it in the background as a daemon.
--no-detach
Prevents distccd from detaching from the terminal, useful for debugging.
--sanitize-path
Cleans and restricts the PATH environment variable passed to the compiler for security reasons.
--help
Displays a summary of command-line options and exits.
--version
Displays version information for distccd and exits.
DESCRIPTION
distccd is the daemon component of the distcc distributed compilation system.
It listens for incoming compilation requests from distcc clients, typically on TCP port 3632, and executes the requested compiler on the client's source code, sending the results back.
By distributing compilation tasks across multiple machines running distccd, in conjunction with a distcc-enabled client, users can significantly accelerate build times for large software projects that involve numerous compilation units.
The daemon aims to make remote compilation almost transparent to the user and the build system, acting as a powerful backend for tools like make.
Due to its nature of executing arbitrary code received over the network, security is paramount; distccd must be configured carefully with strict access controls to restrict connections only to trusted clients.
CAVEATS
Security Risk: Running distccd without proper access control (e.g., using --allow and a firewall) can allow anyone on the network to execute arbitrary commands on the host machine. This is a severe security vulnerability.
Compiler Compatibility: For successful distributed compilation, the compiler versions and potentially their configurations (e.g., linker versions, libc versions) on the client and server machines should be compatible.
Network Latency: While speeding up compilation, high network latency between the client and distccd server can negate performance benefits, and even slow down builds.
SECURITY BEST PRACTICES
Always use the --allow option to whitelist trusted client IP addresses or networks, and configure a firewall to restrict access to distccd's port (default 3632) to only trusted sources.
Run distccd as a non-root, dedicated user using the --user option to minimize potential damage from vulnerabilities.
Consider running distccd only within a secure, isolated network segment.
TYPICAL SETUP
On server machines: Install distccd and start it with appropriate security settings (e.g., distccd --daemon --allow 192.168.1.0/24 --user distccuser).
On client machines: Configure distcc (e.g., by setting the DISTCC_HOSTS environment variable to a space-separated list of distccd server addresses). Then, when compiling, prefix your compilation commands with distcc (e.g., distcc gcc myprogram.c) or configure your build system (like make) to use distcc.
HISTORY
distccd is a core component of the distcc project, which was originally developed by Martin Pool in the early 2000s. Its primary goal was to leverage idle CPU cycles on multiple machines to speed up C/C++ compilation, particularly beneficial for large open-source projects or corporate codebases. The project aimed for simplicity and ease of setup, making distributed compilation accessible without complex build system modifications. distccd facilitates this by providing the remote execution endpoint.