/[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.4 - (show annotations) (download) (as text)
Sat Sep 13 07:47:57 2003 UTC (10 years, 7 months ago) by erwin
Branch: MAIN
Changes since 1.3: +50 -41 lines
File MIME type: application/xml
Fixed bug #28273

1 <?xml version='1.0' encoding="UTF-8"?>
2 <!DOCTYPE guide SYSTEM "/dtd/guide.dtd">
3 <!-- $Header: /home/cvsroot/gentoo/xml/htdocs/doc/en/distcc.xml,v 1.3 2003/09/08 08:09:02 blubber Exp $ -->
4
5 <guide link="/doc/en/distcc.xml">
6
7 <title>Gentoo Distcc Documentation</title>
8
9 <author title="Author">
10 <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 </author>
20
21 <author title="Reviewer">
22 <mail link="swift@gentoo.org">Sven Vermeulen</mail>
23 </author>
24
25 <author title="Reviewer">
26 <mail link="blubber@gentoo.org">Tiemo Kieft</mail>
27 </author>
28
29 <version>1.1</version>
30 <date>September 13, 2003</date>
31
32 <abstract>This document serves as a HOWTO for using distcc with Gentoo.</abstract>
33
34 <chapter>
35 <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 <title>Dependencies</title>
45 <body>
46 <pre caption="Distcc dependencies">
47 &gt;=sys-apps/portage-2.0.46-r11
48 &gt;=sys-devel/gcc-config-1.3.1
49 sys-apps/shadow
50 <codenote>(As of version 2.8) And the following optional dependencies when you have <i>gtk</i> in your <i>USE</i> flags</codenote>
51 &gt;=x11-libs/gtk+-2.2.1
52 </pre>
53 </body>
54 </section>
55 </chapter>
56
57 <chapter>
58 <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 # <i>emerge distcc</i>
65 # <i>nano -w /etc/make.conf</i>
66 <codenote>Edit your FEATURES flags to include &quot;distcc&quot;</codenote>
67 </pre>
68
69 <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>
70 <pre caption="Examples of host definitions">
71 192.168.0.1 192.168.0.2 192.168.0.3
72 192.168.0.1/2 192.168.0.2 192.168.0.3/10
73 192.168.0.1:4000/2 192.168.0.2/1 192.168.0.3:3632/4
74 @192.168.0.1 @192.168.0.2:/usr/bin/distccd 192.168.0.3
75 </pre>
76 <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>
77 <p>A sample command to set the hosts (for line 1) is:</p>
78 <pre caption="Sample command to set the hosts">
79 # <i>/usr/bin/distcc-config --set-hosts "192.168.0.1 192.168.0.2 192.168.0.3"</i>
80 </pre>
81
82 <p>The final step to integrating distcc into Portage is to re-open your <path>/etc/make.conf</path> and edit <c>MAKE_OPTS</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>
83 <pre caption="Final steps in make.conf">
84 # <i>nano -w /etc/make.conf</i>
85 MAKE_OPTS=-jN
86 </pre>
87 </body>
88 </section>
89 <section>
90 <title>Setting up Distcc to Work With Automake</title>
91 <body>
92 <p>This is in some cases easier than the Portage setup. What you have to do is update your <c>PATH</c> envvar 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>
93 <pre caption="Setting your path">
94 # <i>export PATH="/usr/lib/ccache/bin:/usr/lib/distcc/bin:${PATH}"</i>
95 </pre>
96 <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>
97 </body>
98 </section>
99 </chapter>
100
101 <chapter>
102 <title>Cross-Compiling</title>
103 <section>
104 <title>A Note on Cross-Compiling</title>
105 <body>
106 <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>
107 </body>
108 </section>
109 <section>
110 <title>A Personal Note on Cross-compiling</title>
111 <body>
112 <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>
113 <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>
114 </body>
115 </section>
116 </chapter>
117
118 <chapter>
119 <title>Known Problems With Distcc</title>
120 <section>
121 <title>Portage Doesn't Work With Distcc</title>
122 <body>
123 <p>This heading is a misnomer, really. The only thing that doesn't work is the monitoring programs (<c>distccmon-text</c> and <c>distccmon-gnome</c>) with the standard distcc source. The reason for this is that distcc relies on the <c>TMPDIR</c> envvar, but Portage reassigns that.</p>
124 <p>The solution to this is a patch that changes the dependency to <c>DISTCC_TMPDIR</c>. The patch is automatically applied to distcc. If you don't want to use <path>/tmp</path> (the default) you can reassign <c>DISTCC_TMPDIR</c>.</p>
125 <p>You may also notice that Distcc does not work with some packages. This can be a result of several things, such as an error in the .ebuild (Using <c>make</c> instead of <c>emake</c>) or an error in the program's Makefile, which the next section addresses.</p>
126 </body>
127 </section>
128 <section>
129 <title>Mozilla and Xfree</title>
130 <body>
131 <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>
132 <p>That isn't to say that sometimes distcc will cause a package to fail to compile.</p>
133 </body>
134 </section>
135 </chapter>
136
137 <chapter>
138 <title>Using Distcc to Bootstrap</title>
139 <section>
140 <title>Step 1: Build the Tarball</title>
141 <body>
142 <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>
143 <p>First you have to build a tarball of Distcc and include a library (<path>/usr/lib/libpopt.so.*</path>).</p>
144 <pre caption="Building the tarball">
145 # <i>USE='-gtk -selinux' emerge --buildpkg distcc</i>
146 # <i>mkdir -p /tmp/distcc/usr/lib</i>
147 # <i>cp /usr/portage/packages/sys-devel/distcc-DISTCC_VERSION.tbz2 /tmp/distcc/</i>
148 # <i>cp /usr/lib/libpopt.so.* /tmp/distcc/usr/lib</i>
149 # <i>cd /tmp/distcc</i>
150 # <i>tar cfzv distcc.tar.gz *</i>
151 <codenote>Be sure you replace DISTCC_VERSION with the version (and Gentoo revision) of Distcc, <i>like 2.10-r1</i></codenote>
152 </pre>
153 </body>
154 </section>
155 <section>
156 <title>Step 2: Setup on New Box</title>
157 <body>
158 <impo>Do not forget to start sshd and reset the root password for the LiveCD!</impo>
159 <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>
160 <pre caption="Preliminary Setup">
161 <codenote>Here we add distcc to FEATURES</codenote>
162 # <i>echo "FEATURES=\"\${FEATURES} distcc\"" >> /etc/make.conf</i>
163 <codenote>You can also use <i>nano</i> to edit <path>/etc/make.conf</path> and manually add distcc to FEATURES.</codenote>
164 # <i>echo "MAKEOPTS=\"\${MAKEOPTS} -jN\"" >> /etc/make.conf</i>
165 <codenote>Just like above, you can use <i>nano</i> to edit <path>/etc/make.conf</path> and manually change MAKEOPTS.</codenote>
166 </pre>
167 <p>Then add the distcc user to your <path>/etc/passwd</path>:</p>
168 <pre caption="Add the distcc user to /etc/passwd">
169 # <i>echo "distcc:x:240:2:distccd:/dev/null:/bin/false" >>/etc/passwd</i>
170 <codenote>Do not forget the `<i>&gt;&gt;</i>'</codenote>
171 </pre>
172 </body>
173 </section>
174 <section>
175 <title>Step 3: Copy the Tarball</title>
176 <body>
177 <p>Next you will want to copy the distcc tarball that you made.</p>
178 <pre caption="Copy the tarball to the new box">
179 <codenote>Execute this on the "old" box</codenote>
180 # <i>scp /tmp/distcc/distcc.tar.gz root@ip.of.new.box:/mnt/gentoo/</i>
181 <codenote>Substitute <i>ip.of.new.box</i> for your new box's IP</codenote>
182 </pre>
183 </body>
184 </section>
185
186 <section>
187 <title>Step 4: Unpacking the Tarball</title>
188 <body>
189 <pre caption="Unpack the tarball">
190 # <i>tar xvfz distcc.tar.gz</i>
191 # <i>tar xvfjp distcc-DISTCC_VERSION.tbz2</i>
192 <codenote>Be sure you replace DISTCC_VERSION with the version (and Gentoo revision) of Distcc, <i>like 2.10-r1</i></codenote>
193 </pre>
194 </body>
195 </section>
196
197 <section>
198 <title>Step 5: Setting Up Distcc Itself</title>
199 <body>
200 <p>Now set up distcc itself...</p>
201 <pre caption="Final distcc setup">
202 # <i>/usr/bin/distcc-config --install</i>
203 # <i>/usr/bin/distcc-config --set-hosts "localhost host1 host2 host3 ..."</i>
204 </pre>
205
206 <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>
207 </body>
208 </section>
209 </chapter>
210
211
212 <chapter>
213 <title>Distcc Extras</title>
214 <section>
215 <title>Distcc Monitors</title>
216 <body>
217 <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>
218 <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>
219 <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>
220 <pre caption="Starting the monitors">
221 # <i>sudo -u portage distccmon-text N</i>
222 <codenote>Or you can start the graphical monitor...</codenote>
223 # <i>sudo -u portage distccmon-gnome</i>
224 </pre>
225 <note>If you aren't using <c>userpriv</c> in your FEATURES, you
226 should not use the '-u portage' part.</note>
227 </body>
228 </section>
229 </chapter>
230
231 <chapter>
232 <title>Future Plans for Distcc and Gentoo</title>
233 <section>
234 <title>distcc-subnetscan</title>
235 <body>
236 <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>
237 <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>
238 </body>
239 </section>
240 <section>
241 <title>distcc-config</title>
242 <body>
243 <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>
244 </body>
245 </section>
246 </chapter>
247
248 </guide>

  ViewVC Help
Powered by ViewVC 1.1.20