From Bashlinux
Jump to: navigation, search

Install distcc

In both Target(ARM) and Cross-Compiler(i686,x86_64) node setup distcc

  • Install distcc dependencies
apt-get -y install subversion autoconf automake python python-dev binutils-dev libgtk2.0-dev
  • Install libiberty
  • Raspberry Pi (ARMv6l)
cd /usr/local/src
wget http://archive.raspbian.org/raspbian/pool/main/libi/libiberty/libiberty-dev_20141014-1_armhf.deb
dpkg -i libiberty-dev_20141014-1_armhf.deb
  • Cubox-i (ARMv7l)
apt-get -y install libiberty-dev
  • Configure distcc
cd /usr/src
svn checkout http://distcc.googlecode.com/svn/trunk/ distcc
cd distcc  
./configure --with-gtk
  • Remove warning for unused varieables
sed -i -e '/^WERROR_CFLAGS/s/=/= -Wno-unused-variable/' Makefile
  • Build and install distcc from sources
make && sudo make install

On the Target (ARM)

  • Masquerade the proper compilers
ln -s /usr/local/bin/distcc /usr/local/bin/gcc
ln -s /usr/local/bin/distcc /usr/local/bin/cc
ln -s /usr/local/bin/distcc /usr/local/bin/g++
ln -s /usr/local/bin/distcc /usr/local/bin/c++
ln -s /usr/local/bin/distcc /usr/local/bin/cpp
  • Fix the path to search on /usr/local before anything else, usually this could be done in /etc/profile
  • Setup distcc parameters at /etc/profile.d/distcc.sh
# The remote machines that will build things for you.
# Don't put the ip of the Pi unless you want the Pi to take part to the build process.
# The documentation states that your should set the number of jobs per machine to 
# its number of processors.
# jeremy-nicola.info advises to set it to twice as much.
export DISTCC_HOSTS=""
# When a job fails, distcc backs off the machine that failed for some time.
# We want distcc to retry immediately
# Time, in seconds, before distcc throws a DISTCC_IO_TIMEOUT error and tries to build the file
# locally ( default hardcoded to 300 in version prior to 3.2 )
# Don't try to build the file locally when a remote job failed

On the Cross-Compiler system (i686,x86_64)

  • Start distccd service
export DISTCCD_PATH=/opt/crosstool-ng/tools/arm-bashlinux-linux-gnueabihf/arm-bashlinux-linux-gnueabihf/bin
distccd --daemon --jobs 4 --allow --verbose --log-stderr --no-detach

REF: http://jeremy-nicola.info/portfolio-item/cross-compilation-distributed-compilation-for-the-raspberry-pi/