Skip to content

Instantly share code, notes, and snippets.

@martin-kokos
Last active March 23, 2024 19:26
Show Gist options
  • Save martin-kokos/78e60f126c86ec68f540d23f025455b5 to your computer and use it in GitHub Desktop.
Save martin-kokos/78e60f126c86ec68f540d23f025455b5 to your computer and use it in GitHub Desktop.
Install distcc on Ubuntu

Install gcc

apt-add-repository ppa:ubuntu-toolchain-r/test
apt update
apt install gcc-13 g++-13
ll /usr/bin/gcc-13
ll /usr/bin/g++-13
update-alternatives --display gcc
ll /etc/alternatives/g*
update-alternatives --remove-all gcc
update-alternatives --remove-all g++
update-alternatives --install /usr/bin/gcc gcc /usr/bin/g++-13 10
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-13 10

g++ --version
gcc --version

Install distcc

apt-get -y install distcc

/etc/default/distcc

STARTDISTCC="true"

ALLOWEDNETS="192.168.1.0/24"

LISTENER="192.168.1.200"

NICE="10"

JOBS="16"

ZEROCONF="true"

/etc/distcc/clients.allow 192.168.1.0/24

Command allowlist can be by these symlinks

ln -s /usr/bin/distcc /usr/lib/distcc/x86_64-pc-linux-gnu-gcc
ln -s /usr/bin/distcc /usr/lib/distcc/x86_64-pc-linux-gnu-g++

Also check symlink exists in /usr/lib/distcc which is used as whitelist, I suppose

Make symlinks on server as we ha a special CHOST from /etc/portage/make.conf (This would cause 110 exit code)

ln -s /usr/bin/x86_64-linux-gnu-gcc /usr/bin/x86_64-pc-linux-gnu-gcc
ln -s /usr/bin/x86_64-linux-gnu-g++ /usr/bin/x86_64-pc-linux-gnu-g++
ln -s /usr/bin/gcc /usr/bin/x86_64-linux-gnu-gcc
ln -s /usr/bin/g++ /usr/bin/x86_64-linux-gnu-g++
ln -s /usr/bin/gcc-13 /usr/bin/gcc
ln -s /usr/bin/g++-13 /usr/bin/g++

Install symlinks on client update-distcc-symlinks

ln -s /bin/distcc /usr/lib/x86_64-pc-linux-gnu-gcc
ln -s /bin/distcc /usr/lib/x86_64-pc-linux-gnu-g++

Restart service service distcc restart

Check rolling log on server tail -f /var/log/distcc.log Verify permissions if empty.

Check messages on client export DISTCC_VERBOSE=1

pump make -j 20

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment