| 2 | |
| 3 | === Building with distcc === |
| 4 | The Pi is not the fastest machine and it has limited memory so one can not build for example qtwebengine locally. |
| 5 | To use distcc (I have a cluster of 3 gentoo servers for that) I installed a proper toolchain on the hosts using gentoos crossdev with the proper versions for the raspian buster: |
| 6 | * crossdev --g 8.3.0-r1 --l 2.28-r6 -t arm-linux-gnueabihf |
| 7 | I could not really make distcc work in a "regular" way so I used the good old wrapper method: |
| 8 | * cd /usr/lib/distcc |
| 9 | * sudo mkdir bin |
| 10 | * cd bin |
| 11 | * sudo nano arm-linux-gnueabihf-wrapper |
| 12 | {{{ |
| 13 | #!/bin/bash |
| 14 | exec /usr/lib/distcc/bin/arm-linux-gnueabihf-g${0:$[-2]} "$@" |
| 15 | } |
| 16 | * sudo chmod a+x arm-linux-gnueabihf-wrapper |
| 17 | * sudo ln -s arm-linux-gnueabihf-wrapper c++ |
| 18 | * sudo ln -s arm-linux-gnueabihf-wrapper cc |
| 19 | * sudo ln -s arm-linux-gnueabihf-wrapper g++ |
| 20 | * sudo ln -s arm-linux-gnueabihf-wrapper gcc |
| 21 | * sudo ln -s ../../../bin/distcc arm-linux-gnueabihf-g++ |
| 22 | * sudo ln -s ../../../bin/distcc arm-linux-gnueabihf-g++-8 |
| 23 | * sudo ln -s ../../../bin/distcc arm-linux-gnueabihf-gcc |
| 24 | * sudo ln -s ../../../bin/distcc arm-linux-gnueabihf-gcc-8 |
| 25 | * sudo ls -la |
| 26 | should look like that: |
| 27 | {{{ |
| 28 | drwxr-xr-x 2 root root 4096 Apr 15 21:03 . |
| 29 | drwxr-xr-x 3 root root 4096 Apr 14 22:05 .. |
| 30 | lrwxrwxrwx 1 root root 19 Apr 14 22:12 arm-linux-gnueabihf-g++ -> ../../../bin/distcc |
| 31 | lrwxrwxrwx 1 root root 19 Apr 14 22:12 arm-linux-gnueabihf-g++-8 -> ../../../bin/distcc |
| 32 | lrwxrwxrwx 1 root root 19 Apr 14 22:12 arm-linux-gnueabihf-gcc -> ../../../bin/distcc |
| 33 | lrwxrwxrwx 1 root root 19 Apr 14 22:12 arm-linux-gnueabihf-gcc-8 -> ../../../bin/distcc |
| 34 | -rwxr-xr-x 1 root root 74 Apr 14 22:09 arm-linux-gnueabihf-wrapper |
| 35 | lrwxrwxrwx 1 root root 27 Apr 14 22:13 c++ -> arm-linux-gnueabihf-wrapper |
| 36 | lrwxrwxrwx 1 root root 27 Apr 14 22:13 cc -> arm-linux-gnueabihf-wrapper |
| 37 | lrwxrwxrwx 1 root root 27 Apr 14 22:13 g++ -> arm-linux-gnueabihf-wrapper |
| 38 | lrwxrwxrwx 1 root root 27 Apr 14 22:13 gcc -> arm-linux-gnueabihf-wrapper |
| 39 | }}} |
| 40 | to use distcc to build just set $PATH so that it contains /usr/lib/distcc/bin first: |
| 41 | * export PATH=/usr/lib/distcc/bin:$PATH |
| 42 | add the build-host to the /etc/distcc/hosts |
| 43 | * nano /etc/distcc/hosts |
| 44 | {{{ |
| 45 | # Add a list of hostnames in one line, seperated by spaces, here. |
| 46 | 192.168.14.70 192.168.14.5 |
| 47 | }}} |
| 48 | then just call gcc or make. |
| 49 | ==== test that distcc works ==== |
| 50 | * cd ~ |
| 51 | * mkdir distcc_test |
| 52 | * cd distcc_test |
| 53 | * nano main.c |
| 54 | with the content: |
| 55 | {{{ |
| 56 | #include <stdio.h> |
| 57 | |
| 58 | int main() { |
| 59 | printf("Hello distcc!\n"); |
| 60 | return 0; |
| 61 | } |
| 62 | set distcc messages to verbose: |
| 63 | * export DISTCC_VERBOSE=1 |
| 64 | make sure that you have /usr/lib/distcc/bin in the begining of the PATH (see above) |
| 65 | * gcc -c main.c -o main.o |
| 66 | you should see a lot of messages from distcc (look for something like |
| 67 | }}} |