== Introduction == distcc can distribute compilations across a network, greatly reducing compile times. Even if you only have one other computer available, it can already make a noticeable difference. == Usage instructions == The following instructions assume your main development machine is running Haiku and the helper machines run Linux. === Preparing helper machines === * Install [http://code.google.com/p/distcc/ distcc], using the package manager or from source * Check out the build tools {{{ svn co http://svn.haiku-os.org/haiku/buildtools/trunk buildtools }}} * Check out partial Haiku tree {{{ svn co --depth=immediates http://svn.haiku-os.org/haiku/haiku/trunk haiku svn update --set-depth infinity build headers/config headers/os headers/posix }}} * Build the cross-compilers {{{ mkdir generated.x86gcc2 mkdir generated.x86gcc4 cd generated.x86gcc2 ../configure --use-32bit --alternative-gcc-output-dir ../generated.x86gcc4 --build-cross-tools ../../buildtools/ cd ../generated.x86gcc4 ../configure --alternative-gcc-output-dir ../generated.x86gcc2 --build-cross-tools-gcc4 x86 ../../buildtools/ cd .. }}} * Make the cross-compilers available under a verbose name. Run {{{gcc -v}}} to find out the exact version. Verify that they are the same as on the Haiku machine. {{{ mkdir bin && cd bin ln -s ../generated.x86gcc2/cross-tools/i586-pc-haiku/bin/gcc i586-pc-haiku-gcc-2.95.3-haiku-100818 ln -s ../generated.x86gcc4/cross-tools/i586-pc-haiku/bin/gcc i586-pc-haiku-gcc-4.4.4-haiku-101111 cd .. }}} * Start the distcc daemon {{{ PATH=$PWD/bin:$PATH distccd --allow }}} === Preparing the Haiku machine === * Make GCC 2 and 4 available under the verbose names. {{{ ln -s /boot/develop/abi/x86/gcc2/tools/current/bin/gcc /boot/common/bin/i586-pc-haiku-gcc-2.95.3-haiku-100818 ln -s /boot/develop/abi/x86/gcc4/tools/current/bin/gcc /boot/common/bin/i586-pc-haiku-gcc-4.4.4-haiku-101111 }}} * Adjust {{{generated.x86gcc2/build/BuildConfig}}} {{{ HAIKU_CC ?= distcc i586-pc-haiku-gcc-2.95.3-haiku-100818 ; }}} * Adjust {{{generated.x86gcc4/build/BuildConfig}}} {{{ HAIKU_CC ?= distcc i586-pc-haiku-gcc-4.4.4-haiku-101111 ; }}} * Add hostname or IP addresses of the helpers to {{{/boot/common/etc/distcc/hosts}}} * Uncomment {{{127.0.0.1}}} in {{{/boot/common/etc/distcc/hosts/clients.allow}}} * Start the distcc daemon {{{ distccd --allow 127.0.0.1 }}} Now you can run {{{jam}}} as usual, but you should pass twice the total number of cores in the distcc network to the {{{-j}}} option. During a build, you can see what is happening by running {{{ distccmon-text 1 }}} If you want to use distcc in combination with with [wiki:DevelopmentTools/ColorGCC colorgcc], you can mask simply the distcc executable {{{ cd /boot/common/bin mv distcc distcc_real wget http://dev.haiku-os.org/raw-attachment/wiki/DevelopmentTools/DistCC/distcc chmod +x distcc }}} == References == * [http://ports.haiku-files.org/wiki/sys-devel/distcc/3.1/1 distcc on HaikuPorts] * [http://www.gentoo.org/doc/en/cross-compiling-distcc.xml distcc and cross-compilers] * [http://article.gmane.org/gmane.os.haiku.devel/8761 Using distcc (www.distcc.org) to speed up building Haiku]