3 | | Useful links: |
| 3 | 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. |
| 4 | |
| 5 | |
| 6 | == Usage instructions == |
| 7 | |
| 8 | The following instructions assume your main development machine is running Haiku and the helper machines run Linux. |
| 9 | |
| 10 | === Preparing helper machines === |
| 11 | |
| 12 | * Install [http://code.google.com/p/distcc/ distcc], using the package manager or from source |
| 13 | |
| 14 | * Check out the build tools |
| 15 | {{{ |
| 16 | svn co http://svn.haiku-os.org/haiku/buildtools/trunk buildtools |
| 17 | }}} |
| 18 | |
| 19 | * Check out partial Haiku tree |
| 20 | {{{ |
| 21 | svn co --depth=immediates http://svn.haiku-os.org/haiku/haiku/trunk haiku |
| 22 | svn update --set-depth infinity build headers/config headers/os headers/posix |
| 23 | }}} |
| 24 | |
| 25 | * Build the cross-compilers |
| 26 | {{{ |
| 27 | mkdir generated.x86gcc2 |
| 28 | mkdir generated.x86gcc4 |
| 29 | cd generated.x86gcc2 |
| 30 | ../configure --use-32bit --alternative-gcc-output-dir ../generated.x86gcc4 --build-cross-tools ../../buildtools/ |
| 31 | cd ../generated.x86gcc4 |
| 32 | ../configure --alternative-gcc-output-dir ../generated.x86gcc2 --build-cross-tools-gcc4 x86 ../../buildtools/ |
| 33 | cd .. |
| 34 | }}} |
| 35 | |
| 36 | * 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. |
| 37 | {{{ |
| 38 | mkdir bin && cd bin |
| 39 | ln -s ../generated.x86gcc2/cross-tools/i586-pc-haiku/bin/gcc i586-pc-haiku-gcc-2.95.3-haiku-100818 |
| 40 | ln -s ../generated.x86gcc4/cross-tools/i586-pc-haiku/bin/gcc i586-pc-haiku-gcc-4.4.4-haiku-101111 |
| 41 | cd .. |
| 42 | }}} |
| 43 | |
| 44 | * Start the distcc daemon |
| 45 | {{{ |
| 46 | PATH=$PWD/bin:$PATH distccd --allow <IP of Haiku machine> |
| 47 | }}} |
| 48 | |
| 49 | |
| 50 | === Preparing the Haiku machine === |
| 51 | |
| 52 | * Make GCC 2 and 4 available under the verbose names. |
| 53 | {{{ |
| 54 | ln -s /boot/develop/abi/x86/gcc2/tools/current/bin/gcc /boot/common/bin/i586-pc-haiku-gcc-2.95.3-haiku-100818 |
| 55 | ln -s /boot/develop/abi/x86/gcc4/tools/current/bin/gcc /boot/common/bin/i586-pc-haiku-gcc-4.4.4-haiku-101111 |
| 56 | }}} |
| 57 | |
| 58 | * Adjust {{{generated.x86gcc2/build/BuildConfig}}} |
| 59 | {{{ |
| 60 | HAIKU_CC ?= distcc i586-pc-haiku-gcc-2.95.3-haiku-100818 ; |
| 61 | }}} |
| 62 | |
| 63 | * Adjust {{{generated.x86gcc4/build/BuildConfig}}} |
| 64 | {{{ |
| 65 | HAIKU_CC ?= distcc i586-pc-haiku-gcc-4.4.4-haiku-101111 ; |
| 66 | }}} |
| 67 | |
| 68 | * Add hostname or IP addresses of the helpers to {{{/boot/common/etc/distcc/hosts}}} |
| 69 | |
| 70 | * Uncomment {{{127.0.0.1}}} in {{{/boot/common/etc/distcc/hosts/clients.allow}}} |
| 71 | |
| 72 | * Start the distcc daemon |
| 73 | {{{ |
| 74 | distccd --allow 127.0.0.1 |
| 75 | }}} |
| 76 | |
| 77 | 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 |
| 78 | {{{ |
| 79 | distccmon-text 1 |
| 80 | }}} |
| 81 | |
| 82 | If you want to use distcc in combination with with [wiki:DevelopmentTools/ColorGCC colorgcc], you can mask simply the distcc executable |
| 83 | {{{ |
| 84 | cd /boot/common/bin |
| 85 | mv distcc distcc_real |
| 86 | wget http://dev.haiku-os.org/raw-attachment/wiki/DevelopmentTools/DistCC/distcc |
| 87 | chmod +x distcc |
| 88 | }}} |
| 89 | |
| 90 | == References == |