Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 75464 Details for
Bug 116575
new doc: DistCC Cross-compiling Guide
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
cross-compiling-distcc.html
cross-compiling-distcc.html (text/plain), 12.94 KB, created by
nm (RETIRED)
on 2005-12-24 12:01:37 UTC
(
hide
)
Description:
cross-compiling-distcc.html
Filename:
MIME Type:
Creator:
nm (RETIRED)
Created:
2005-12-24 12:01:37 UTC
Size:
12.94 KB
patch
obsolete
><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> ><html> ><head> ><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> ><link title="new" rel="stylesheet" href="css/main.css" type="text/css"> ><link REL="shortcut icon" HREF="favicon.ico" TYPE="image/x-icon"> ><title>Gentoo Linux > Documentation >-- > DistCC Cross-compiling Guide</title> ></head> ><body style="margin-left:0px;margin-top:0px;" bgcolor="#ffffff"><table width="100%" border="0" cellspacing="0" cellpadding="0"> ><tr><td valign="top" height="125" bgcolor="#45347b"><table cellspacing="0" cellpadding="0" border="0" width="193"> ><tr><td class="logobg" valign="top" align="center" height="88"><a href="/"><img border="0" src="images/gtop-s.jpg" alt="Gentoo Logo"></a></td></tr> ><tr><td class="logobg" valign="top" align="center" height="36"><a href="/"><img border="0" src="images/gbot-s.gif" alt="Gentoo Logo Side"></a></td></tr> ></table></td></tr> ><tr><td valign="top" align="right" colspan="1" bgcolor="#ffffff"><table border="0" cellspacing="0" cellpadding="0" width="100%"><tr> ><td width="99%" class="content" valign="top" align="left"> ><br><p class="dochead">DistCC Cross-compiling Guide</p> ><form name="contents" action="http://www.gentoo.org"> ><b>Contents</b>: > <select name="url" size="1" OnChange="location.href=form.url.options[form.url.selectedIndex].value" style="font-family:Arial,Helvetica, sans-serif; font-size:10"><option value="#doc_chap1">1. Cross-compiling with distcc</option></select> ></form> ><p class="chaphead"><span class="chapnum"><a name="doc_chap1">1. </a></span>Cross-compiling with distcc</p> ><p class="secthead"><a name="doc_chap1_sect1">Introduction </a></p> > ><p> ><span class="code">distcc</span> is a tool that lets you share the burden of software compiling >across several networked computers. As long as the networked boxes are all using >the same toolchain built for the same processor architecture, no special ><span class="code">distcc</span> setup is required. But what do you do if you need to compile for a >different architecture using differing computers? This guide will show you how >to configure <span class="code">distcc</span> to compile for different architectures. ></p> > ><p class="secthead"><a name="doc_chap1_sect2">Emerge the needed utilities </a></p> > ><p> >First, you will need to emerge <span class="code">crossdev</span> on all the machines that will be >involved in the compiling process. <span class="code">crossdev</span> is a tool that makes building >cross-architecture toolchains easy. It was originally written by <a href="mailto:kumba@gentoo.org">Joshua Kinard</a> and was re-written from the ground >up by <a href="mailto:vapier@gentoo.org">Mike Frysinger</a>. Its usage is >straightforward: <span class="code">crossdev -t sparc</span> will build a full cross-toolchain >targetting the Sparc architecture. This includes binutils, gcc, glibc, and >linux-headers. If you need more help, try running <span class="code">crossdev --help</span>. >Obviously, you will need to emerge the proper cross-toolchain on all the helper >boxes. ></p> > ><p> >Next, you will need to emerge <span class="code">distcc</span> on all the machines that will be >involved in the process. This includes the box that will run emerge and the >boxes with the cross-compilers. Please see the <a href="http://www.gentoo.org/doc/en/distcc.xml">Gentoo Distcc Documentation</a> for more >information on setting up and using <span class="code">distcc</span>. ></p> > ><p class="secthead"><a name="doc_chap1_sect3">Configuring distcc to cross-compile correctly </a></p> > ><p> >In the default distcc setup, cross-compiling will <span class="emphasis">not</span> work properly. The >problem is that many builds just call <span class="code">gcc</span> instead of the full compiler >name (e.g. <span class="code">sparc-unknown-linux-gnu-gcc</span>). When this compile gets >distributed to a distcc helper box, the native compiler gets called instead of >your shiny new cross-compiler. ></p> > ><p> >Fortunately, there is a workaround for this little problem. All it takes is a >couple of wrapper scripts and a few symlinks on the box that will be running ><span class="code">emerge</span>. I'll use my Sparc box as an example. Wherever you see ><span class="code">sparc-unknown-linux-gnu</span> below, you will want to insert your own CHOST >(<span class="code">x86_64-pc-linux-gnu</span> for an AMD64 box, for example). When you first emerge >distcc, the <span class="path">/usr/lib/distcc/bin</span> directory looks like this: ></p> > ><a name="doc_chap1_pre1"></a><table class="ntable" width="100%" cellspacing="0" cellpadding="0" border="0"> ><tr><td class="infohead" bgcolor="#7a5ada"><p class="caption"> > Code listing 1.1: Available compilers</p></td></tr> ><tr><td bgcolor="#ddddff"><pre> >ryoko bin # <span class="input">ls -l</span> >total 0 >lrwxrwxrwx 1 root root 15 Dec 23 20:13 c++ -> /usr/bin/distcc >lrwxrwxrwx 1 root root 15 Dec 23 20:13 cc -> /usr/bin/distcc >lrwxrwxrwx 1 root root 15 Dec 23 20:13 g++ -> /usr/bin/distcc >lrwxrwxrwx 1 root root 15 Dec 23 20:13 gcc -> /usr/bin/distcc >lrwxrwxrwx 1 root root 15 Dec 23 20:13 sparc-unknown-linux-gnu-c++ -> /usr/bin/distcc >lrwxrwxrwx 1 root root 15 Dec 23 20:13 sparc-unknown-linux-gnu-g++ -> /usr/bin/distcc >lrwxrwxrwx 1 root root 15 Dec 23 20:13 sparc-unknown-linux-gnu-gcc -> /usr/bin/distcc ></pre></td></tr> ></table> > ><p> >Here is what you want to do: ></p> > ><a name="doc_chap1_pre2"></a><table class="ntable" width="100%" cellspacing="0" cellpadding="0" border="0"> ><tr><td class="infohead" bgcolor="#7a5ada"><p class="caption"> > Code listing 1.2: Modifying distcc</p></td></tr> ><tr><td bgcolor="#ddddff"><pre> ># <span class="input">rm c++ g++ gcc cc</span> ></pre></td></tr> ></table> > ><p> >Next, we'll create the new scripts. Fire up your favorite editor and create a >file with the following text in it, then save it as <span class="path">gcc</span>. ></p> > ><a name="doc_chap1_pre3"></a><table class="ntable" width="100%" cellspacing="0" cellpadding="0" border="0"> ><tr><td class="infohead" bgcolor="#7a5ada"><p class="caption"> > Code listing 1.3: The new gcc script</p></td></tr> ><tr><td bgcolor="#ddddff"><pre> >#!/bin/bash > >exec /usr/lib/distcc/bin/sparc-unknown-linux-gnu-gcc "$@" ></pre></td></tr> ></table> > ><p> >Again, create another file and add the following to it, then save it as ><span class="path">g++</span>. ></p> > ><a name="doc_chap1_pre4"></a><table class="ntable" width="100%" cellspacing="0" cellpadding="0" border="0"> ><tr><td class="infohead" bgcolor="#7a5ada"><p class="caption"> > Code listing 1.4: The new g++ script</p></td></tr> ><tr><td bgcolor="#ddddff"><pre> >#!/bin/bash > >exec /usr/lib/distcc/bin/sparc-unknown-linux-gnu-g++ "$@" ></pre></td></tr> ></table> > ><p> >Next, we'll create the proper symlinks: ></p> > ><a name="doc_chap1_pre5"></a><table class="ntable" width="100%" cellspacing="0" cellpadding="0" border="0"> ><tr><td class="infohead" bgcolor="#7a5ada"><p class="caption"> > Code listing 1.5: Creating the symlinks</p></td></tr> ><tr><td bgcolor="#ddddff"><pre> ># <span class="input">ln -s gcc cc</span> ># <span class="input">ln -s g++ c++</span> ># <span class="input">chmod a+x gcc g++</span> ></pre></td></tr> ></table> > ><p> >When you're done, <span class="path">/usr/lib/distcc/bin</span> will look like this: ></p> > ><a name="doc_chap1_pre6"></a><table class="ntable" width="100%" cellspacing="0" cellpadding="0" border="0"> ><tr><td class="infohead" bgcolor="#7a5ada"><p class="caption"> > Code listing 1.6: A proper set of compilers</p></td></tr> ><tr><td bgcolor="#ddddff"><pre> >ryoko bin # <span class="input">ls -l</span> >total 8 >lrwxrwxrwx 1 root root 3 Dec 23 20:16 c++ -> g++ >lrwxrwxrwx 1 root root 3 Dec 23 20:16 cc -> gcc >-rwxr-xr-x 1 root root 71 Dec 23 20:16 g++ >-rwxr-xr-x 1 root root 71 Dec 23 20:16 gcc >lrwxrwxrwx 1 root root 15 Dec 23 20:13 sparc-unknown-linux-gnu-c++ -> /usr/bin/distcc >lrwxrwxrwx 1 root root 15 Dec 23 20:13 sparc-unknown-linux-gnu-g++ -> /usr/bin/distcc >lrwxrwxrwx 1 root root 15 Dec 23 20:13 sparc-unknown-linux-gnu-gcc -> /usr/bin/distcc ></pre></td></tr> ></table> > ><p> >Congratulations; you now have a (hopefully) working cross-distcc setup. ></p> > ><p class="secthead"><a name="doc_chap1_sect4">How this works </a></p> > ><p> >When <span class="code">distcc</span> is called, it checks to see what it was called as. It does >this by examining <span class="code">argv[0]</span>. When distcc then distributes the compile to a >helper box, it passes along the name it was called as. The distcc daemon on the >other helper box then looks for a binary with that same name. If it sees just ><span class="code">gcc</span>, it will look for <span class="code">gcc</span>, which is likely to be the native >compiler on the helper box, if it is not the same architecture as the box >running <span class="code">emerge</span>. When the <span class="emphasis">full</span> name of the compiler is sent (e.g. ><span class="code">sparc-unknown-linux-gn-gcc</span>), there is no confusion. ></p> > ><br><tt> > The contents of this document are licensed under the <a href="http://creativecommons.org/licenses/by-sa/1.0">Creative Commons - Attribution / Share Alike</a> license. ></tt><br> ></td> ><td width="1%" bgcolor="#dddaec" valign="top"><table border="0" cellspacing="5" cellpadding="0"> ><tr><td><img src="images/line.gif" alt="line"></td></tr> ><tr><td align="center" class="alttext"> > Updated 2005-12-24</td></tr> ><tr><td><img src="images/line.gif" alt="line"></td></tr> ><tr><td class="alttext"> > <b><a class="altlink" href="mailto:agaffney@gentoo.org">Andrew Gaffney</a></b> ><br><i>Author</i><br><br> > <b><a class="altlink" href="mailto:jackdark@gmail.com">Joshua Saddler</a></b> ><br><i>Editor</i><br><br> ></td></tr> ><tr><td><img src="images/line.gif" alt="line"></td></tr> ><tr><td class="alttext"> ><b>Summary:</b> >This guide shows you how to set up distcc for cross-compiling across different >processor architectures. ></td></tr> ><tr><td><img src="images/line.gif" alt="line"></td></tr> ><tr><td align="center"> ><p class="alttext"><b>Donate</b> to support our development efforts. > </p> ><form action="https://www.paypal.com/cgi-bin/webscr" method="post"> ><input type="hidden" name="cmd" value="_xclick"><input type="hidden" name="business" value="drobbins@gentoo.org"><input type="hidden" name="item_name" value="Gentoo Linux Support"><input type="hidden" name="item_number" value="1000"><input type="hidden" name="image_url" value="images/paypal.png"><input type="hidden" name="no_shipping" value="1"><input type="hidden" name="return" value="http://www.gentoo.org"><input type="hidden" name="cancel_return" value="http://www.gentoo.org"><input type="image" src="" name="submit" alt="Make payments with PayPal - it's fast, free and secure!"> ></form> ></td></tr> ><tr><td><img src="images/line.gif" alt="line"></td></tr> ><tr><td align="center"><a href="http://store.gentoo.org"><img src="images/store.png" alt="The Gentoo Linux Store" border="0"></a></td></tr> ><tr><td><img src="images/line.gif" alt="line"></td></tr> ><tr><td align="center"> ><a href="http://www.phparch.com/bannerclick.php?AID=68&BID=1&BT=127929" target="_top"><img src="images/phpa-gentoo.gif" width="125" height="144" alt="php|architect" border="0"></a><p class="alttext"> > php|architect is the monthly magazine for PHP professionals, available > worldwide in print and electronic format. A percentage of all the sales > will be donated back into the Gentoo project. > </p> ></td></tr> ><tr><td><img src="images/line.gif" alt="line"></td></tr> ><tr><td align="center"> ><a href="http://www.tek.net" target="_top"><img src="images/tek-gentoo.gif" width="125" height="125" alt="Tek Alchemy" border="0"></a><p class="alttext"> > Tek Alchemy offers dedicated servers and other hosting solutions running Gentoo Linux. > </p> ></td></tr> ><tr><td><img src="images/line.gif" alt="line"></td></tr> ><tr><td align="center"> ><a href="http://www.qksrv.net/click-477620-5032687" target="_top"><img src="http://www.qksrv.net/image-477620-5032687" width="125" height="125" alt="DDR Memory at Crucial.com" border="0"></a><p class="alttext"> > Purchase RAM from <b>Crucial.com</b> and a percentage of your sale will go towards further Gentoo Linux development. > </p> ></td></tr> ><tr><td><img src="images/line.gif" alt="line"></td></tr> ><tr><td align="center"> ><a href="http://www.netraverse.com/gentoo.htm" target="_top"><img src="images/netraverse-gentoo.gif" width="125" height="102" alt="Win4Lin at NeTraverse" border="0"></a><p class="alttext"> > Win4Lin from <b>NeTraverse</b> lets you run Windows applications under Gentoo Linux at native speeds. > </p> ></td></tr> ><tr><td><img src="images/line.gif" alt="line"></td></tr> ></table></td> ></tr></table></td></tr> ><tr><td colspan="2" align="right" class="infohead" width="100%" bgcolor="#7a5ada"> > Copyright 2001-2003 Gentoo Technologies, Inc. Questions, Comments, Corrections? Email <a class="highlight" href="mailto:www@gentoo.org">www@gentoo.org</a>. > </td></tr> ></table></body> ></html>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 116575
:
75458
|
75459
|
75463
|
75464
|
75510
|
75577
|
76167
|
77445
|
77858
|
77859
|
77871
|
78032