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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.39 - (hide annotations) (download) (as text)
Sun Dec 24 17:54:01 2006 UTC (7 years, 7 months ago) by nightmorph
Branch: MAIN
Changes since 1.38: +5 -5 lines
File MIME type: application/xml
added full path to a code listing, bug 159018

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

  ViewVC Help
Powered by ViewVC 1.1.20