/[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.5 - (hide annotations) (download) (as text)
Thu Sep 18 09:33:41 2003 UTC (10 years, 9 months ago) by swift
Branch: MAIN
Changes since 1.4: +44 -37 lines
File MIME type: application/xml
Update, thanks to lisa

1 swift 1.1 <?xml version='1.0' encoding="UTF-8"?>
2 blubber 1.3 <!DOCTYPE guide SYSTEM "/dtd/guide.dtd">
3 swift 1.5 <!-- $Header: /home/cvsroot/gentoo/xml/htdocs/doc/en/distcc.xml,v 1.4 2003/09/13 07:47:57 erwin 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 erwin 1.4 <mail link="lisa@gentoo.org">Lisa Seelye</mail>
11     </author>
12    
13     <author title="Editor">
14     <mail link="vapier@gentoo.org">Mike Frysinger</mail>
15     </author>
16    
17     <author title="Editor">
18     <mail link="erwin@gentoo.org">Erwin</mail>
19 blubber 1.2 </author>
20    
21     <author title="Reviewer">
22 erwin 1.4 <mail link="swift@gentoo.org">Sven Vermeulen</mail>
23 swift 1.1 </author>
24 blubber 1.2
25 swift 1.1 <author title="Reviewer">
26 erwin 1.4 <mail link="blubber@gentoo.org">Tiemo Kieft</mail>
27 swift 1.1 </author>
28    
29 swift 1.5 <version>1.2</version>
30     <date>September 17, 2003</date>
31 swift 1.1
32 blubber 1.2 <abstract>This document serves as a HOWTO for using distcc with Gentoo.</abstract>
33 swift 1.1
34     <chapter>
35 blubber 1.2 <title>Introduction</title>
36     <section>
37     <title>What is distcc?</title>
38     <body>
39     <p>Distcc is a program designed to distribute compiling tasks across a network to participating hosts. It is comprised of a server, <c>distccd</c> and a client program, <c>distcc</c>. Distcc can work transparently with <uri link="http://ccache.samba.org">ccache</uri> and Portage with a little set up.</p>
40     </body>
41     </section>
42    
43     <section>
44 erwin 1.4 <title>Dependencies</title>
45 blubber 1.2 <body>
46 erwin 1.4 <pre caption="Distcc dependencies">
47 swift 1.1 &gt;=sys-apps/portage-2.0.46-r11
48     &gt;=sys-devel/gcc-config-1.3.1
49 erwin 1.4 sys-apps/shadow
50 swift 1.5 <codenote>Distcc has the following optional dependencies when you have gtk in your USE flags (As of version 2.8)</codenote>
51 swift 1.1 &gt;=x11-libs/gtk+-2.2.1
52 blubber 1.2 </pre>
53     </body>
54     </section>
55 swift 1.1 </chapter>
56    
57     <chapter>
58 blubber 1.2 <title>Setup</title>
59     <section>
60     <title>Setting up Portage to use Distcc</title>
61     <body>
62     <p>Setting up distcc is very easy to do with Portage. Follow these simple steps on each computer you want to use distcc on:</p>
63     <pre caption="Integrating Distcc and Portage">
64 swift 1.1 # <i>emerge distcc</i>
65     # <i>nano -w /etc/make.conf</i>
66 swift 1.5 </pre>
67     <note>Edit your FEATURES flags to include &quot;distcc&quot;</note>
68     <note>Set <c>DISTCC_DIR=${PORTAGE_TMPDIR}/portage/.distcc</c></note>
69     <note>You should also uncomment the DISTCC_TMPDIR line.</note>
70    
71 swift 1.1
72 erwin 1.4 <p>Next you have to specify what hosts you want to use. To do this you can use the <c>distcc-config</c> command to set the list of hosts. Here is an example of some hosts that might be in your list:</p>
73 blubber 1.2 <pre caption="Examples of host definitions">
74 swift 1.1 192.168.0.1 192.168.0.2 192.168.0.3
75     192.168.0.1/2 192.168.0.2 192.168.0.3/10
76     192.168.0.1:4000/2 192.168.0.2/1 192.168.0.3:3632/4
77     @192.168.0.1 @192.168.0.2:/usr/bin/distccd 192.168.0.3
78 blubber 1.2 </pre>
79 erwin 1.4 <p>It may all look complicated, but in most cases a variant of line 1 or 2 will work. An explanation of each line is: Line 1 is just a space-delimited list of hosts that will use default everything. Line 2 is a list of hosts that specifies the maximum number of jobs (by use of the /N) to send that host at any given time (specified with the <c>/n</c>). Since most people won't be using lines 3 or 4, I'll <uri link="http://distcc.samba.org/man/distcc_1.html">point you to</uri> the distcc docs for more information.</p>
80 blubber 1.2 <p>A sample command to set the hosts (for line 1) is:</p>
81     <pre caption="Sample command to set the hosts">
82 erwin 1.4 # <i>/usr/bin/distcc-config --set-hosts "192.168.0.1 192.168.0.2 192.168.0.3"</i>
83 blubber 1.2 </pre>
84 swift 1.1
85 swift 1.5 <p>The final step to integrating distcc into Portage is to re-open your <path>/etc/make.conf</path> and edit <c>MAKEOPTS</c> to include <c>-jN</c> (where N is an integer). Typically you will want to set this to the total number of processors in your network plus one.</p>
86 blubber 1.2 <pre caption="Final steps in make.conf">
87 swift 1.1 # <i>nano -w /etc/make.conf</i>
88 swift 1.5 MAKEOPTS=-jN
89 blubber 1.2 </pre>
90 swift 1.5 <impo>Don't forget to start the distcc daemon! <c>/etc/init.d/distccd start</c></impo>
91 blubber 1.2 </body>
92     </section>
93     <section>
94     <title>Setting up Distcc to Work With Automake</title>
95     <body>
96 swift 1.5 <p>This is in some cases easier than the Portage setup. What you have to do is update your <c>PATH</c> environment variable to include <path>/usr/lib/distcc/bin</path> before where gcc (<path>/usr/bin</path>). However, there is a caveat. If you use ccache you have to put distcc after the ccache part. Like so:</p>
97 blubber 1.2 <pre caption="Setting your path">
98 swift 1.1 # <i>export PATH="/usr/lib/ccache/bin:/usr/lib/distcc/bin:${PATH}"</i>
99 blubber 1.2 </pre>
100     <p>Then, as you would normally type <c>make</c>, you would type <c>make -jN</c> (where N is an integer). A safe number to use for N varries on your network and the types of computers you are using to compile. For me, I have a dual processor P3 and a K6-2/400 that compile everything for my desktop (a 1200MHz Athlon Thunderbird) and I use -j5. Test your own settings to find the right number.</p>
101     </body>
102     </section>
103     </chapter>
104 swift 1.1
105 blubber 1.2 <chapter>
106     <title>Cross-Compiling</title>
107     <section>
108     <title>A Note on Cross-Compiling</title>
109     <body>
110     <p>Cross-compiling is using one architecture to build programs for another architecture. This can be as simple as using an Athlon (i686) to build a program for a K6-2 (i586), or using a Sparc to build a program for a ppc.</p>
111     </body>
112     </section>
113     <section>
114     <title>A Personal Note on Cross-compiling</title>
115     <body>
116     <p>I'd love to be able to help out on the Gentoo Cross-compiling effort, but I don't have any non-x86 machines. I can create things that work <e>in theory</e>, but I have to rely on other people to test what I write. That works to an extent, but it's tough. ;-)</p>
117     <p>In the near future I hope to acquire a Sparc of some type to put Gentoo on so I can play around in-house.</p>
118     </body>
119     </section>
120 swift 1.1 </chapter>
121    
122     <chapter>
123 blubber 1.2 <title>Using Distcc to Bootstrap</title>
124     <section>
125     <title>Step 1: Build the Tarball</title>
126     <body>
127     <p>This section is helpful if you want to use Distcc during the Gentoo installation. Surprisingly it isn't that hard. What you'll need is another computer running Gentoo and a way to transfer a tarball to your new system (I use scp).</p>
128 erwin 1.4 <p>First you have to build a tarball of Distcc and include a library (<path>/usr/lib/libpopt.so.*</path>).</p>
129 blubber 1.2 <pre caption="Building the tarball">
130 erwin 1.4 # <i>USE='-gtk -selinux' emerge --buildpkg distcc</i>
131     # <i>mkdir -p /tmp/distcc/usr/lib</i>
132     # <i>cp /usr/portage/packages/sys-devel/distcc-DISTCC_VERSION.tbz2 /tmp/distcc/</i>
133     # <i>cp /usr/lib/libpopt.so.* /tmp/distcc/usr/lib</i>
134     # <i>cd /tmp/distcc</i>
135     # <i>tar cfzv distcc.tar.gz *</i>
136     <codenote>Be sure you replace DISTCC_VERSION with the version (and Gentoo revision) of Distcc, <i>like 2.10-r1</i></codenote>
137 blubber 1.2 </pre>
138     </body>
139     </section>
140     <section>
141     <title>Step 2: Setup on New Box</title>
142     <body>
143     <impo>Do not forget to start sshd and reset the root password for the LiveCD!</impo>
144 erwin 1.4 <p>Next, you have to boot your new box with a Gentoo Linux LiveCD and follow all of the steps up until the bootstrapping. Then proceed with a little preliminary setup on the new box.</p>
145 blubber 1.2 <pre caption="Preliminary Setup">
146     <codenote>Here we add distcc to FEATURES</codenote>
147 swift 1.5 # <i>echo "FEATURES=\"\${FEATURES} distcc\"" &gt;&gt; /etc/make.conf</i>
148 erwin 1.4 <codenote>You can also use <i>nano</i> to edit <path>/etc/make.conf</path> and manually add distcc to FEATURES.</codenote>
149 swift 1.5 # <i>echo "MAKEOPTS=\"\${MAKEOPTS} -jN\"" &gt;&gt; /etc/make.conf</i>
150 erwin 1.4 <codenote>Just like above, you can use <i>nano</i> to edit <path>/etc/make.conf</path> and manually change MAKEOPTS.</codenote>
151 blubber 1.2 </pre>
152 erwin 1.4 <p>Then add the distcc user to your <path>/etc/passwd</path>:</p>
153 blubber 1.2 <pre caption="Add the distcc user to /etc/passwd">
154 swift 1.5 # <i>echo "distcc:x:240:2:distccd:/dev/null:/bin/false" &gt;&gt;/etc/passwd</i>
155 erwin 1.4 <codenote>Do not forget the `<i>&gt;&gt;</i>'</codenote>
156 blubber 1.2 </pre>
157     </body>
158     </section>
159     <section>
160     <title>Step 3: Copy the Tarball</title>
161     <body>
162     <p>Next you will want to copy the distcc tarball that you made.</p>
163     <pre caption="Copy the tarball to the new box">
164     <codenote>Execute this on the "old" box</codenote>
165 erwin 1.4 # <i>scp /tmp/distcc/distcc.tar.gz root@ip.of.new.box:/mnt/gentoo/</i>
166     <codenote>Substitute <i>ip.of.new.box</i> for your new box's IP</codenote>
167 blubber 1.2 </pre>
168     </body>
169     </section>
170    
171     <section>
172     <title>Step 4: Unpacking the Tarball</title>
173     <body>
174     <pre caption="Unpack the tarball">
175 erwin 1.4 # <i>tar xvfz distcc.tar.gz</i>
176     # <i>tar xvfjp distcc-DISTCC_VERSION.tbz2</i>
177     <codenote>Be sure you replace DISTCC_VERSION with the version (and Gentoo revision) of Distcc, <i>like 2.10-r1</i></codenote>
178 blubber 1.2 </pre>
179     </body>
180     </section>
181    
182     <section>
183     <title>Step 5: Setting Up Distcc Itself</title>
184     <body>
185     <p>Now set up distcc itself...</p>
186     <pre caption="Final distcc setup">
187 erwin 1.4 # <i>/usr/bin/distcc-config --install</i>
188     # <i>/usr/bin/distcc-config --set-hosts "localhost host1 host2 host3 ..."</i>
189 swift 1.5 </pre>
190 erwin 1.4 <p>distcc should be set up now to bootstrap! Continue the official install guide, and don't forget to re-emerge distcc after <c>emerge system</c>.</p>
191 blubber 1.2 </body>
192     </section>
193     </chapter>
194 swift 1.1
195 swift 1.5 <chapter>
196     <title>Known Problems With Distcc</title>
197     <section>
198     <title>Mozilla and Xfree</title>
199     <body>
200     <p>As you emerge various packages, you'll notice that they aren't being distributed (and indeed aren't being built in parallel). This is because the developers of Mozilla and Xfree .ebuilds disabled parallel building because it is known to cause problems. This isn't necessarily a distcc problem.</p>
201     <p>That isn't to say that sometimes distcc will cause a package to fail to compile.</p>
202     </body>
203     </section>
204     <section>
205     <title>A Mixture of hardened-gcc and non-hardened-gcc Hosts Will Be Faulty</title>
206     <body>
207     <p>With such a long title any explanation here is almost irrelevent. However, if you plan to use distcc across hosts that have the <uri link="http://www.gentoo.org/proj/en/hardened/etdyn-ssp.xml">PaX/hardened-gcc</uri> and some that do not, you will run into problems.</p>
208     <p>The solution requires a little foresight on your part; you have to run <c>hardened-gcc -R</c> on the host that has PaX/hardened-gcc, or you have to enable PaX protections in your kernel and <c>emerge hardened-gcc</c>. Both of which are a good thing to do since for the most part the protections offered by both packages is a good thing and is transparent to the user.</p>
209     </body>
210     </section>
211     <section>
212     <title>Mixed GCC Versions</title>
213     <body>
214     <p>If you have differing versions of GCC on your hosts, there will likely be very weird problems. The solution is to make certain all hosts have the same GCC version.</p>
215     </body>
216     </section>
217     </chapter>
218 swift 1.1
219     <chapter>
220 blubber 1.2 <title>Distcc Extras</title>
221     <section>
222     <title>Distcc Monitors</title>
223     <body>
224     <p>Distcc ships with two monitors. The text-based one is always built, it is called <c>distccmon-text</c>. Running it for the first time can be a bit confusing, but it is really quite easy to use. If you run the program with no parameter it will run once. However, if you pass it a number it will update every N seconds, where N is the argument you passed.</p>
225     <p>The other monitor is only turned on if you enabled <c>gtk</c> in your <c>USE</c> flags. This one is GTK+ based and runs in an X environment, and it is quite lovely.</p>
226     <p>There is a caveat to using these programs. If you want to monitor any emerge, you have to start the monitor like so:</p>
227     <pre caption="Starting the monitors">
228 swift 1.5 # <i>DISTCC_DIR=/path/to/distccdir portage distccmon-text N</i>
229 swift 1.1 <codenote>Or you can start the graphical monitor...</codenote>
230 swift 1.5 # <i>DISTCC_DIR=/path/to/distccdir portage distccmon-gnome</i>
231 blubber 1.2 </pre>
232 swift 1.5 <note>If you aren't using Portage you do not need to specify DISTCC_DIR (i.e., just type distccmon-text N).</note>
233     <impo>If you are using Portage and used the above example, this will be <c>DISTCC_DIR=/var/tmp/portage/.distcc</c>.</impo>
234 blubber 1.2 </body>
235     </section>
236 swift 1.1 </chapter>
237    
238     <chapter>
239 blubber 1.2 <title>Future Plans for Distcc and Gentoo</title>
240     <section>
241     <title>distcc-subnetscan</title>
242     <body>
243     <p><c>distcc-subnetscan</c> is a perl program in development that will scan a subnet for hosts that have a participating distcc daemon. Even this will be enhanced to test if the daemon on a remote host will conform to a specific <c>CHOST</c> setting to make cross-compiling easier.</p>
244     <p>The perl script is being kept at <uri link="http://dev.gentoo.org/~lisa/distcc/distcc-subnetscan/distcc-subnetscan.pl">right here</uri> until a more formal home can be found.</p>
245     </body>
246     </section>
247     <section>
248     <title>distcc-config</title>
249     <body>
250     <p><c>distcc-config</c>, the userland configuration tool for distcc is out of date. Soon it will be rewritten to be brought up the current version of distcc.</p>
251     </body>
252     </section>
253 swift 1.1 </chapter>
254    
255     </guide>

  ViewVC Help
Powered by ViewVC 1.1.20