| 1 |
AUTHOR: Cedric de Wijs cedric.de.wijs<at>softhome<dot>net |
|---|
| 2 |
|
|---|
| 3 |
DATE: 2004-04-09 |
|---|
| 4 |
|
|---|
| 5 |
LICENSE: GNU Public Licence |
|---|
| 6 |
|
|---|
| 7 |
SYNOPSIS: How to install distcc --a free distributed C/C++ compiler system |
|---|
| 8 |
|
|---|
| 9 |
DESCRIPTION: |
|---|
| 10 |
TODO: put some usefull words here |
|---|
| 11 |
|
|---|
| 12 |
ATTACHMENTS: |
|---|
| 13 |
The distcc package, available from: |
|---|
| 14 |
http://distcc.samba.org/ftp/distcc/distcc-2.12.1.tar.bz2 (317,8kB) |
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
PREREQUISITES: |
|---|
| 18 |
This hint expect you to have two working lfs systems with the same version of gcc, binutils and glibc, and functional networking |
|---|
| 19 |
|
|---|
| 20 |
HINT: |
|---|
| 21 |
================= |
|---|
| 22 |
TABLE OF CONTENTS |
|---|
| 23 |
================= |
|---|
| 24 |
|
|---|
| 25 |
1 Introduction |
|---|
| 26 |
2 Required Files |
|---|
| 27 |
3 Installation server |
|---|
| 28 |
4 Installation client |
|---|
| 29 |
5 Usage |
|---|
| 30 |
6 Pitfalls |
|---|
| 31 |
7 Recommended reading |
|---|
| 32 |
|
|---|
| 33 |
=============== |
|---|
| 34 |
1 Introduction |
|---|
| 35 |
=============== |
|---|
| 36 |
|
|---|
| 37 |
Compiling sourcecode can take a long time. This hint describes how to install distcc, a tool that can be used to distribute the compiling across multiple machines in a network. |
|---|
| 38 |
The machine you sit behind and issue the compile from is the client. |
|---|
| 39 |
The machines who are doing the work are the servers. |
|---|
| 40 |
Every machine can contain both a server and a client |
|---|
| 41 |
|
|---|
| 42 |
This text is based upon the documentation of distcc, written by Martin Pool |
|---|
| 43 |
|
|---|
| 44 |
Estimated build time: 0.20 SBU |
|---|
| 45 |
Estimated required disk space: 5.4 MB |
|---|
| 46 |
|
|---|
| 47 |
================= |
|---|
| 48 |
2. REQUIRED FILES |
|---|
| 49 |
================= |
|---|
| 50 |
The distcc package, available from: |
|---|
| 51 |
http://distcc.samba.org/ftp/distcc/distcc-2.12.1.tar.bz2 (317,8kB) |
|---|
| 52 |
|
|---|
| 53 |
=============== |
|---|
| 54 |
3. Installation |
|---|
| 55 |
=============== |
|---|
| 56 |
To install the package run the following: |
|---|
| 57 |
|
|---|
| 58 |
./configure --sysconfdir=/etc && |
|---|
| 59 |
make && |
|---|
| 60 |
make install |
|---|
| 61 |
======================= |
|---|
| 62 |
3. Configuration server |
|---|
| 63 |
======================= |
|---|
| 64 |
To make distcc run as a server create a new user. Make sure /tmp is writable by that user: |
|---|
| 65 |
|
|---|
| 66 |
useradd distcc |
|---|
| 67 |
|
|---|
| 68 |
|
|---|
| 69 |
To start the daemon use the following command: |
|---|
| 70 |
|
|---|
| 71 |
nice -n 19 distccd --daemon |
|---|
| 72 |
|
|---|
| 73 |
|
|---|
| 74 |
To make distcc start at boottime use this script: |
|---|
| 75 |
|
|---|
| 76 |
cat > /etc/rc.d/init.d/distcc << "EOF" |
|---|
| 77 |
#!/bin/bash |
|---|
| 78 |
source /etc/sysconfig/rc |
|---|
| 79 |
source $rc_functions |
|---|
| 80 |
case "$1" in |
|---|
| 81 |
start) |
|---|
| 82 |
echo "Starting distributed compile daemon" |
|---|
| 83 |
nice -n 19 /usr/local/bin/distccd --daemon |
|---|
| 84 |
;; |
|---|
| 85 |
stop) |
|---|
| 86 |
echo "Stopping distributed compile daemon" |
|---|
| 87 |
killproc /usr/local/bin/distccd |
|---|
| 88 |
;; |
|---|
| 89 |
*) |
|---|
| 90 |
echo "Usage: $0 {start|stop|reload|restart|status}" |
|---|
| 91 |
exit 1 |
|---|
| 92 |
;; |
|---|
| 93 |
esac |
|---|
| 94 |
EOF |
|---|
| 95 |
chmod 700 /etc/rc.d/init.d/distcc |
|---|
| 96 |
|
|---|
| 97 |
And make some symlinks to it: |
|---|
| 98 |
|
|---|
| 99 |
cd /etc/rc.d/init.d && |
|---|
| 100 |
ln -sf ../init.d/distcc ../rc0.d/K00distcc && |
|---|
| 101 |
ln -sf ../init.d/distcc ../rc2.d/S99distcc && |
|---|
| 102 |
ln -sf ../init.d/distcc ../rc3.d/S99distcc && |
|---|
| 103 |
ln -sf ../init.d/distcc ../rc5.d/S99distcc && |
|---|
| 104 |
ln -sf ../init.d/distcc ../rc6.d/K00distcc |
|---|
| 105 |
|
|---|
| 106 |
======================= |
|---|
| 107 |
4. Configuration client |
|---|
| 108 |
======================= |
|---|
| 109 |
To make distcc run as a client run the following: |
|---|
| 110 |
|
|---|
| 111 |
./configure --sysconfdir=/etc && |
|---|
| 112 |
make && |
|---|
| 113 |
make install |
|---|
| 114 |
|
|---|
| 115 |
To let distcc know who the servers are edit the following file: |
|---|
| 116 |
|
|---|
| 117 |
mkdir ~/.distcc && |
|---|
| 118 |
cat > /root/.distcc/hosts << "EOF" |
|---|
| 119 |
localhost #your own machine |
|---|
| 120 |
192.168.0.201 #the first server, |
|---|
| 121 |
192.168.0.202 #and the second server |
|---|
| 122 |
EOF |
|---|
| 123 |
|
|---|
| 124 |
To make sure distcc is found before your real compiler, create some symlinks: |
|---|
| 125 |
|
|---|
| 126 |
ln -s /usr/local/bin/distcc /bin/c++ && |
|---|
| 127 |
ln -s /usr/local/bin/distcc /bin/cc && |
|---|
| 128 |
ln -s /usr/local/bin/distcc /bin/g++ && |
|---|
| 129 |
ln -s /usr/local/bin/distcc /bin/gcc |
|---|
| 130 |
|
|---|
| 131 |
======== |
|---|
| 132 |
5. Usage |
|---|
| 133 |
======== |
|---|
| 134 |
Instead of running the following command: |
|---|
| 135 |
./configure && make && make install |
|---|
| 136 |
Use these commands: |
|---|
| 137 |
./configure && make -j 6 && make install |
|---|
| 138 |
|
|---|
| 139 |
|
|---|
| 140 |
Every server can handle three clients per CPU unless otherwise configured, so the above comand can fill two servers. |
|---|
| 141 |
=========== |
|---|
| 142 |
6. Pitfalls |
|---|
| 143 |
=========== |
|---|
| 144 |
Don't use version 1.12. This version contains a bug causing distccd not to run as user distcc. Older and newer versions should work fine |
|---|
| 145 |
|
|---|
| 146 |
====================== |
|---|
| 147 |
7. Recommended reading |
|---|
| 148 |
====================== |
|---|
| 149 |
The documentation included with distcc |
|---|
| 150 |
|
|---|
| 151 |
The following hints: |
|---|
| 152 |
parallelcompiling.txt |
|---|
| 153 |
|
|---|
| 154 |
|
|---|
| 155 |
ACKNOWLEDGEMENTS: |
|---|
| 156 |
The programmer of this utility: |
|---|
| 157 |
Martin Pool <mbp@samba.org> |
|---|
| 158 |
|
|---|
| 159 |
The author of parallelcompiling.txt |
|---|
| 160 |
Daniel Baumann <daniel.baumann@panthera-systems.net> |
|---|
| 161 |
|
|---|
| 162 |
CHANGELOG: |
|---|
| 163 |
2004-04-09 Initial release |
|---|