ccontrol(1)

ccontrol1

Wrapper to control distcc, ccache and more

Usage

gcc

cc

c++

make

ld

ccontrol [--section=<section>] <name> ...

ccontrol [--section=<section>]

The following settings are available:

cc

c++

ld

make

ccache

distcc

distcc-hosts

distc++-hosts

cpus

no-parallel

nice

include

add make

add env

verbose

lock-file

Overview

The ccontrol(1) program takes over the roles of the compiler and linker, and reads a configuration file to decide what to do before invoking them. This is particularly useful for centralized control over commands and options, such as enabling distcc(1) and ccache(1).

When ccontrol(1) is invoked under its own name with no arguments, it prints out the settings which apply in this directory (unless --section is specified).

Versions are named after the last person to report a bug.

Options

Normally ccontrol(1) is invoked as a symboling link to cc, make, etc, so it can identify what is being invoked by examining its own name. It can also be invoked under its own name, in which case ccontrol-specific arguments can be supplied. The first non-option argument will be used to identify the invocation, eg. "ccontrol gcc ...".

The following options are supported, when invoked as ccontrol:

--section=<section>

This is treated as the "current directory" for the purposes of evaluating the configuration file. As all real directories must begin with a "/" using an argument which does not, is a good way of overriding configuration for this particular invocation.

Configuration file

ccontrol’s configuration file is $HOME/.ccontrol/config. If this cannot be read (and written), your compilations will all fail. It is normal to have several different configuration files in this directory, and make default a symbolic link.

Examples

This is the minimal configuration file:

[*]
        cc = /usr/bin/gcc
        c++ = /usr/bin/g++
        ld = /usr/bin/ld
        make = /usr/bin/make

If you have multiple locations (such as a laptop) it is common to have a "global" file which is included from every configuration file, like so:

# Configuration file for when I'm at work.  Lots of distcc hosts!
include = ~/.ccontrol/global
[*]
        distcc-hosts = snab swarm1 swarm3 swarm4 swarm5 fandango2 mingo
        distc++-hosts = snab mingo

Here is a complete configuration file with several common scenarios:

[*]
        cc = /usr/bin/gcc-4.0
        c++ = /usr/bin/g++-4.0
        ld = /usr/bin/ld
        make = /usr/bin/make
# Comment this back in for debugging
#       verbose
        distcc = /usr/bin/distcc
        distcc-hosts = snab swarm1 swarm3 swarm4 swarm5 fandango2 mingo
        distc++-hosts = snab mingo
        ccache = /usr/bin/ccache
        # make check should not generally be run in parallel
        no-parallel = check
# Wesnoth doesn't compile with g++ 4.0
[*wesnoth*]
        c++ = /usr/bin/g++-3.4
# Stupid third-party modules don't build in parallel.
[/usr/src/modules/*]
        no-parallel = *
# Using distcc when testing module-init-tools causes strange effects.
[*module-init-tools*/tests/*]
        distcc disable

Notes

Releases

7 releases since Debian 4.0 (Etch); the text changed 3 times.

  1. 4.0
  2. 5.0–6.0
  3. 7–8
  4. 9–10

Bugs

The ~/.ccontrol/config file must be writable: ccontrol(1) needs to get an exclusive write lock on it, which means it needs to open the file for writing. Use include to include read-only files.

ccontrol will not immediately notice a change in included files, only in the toplevel file (ccontrol re-reads the config file if it changed while ccontrol was trying to grab a lock).

The Linux (⟨ 2.6.15) cpufreq ondemand governor (common on laptops) will not increase CPU speed when using ccontrol(1), because ccontrol re-nices compilations. This can make builds 2-3 times slower. Either use another governor, or tell ondemand to ignore nice values:

echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/ignore_nice

If your code doesn’t compile, ccontrol can only make it not compile faster.

Author

Written by Rusty Russell <[email protected][1]>

License

Copyright © 2005 Rusty Russell. Free use of this software is granted under the terms of the GNU General Public License (GPL).

Author

Rusty Russell <[email protected]>

Author.

From ccontrol 1.0-2 in Debian 10 (Buster). Parsed by carta from the page's man source.