/[gentoo]/xml/htdocs/doc/en/distcc.xml
Gentoo

Diff of /xml/htdocs/doc/en/distcc.xml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.1 Revision 1.40
1<?xml version='1.0' encoding="UTF-8"?> 1<?xml version='1.0' encoding="UTF-8"?>
2<!DOCTYPE guide SYSTEM "/dtd/guide.dtd"> 2<!DOCTYPE guide SYSTEM "/dtd/guide.dtd">
3<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/distcc.xml,v 1.40 2007/06/21 23:46:16 rane Exp $ -->
4
3<guide link="/doc/en/distcc.xml"> 5<guide link="/doc/en/distcc.xml">
4 6
5<title>Gentoo Distcc Documentation</title> 7<title>Gentoo Distcc Documentation</title>
6 8
7<author title="Author"> 9<author title="Author">
8 <mail link="lisa@gentoo.org">Lisa M. Seelye</mail> 10 <mail link="lisa@gentoo.org">Lisa Seelye</mail>
11</author>
12<author title="Editor">
13 <mail link="vapier@gentoo.org">Mike Frysinger</mail>
14</author>
15<author title="Editor">
16 <mail link="erwin@gentoo.org">Erwin</mail>
17</author>
18<author title="Editor">
19 <mail link="swift@gentoo.org">Sven Vermeulen</mail>
20</author>
21<author title="Editor">
22 <mail link="pylon@gentoo.org">Lars Weiler</mail>
9</author> 23</author>
10<author title="Reviewer"> 24<author title="Reviewer">
11 <mail link="swift@gentoo.org">Sven Vermeulen</mail> 25 <mail link="blubber@gentoo.org">Tiemo Kieft</mail>
12</author> 26</author>
13<version>1.0</version>
14<date>5th of August 2003</date>
15 27
28<abstract>
29This document serves as a HOWTO for using distcc with Gentoo.
30</abstract>
31
32<!-- The content of this document is licensed under the CC-BY-SA license -->
33<!-- See http://creativecommons.org/licenses/by-sa/2.5 -->
16<license/> 34<license/>
17 35
18<abstract> 36<version>1.19</version>
19This document serves as a HOWTO for using distcc with gentoo. 37<date>2007-06-22</date>
20</abstract>
21 38
22<chapter> 39<chapter>
23<title>Introduction</title> 40<title>Introduction</title>
24<section> 41<section>
25<title>What is distcc?</title> 42<title>What is distcc?</title>
26<body> 43<body>
44
27<p> 45<p>
28Distcc is a program designed to distribute compiling tasks across a 46Distcc is a program designed to distribute compiling tasks across a network to
29network to participating hosts. It is comprised of a server, <c>distccd</c> 47participating hosts. It is comprised of a server, <c>distccd</c>, and a client
30and a client program, <c>distcc</c>. Distcc can work transparently with 48program, <c>distcc</c>. Distcc can work transparently with <uri
31<uri link="http://ccache.samba.org">ccache</uri> and Portage with a little 49link="http://ccache.samba.org">ccache</uri>, Portage, and Automake with a
32set up. 50little setup.
33</p> 51</p>
34 52
35</body> 53</body>
36</section>
37
38<section> 54</section>
39<title>Dependancies</title> 55<section>
56<title>Using distcc to bootstrap</title>
40<body> 57<body>
41<pre caption="Distcc Dependancies"> 58
42&gt;=sys-apps/portage-2.0.46-r11 59<p>
43&gt;=sys-devel/gcc-config-1.3.1 60If you are planning on using distcc to help you bootstrap a Gentoo
44&gt;sys-apps/shadow 61installation, make sure you read the section <uri link="#bootstrapping">Using
45<codenote>(As of version 2.8) And the following optional dependancies when you have <c>gtk</c> in your <c>USE</c> flags</codenote> 62distcc to Bootstrap</uri>, which is situated further down in this document.
46&gt;=x11-libs/gtk+-2.2.1
47</pre> 63</p>
48 64
49</body> 65</body>
50</section> 66</section>
51</chapter> 67</chapter>
52 68
53<chapter> 69<chapter>
54<title>Setup</title> 70<title>Setup</title>
55<section> 71<section>
72<title>Dependencies</title>
73<body>
74
75<p>
76In order to use Distcc, all of the computers on your network need to have the
77same GCC versions. For example, mixing 3.3.x (where the x varies) is okay, but
78mixing 3.3.x with 3.2.x <b>may</b> result in compilation errors or runtime
79errors.
80</p>
81
82</body>
83</section>
84<section>
85<title>Installing Distcc</title>
86<body>
87
88<p>
89There are a couple of options you should be aware of before you start
90installing distcc.
91</p>
92
93<p>
94Distcc ships with a graphical monitor to monitor tasks that your computer is
95sending away for compilation. If you use Gnome then put 'gnome' in your USE
96flags. However, if you don't use Gnome and would still like to have the
97monitor then you should put 'gtk' in your USE flags.
98</p>
99
100<pre caption="Installing distcc">
101# <i>emerge distcc</i>
102</pre>
103
104<impo>
105Remember, you must be sure to install distcc on all of your participating
106machines.
107</impo>
108
109</body>
110</section>
111<section>
56<title>Setting up Portage to use Distcc</title> 112<title>Setting up Portage to use Distcc</title>
57<body> 113<body>
58 114
59<p> 115<p>
60Setting up distcc is very easy to do with Portage. Follow these simple 116Setting up Portage to use distcc is easy. Execute the following steps on
61steps on each computer you want to use distcc on: 117each system that should participate in the distributed compiling:
62</p> 118</p>
63 119
64<pre caption="Integrating Distcc and Portage"> 120<pre caption="Integrating Distcc and Portage">
65# <i>emerge distcc</i> 121# <i>emerge distcc distcc-config</i>
66# <i>nano -w /etc/make.conf</i> 122# <i>nano -w /etc/make.conf</i>
67<codenote>Edit your FEATURES flags to include &quot;distcc&quot;</codenote> 123<comment>(Set N to a suitable number for your particular setup)</comment>
124<comment>(A common strategy is setting N as twice the number of total CPUs + 1 available)</comment>
125MAKEOPTS="-jN"
126<comment>(Add distcc to your FEATURES)</comment>
127FEATURES="distcc"
68</pre> 128</pre>
69 129
130</body>
131</section>
132<section>
133<title>Specifying Participating Hosts</title>
134<body>
135
70<p> 136<p>
71Next you have to specify what hosts you want to use. To do this you can
72use the <i>distcc-config</i> command to set that list of hosts. Here is an 137Use the <c>distcc-config</c> command to set the list of hosts. Here is an
73example of some hosts that might be in your list: 138example of some hosts that might be in your list:
74</p> 139</p>
75 140
76<pre caption="Examples of host definitions"> 141<pre caption="Examples of host definitions">
77192.168.0.1 192.168.0.2 192.168.0.3 142192.168.0.1 192.168.0.2 192.168.0.3
78192.168.0.1/2 192.168.0.2 192.168.0.3/10 143192.168.0.1/2 192.168.0.2 192.168.0.3/10
79192.168.0.1:4000/2 192.168.0.2/1 192.168.0.3:3632/4 144192.168.0.1:4000/2 192.168.0.2/1 192.168.0.3:3632/4
80@192.168.0.1 @192.168.0.2:/usr/bin/distccd 192.168.0.3 145@192.168.0.1 @192.168.0.2:/usr/bin/distccd 192.168.0.3
146<comment>(There are also several other methods of setting up hosts. See the
147distcc manpage for more details.)</comment>
148<comment>If you wish to compile on the local machine you should put 'localhost'
149in the hosts list. Conversely if you do not wish to use the local machine to
150compile (which is often the case) omit it from the hosts list. On a slow
151machine using localhost may actually slow things down. Make sure to test your
152settings for performance.</comment>
81</pre> 153</pre>
82 154
83<p> 155<p>
84It may all look complicated, but in most cases a variant of line 1 156It may all look complicated, but in most cases a variant of line 1 or 2 will
85or 2 will work. An explanation of each line is: Line 1 is just a 157work.
86space-delimited list of hosts that will use default everything.
87Line 2 is a list of hosts that specifies the maximum number of jobs (by
88use of the /N) to send that host at any given time. Since most people
89won't be using lines 3 or 4, I'll point you to the <uri
90link="http://distcc.samba.org/man/distcc_1.html">distcc docs</uri> for
91more information.
92</p>
93
94<p> 158</p>
95The final step to integrating distcc into Portage is to re-open your 159
96<path>/etc/make.conf</path> and edit <c>MAKE_OPTS</c> to include <c>-jN</c>
97(where N is an integer). Typically you will want to set this to the total
98number of processors in your network plus one.
99</p> 160<p>
100 161Since most people won't be using lines 3 or 4, I'll <uri
101<pre caption="Final steps in make.conf"> 162link="http://distcc.samba.org/man/distcc_1.html">refer to</uri> the distcc
102# <i>nano -w /etc/make.conf</i> 163docs (man distcc) for more information.
103MAKE_OPTS=-jN
104</pre> 164</p>
105 165
106</body> 166<p>
107</section> 167For instance, to set the first line in the previous example:
168</p>
108 169
170<pre caption="Sample command to set the hosts">
171# <i>/usr/bin/distcc-config --set-hosts "192.168.0.1 192.168.0.2 192.168.0.3"</i>
172</pre>
173
174<p>
175Edit <path>/etc/conf.d/distccd</path> to your needs and be sure to set the
176<c>--allow</c> directive to allow only hosts you trust. For added security,
177you should also use the <c>--listen</c> directive to tell the distcc daemon
178what IP to listen on (for multi-homed systems). More information on distcc
179security can be found at <uri
180link="http://distcc.samba.org/security.html">Distcc Security Design</uri>.
181</p>
182
183<impo>
184It is important to use --allow and --listen. Please read the distccd manpage
185or the above security document for more information.
186</impo>
187
188
189<p>
190Now start the distcc daemon on all the participating computers:
191</p>
192
193<pre caption="Starting the distcc daemon">
194<comment>(Add distccd to the default runlevel)</comment>
195# <i>rc-update add distccd default</i>
196<comment>(Start the distcc daemon)</comment>
197# <i>/etc/init.d/distccd start</i>
198</pre>
199
200</body>
201</section>
109<section> 202<section>
110<title>Setting up Distcc to Work With Automake</title> 203<title>Setting up Distcc to Work With Automake</title>
111<body> 204<body>
112 205
113<p> 206<p>
114This is in some cases easier than the Portage setup. What you have to do 207This is, in some cases, easier than the Portage setup. What you have to do is
115is update your <c>PATH</c> environment variable to include 208update your <c>PATH</c> variable to include <path>/usr/lib/distcc/bin</path>
116<path>/usr/lib/distcc/bin</path> before the directory where gcc is 209in front of the directory that contains <c>gcc</c> (<path>/usr/bin</path>).
117situated (<path>/usr/bin</path>). However, there is a caveat. If you use 210However, there is a caveat. If you use ccache you have to put distcc after
118ccache you have to put distcc after the ccache part. Like so: 211the ccache part:
119</p> 212</p>
120 213
121<pre caption="Setting your path"> 214<pre caption="Setting your path">
122# <i>export PATH="/usr/lib/ccache/bin:/usr/lib/distcc/bin:${PATH}"</i> 215# <i>export PATH="/usr/lib/ccache/bin:/usr/lib/distcc/bin:${PATH}"</i>
216<comment>(You can put this in your ~/.bashrc or equivalent file to have the PATH
217set every time you log in)</comment>
123</pre> 218</pre>
124 219
125<p> 220<p>
126Then, as you would normally type <c>make</c>, you would type <c>make -jN</c> 221Then, as you would normally type <c>make</c>, you would type <c>make -jN</c>
127(where N is an integer). A safe number to use for N varies on your network 222(where N is an integer). The value of N depends on your network and the types
128and the types of computers you are using to compile. For me, I have a dual 223of computers you are using to compile. Test your own settings to find the
129processor P3 and a K6-2/400 that compile everything for my desktop (a 1200MHz 224number that yields the best performance.
130Athlon Thunderbird) and I use -j5. Test your own settings to find the right
131number.
132</p> 225</p>
133 226
134</body> 227</body>
135</section> 228</section>
136</chapter> 229</chapter>
137 230
138<chapter> 231<chapter>
139<title>Cross-Compiling</title> 232<title>Cross-Compiling</title>
140<section> 233<section>
141<title>A Note on Cross-Compiling</title>
142<body> 234<body>
143 235
144<p> 236<p>
145Cross-compiling is using one architecture to build programs for another 237Cross-compiling is using one architecture to build programs for another
146architecture. This can be as simple as using an Athlon (i686) to build a 238architecture. This can be as simple as using an Athlon (i686) to build a
147program for a K6-2 (i586), or using a Sparc to build a program for a ppc. 239program for a K6-2 (i586), or using a Sparc to build a program for a ppc. This
240is documented in our <uri link="/doc/en/cross-compiling-distcc.xml">DistCC
241Cross-compiling Guide</uri>.
148</p> 242</p>
149 243
150</body> 244</body>
151</section>
152
153<section> 245</section>
154<title>A Personal Note on Cross-compiling</title> 246</chapter>
247
248<chapter id="bootstrapping">
249<title>Using Distcc to Bootstrap</title>
250<section>
251<title>Step 1: Configure Portage</title>
252<body>
253<!--
254Note that this will need to become a link to the old 2005.1 networked handbooks
255once the 2006.0 handbooks are released. Until then, the link can stay.
256-->
257<p>
258Boot your new box with a Gentoo Linux LiveCD and follow the <uri
259link="/doc/en/handbook/handbook-x86.xml?part=1">installation instructions</uri>
260up until the bootstrapping part. (See the <uri
261link="/doc/en/faq.xml#stage12">Gentoo FAQ</uri> for more information about
262bootstrapping.) Then configure Portage to use distcc:
263</p>
264
265<pre caption="Preliminary Setup">
266# <i>nano -w /etc/make.conf</i>
267<comment>(Add distcc to the FEATURES</comment>
268FEATURES="distcc"
269<comment>(Modify MAKEOPTS to include -jN, where N is twice the number of CPUs
270+1 available)</comment>
271MAKEOPTS="-jN"
272</pre>
273
274<pre caption="Setting your path">
275# <i>export PATH="/usr/lib/ccache/bin:/usr/lib/distcc/bin:${PATH}"</i>
276</pre>
277
155<body> 278</body>
279</section>
280<section>
281<title>Step 2: Getting Distcc</title>
282<body>
156 283
157<p>
158I'd love to be able to help out on the Gentoo Cross-compiling effort, but
159I don't have any non-x86 machines. I can create things that work
160<e>in theory</e>, but I have to rely on other people to test what I write.
161That works to an extent, but it's tough. ;-)
162</p> 284<p>
163 285Install distcc:
164<p> 286</p>
165In the near future I hope to acquire a Sparc of some type to put Gentoo 287
166on so I can play around in-house. 288<pre caption="Getting Distcc on the new box">
289# <i>USE='-*' emerge --nodeps sys-devel/distcc sys-devel/distcc-config</i>
290</pre>
291
292</body>
293</section>
294<section>
295<title>Step 3: Setting Up Distcc</title>
296<body>
297
167</p> 298<p>
299Run <c>distcc-config --install</c> to setup distcc:
300</p>
301
302<pre caption="Final distcc setup">
303<comment>(Substitute host1, host2, ... with the IP number(s) of the
304participating hosts)</comment>
305# <i>/usr/bin/distcc-config --set-hosts "localhost host1 host2 host3 ..."</i>
306<comment>An example: <i>/usr/bin/distcc-config --set-hosts "localhost
307192.168.0.4 192.168.0.6"</i></comment>
308</pre>
309
310<p>
311Distcc is now set up to bootstrap! Continue with the official installation
312instructions and <e>do not forget</e> to re-emerge distcc after <c>emerge
313system</c>. This is to make sure that all of the dependencies you want are
314installed as well.
315</p>
316
317<note>
318During bootstrap and <c>emerge system</c> distcc may not appear to be used.
319This is expected as some ebuilds do not work well with distcc, so they
320intentionally disable it.
321</note>
168 322
169</body> 323</body>
170</section> 324</section>
171</chapter> 325</chapter>
172 326
173<chapter> 327<chapter>
174<title>Known Problems With Distcc</title> 328<title>Troubleshooting</title>
175
176<section>
177<title>Portage Doesn't Work With Distcc</title>
178<body>
179
180<p>
181This heading is a misnomer, really. The only thing that doens't work is
182the monitoring programs (<c>distccmon-text</c> and <c>distccmon-gnome</c>)
183with the standard distcc source. The reason for this is that distcc relies
184on the <c>TMPDIR</c> environment variable, but Portage reassigns that.
185</p>
186
187<p>
188The solution to this is a patch that changes the dependancy to
189<c>DISTCC_TMPDIR</c>. The patch is automatically applied to distcc.
190If you don't want to use <path>/tmp</path> (the default) you can reassign
191<c>DISTCC_TMPDIR</c>.
192</p>
193
194<p>
195You may also notice that distcc does not work with some packages.
196This can be a result of several things, such as an error in the .ebuild
197(Using <c>make</c> instead of <c>emake</c>) or an error in the program's
198Makefile, which the next section addresses.
199</p>
200
201</body>
202</section> 329<section>
330<title>Some Packages Don't Use Distcc</title>
331<body>
332
333<p>
334As you emerge various packages, you'll notice that some of them aren't being
335distributed (and aren't being built in parallel). This may happen because the
336package's Makefile doesn't support parallel operations or the maintainer of the
337ebuild has explicitly disabled parallel operations due to a known problem.
338</p>
339
340<p>
341Sometimes distcc might cause a package to fail to compile. If this happens
342for you, please <uri link="http://bugs.gentoo.org">report</uri> it to us.
343</p>
344
345</body>
203<section> 346</section>
204<title>Mozilla and XFree</title> 347<section>
348<title>Mixed GCC Versions</title>
205<body> 349<body>
206 350
207<p>
208As you emerge various packages, you'll notice that they aren't being
209distributed (and indeed aren't being built in parallel). This is because
210the developers of Mozilla and XFree .ebuilds disabled parallel building
211because it is known to cause problems. This isn't necessarily a distcc
212problem.
213</p> 351<p>
214 352If you have different GCC versions on your hosts, there will likely be very
353weird problems. The solution is to make certain all hosts have the same GCC
354version.
215<p> 355</p>
216That isn't to say that sometimes distcc will cause a package to fail 356
217to compile.
218</p> 357<p>
358Recent Portage updates have made Portage use <c>${CHOST}-gcc</c> instead of
359<c>gcc</c>. This means that if you're mixing i686 machines with other types
360(i386, i586) you will run into problems. A workaround for this may be to
361<c>export CC='gcc' CXX='c++'</c> or to put it in <path>/etc/make.conf</path>.
362</p>
363
364<impo>
365Doing this explicitly redefines some behaviour of Portage and may have some
366weird results in the future. Only do this if you're mixing CHOSTs.
367</impo>
368
219 369
220</body> 370</body>
221</section> 371</section>
222</chapter> 372</chapter>
223 373
226<section> 376<section>
227<title>Distcc Monitors</title> 377<title>Distcc Monitors</title>
228<body> 378<body>
229 379
230<p> 380<p>
231Distcc ships with two monitors. The text-based one is always built and 381Distcc ships with two monitors. The text-based one is always built and is
232is called <c>distccmon-text</c>. Running it for the first time can be a 382called <c>distccmon-text</c>. Running it for the first time can be a bit
233bit confusing, but it is really quite easy to use. If you run the program 383confusing, but it is really quite easy to use. If you run the program with no
234with no parameter it will run once. However, if you pass it a number it 384parameter it will run once. However, if you pass it a number it will update
235will update every N seconds, where N is the argument you passed. 385every N seconds, where N is the argument you passed.
236</p>
237
238<p> 386</p>
387
388<p>
239The other monitor is only turned on if you enabled <c>gtk</c> in your 389The other monitor is only turned on if you enabled <c>gtk</c> or <c>gnome</c>
240<c>USE</c> flags. This one is GTK+ based and runs in an X environment, and 390in your <c>USE</c> flags. This one is GTK+ based, runs in an X environment
241it is quite lovely. 391and it is quite lovely. For Gentoo the GUI monitor has been called
242</p> 392<c>distccmon-gui</c> for less confusion. Elsewhere it may be referred to as
243 393<c>distccmon-gnome</c>.
244<p>
245There is a caveat to using these programs. If you want to monitor any
246emerge, you have to start the monitor like so:
247</p> 394</p>
248 395
249<pre caption="Starting the monitors"> 396<pre caption="Starting the monitors">
250# <i>sudo -u portage distccmon-text N</i> 397# <i>distccmon-text N</i>
251<codenote>Or you can start the graphical monitor...</codenote> 398<comment>(Or)</comment>
252# <i>sudo -u portage distccmon-gnome</i> 399# <i>distccmon-gui</i>
400<comment>To monitor Portage's distcc usage you can use:</comment>
401# <i>DISTCC_DIR="/var/tmp/portage/.distcc/" distccmon-text N</i>
402<comment>(Or)</comment>
403# <i>DISTCC_DIR="/var/tmp/portage/.distcc/" distccmon-gui</i>
253</pre> 404</pre>
254 405
255</body> 406<impo>
256</section> 407If your distcc directory is elsewhere, change the DISTCC_DIR variable
257</chapter> 408accordingly.
409</impo>
258 410
259<chapter> 411</body>
260<title>Future Plans for Distcc and Gentoo</title>
261<section> 412</section>
262<title>distcc-subnetscan</title>
263<body>
264
265<p>
266<c>distcc-subnetscan</c> is a perl program in development that will scan a
267subnet for hosts that have a participating distcc daemon. Even this will
268be enhanced to test if the daemon on a remote host will conform to a
269specific <c>CHOST</c> setting to make cross-compiling easier.
270</p>
271
272<p>
273The perl script is being kept at <uri link="http://dev.gentoo.org/~lisa/distcc/distcc-subnetscan/distcc-subnetscan.pl">right here</uri>
274until a more formal home can be found.
275</p>
276
277</body>
278</section>
279
280<section>
281<title>distcc-config</title>
282<body>
283
284<p>
285<c>distcc-config</c>, the userland configuration tool for distcc is out of
286date. Soon it will be rewritten to be brought up with the current version
287of distcc.
288</p>
289
290</body>
291</section>
292</chapter> 413</chapter>
293
294</guide> 414</guide>

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.40

  ViewVC Help
Powered by ViewVC 1.1.20