Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 75459 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.xml
cross-compiling-distcc.xml (text/plain), 5.92 KB, created by
nm (RETIRED)
on 2005-12-24 11:23:14 UTC
(
hide
)
Description:
cross-compiling-distcc.xml
Filename:
MIME Type:
Creator:
nm (RETIRED)
Created:
2005-12-24 11:23:14 UTC
Size:
5.92 KB
patch
obsolete
><?xml version="1.0" encoding="UTF-8"?> ><!DOCTYPE guide SYSTEM "/dtd/guide.dtd"> ><!-- $Header$ --> > ><guide link="/doc/en/cross-compiling-distcc.xml"> ><title>DistCC Cross-compiling Guide</title> > ><author title="Author"> > <mail link="agaffney@gentoo.org">Andrew Gaffney</mail> ></author> ><author title="Editor"> > <mail link="jackdark@gmail.com">Joshua Saddler</mail> ></author> > ><abstract> >This guide shows you how to set up distcc for cross-compiling across different >processor architectures. ></abstract> > ><!-- The content of this document is licensed under the CC-BY-SA license --> ><!-- See http://creativecommons.org/licenses/by-sa/2.5 --> ><license/> > ><version>1.0</version> ><date>2005-12-24</date> > ><chapter> ><title>Cross-compiling with distcc</title> ><section> ><title>Introduction</title> ><body> > ><p> ><c>distcc</c> 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 ><c>distcc</c> 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 <c>distcc</c> to compile for different architectures. ></p> > ></body> ></section> ><section> ><title>Emerge the needed utilities</title> ><body> > ><p> >First, you will need to emerge <c>crossdev</c> on all the machines that will be >involved in the compiling process. <c>crossdev</c> is a tool that makes building >cross-architecture toolchains easy. It was originally written by <mail >link="kumba@gentoo.org">Joshua Kinard</mail> and was re-written from the ground >up by <mail link="vapier@gentoo.org">Mike Frysinger</mail>. Its usage is >straightforward: <c>crossdev -t sparc</c> 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 <c>crossdev --help</c>. >Obviously, you will need to emerge the proper cross-toolchain on all the helper >boxes. ></p> > ><p> >Next, you will need to emerge <c>distcc</c> 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 <uri >link="/doc/en/distcc.xml">Gentoo Distcc Documentation</uri> for more >information on setting up and using <c>distcc</c>. ></p> > ></body> ></section> ><section> ><title>Configuring distcc to cross-compile correctly</title> ><body> > ><p> >In the default distcc setup, cross-compiling will <e>not</e> work properly. The >problem is that many builds just call <c>gcc</c> instead of the full compiler >name (e.g. <c>sparc-unknown-linux-gnu-gcc</c>). 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 ><c>emerge</c>. I'll use my Sparc box as an example. Wherever you see ><c>sparc-unknown-linux-gnu</c> below, you will want to insert your own CHOST >(<c>x86_64-pc-linux-gnu</c> for an AMD64 box, for example). When you first emerge >distcc, the <path>/usr/lib/distcc/bin</path> directory looks like this: ></p> > ><pre caption="Available compilers"> >ryoko bin # <i>ls -l</i> >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> > ><p> >Here is what you want to do: ></p> > ><pre caption="Modifying distcc"> ># <i>rm c++ g++ gcc cc</i> ></pre> > ><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 <path>gcc</path>. ></p> > ><pre caption="The new gcc script"> >#!/bin/bash > >exec /usr/lib/distcc/bin/sparc-unknown-linux-gnu-gcc "$@" ></pre> > ><p> >Again, create another file and add the following to it, then save it as ><path>g++</path>. ></p> > ><pre caption="The new g++ script"> >#!/bin/bash > >exec /usr/lib/distcc/bin/sparc-unknown-linux-gnu-g++ "$@" ></pre> > ><p> >Next, we'll create the proper symlinks: ></p> > ><pre caption="Creating the symlinks"> ># <i>ln -s gcc cc</i> ># <i>ln -s g++ c++</i> ># <i>chmod a+x gcc g++</i> ></pre> > ><p> >When you're done, <path>/usr/lib/distcc/bin</path> will look like this: ></p> > ><pre caption="A proper set of compilers"> >ryoko bin # <i>ls -l</i> >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> > ><p> >Congratulations; you now have a (hopefully) working cross-distcc setup. ></p> > ></body> ></section> ><section> ><title>How this works</title> ><body> > ><p> >When <c>distcc</c> is called, it checks to see what it was called as. It does >this by examining <c>argv[0]</c>. 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 ><c>gcc</c>, it will look for <c>gcc</c>, which is likely to be the native >compiler on the helper box, if it is not the same architecture as the box >running <c>emerge</c>. When the <e>full</e> name of the compiler is sent (e.g. ><c>sparc-unknown-linux-gn-gcc</c>), there is no confusion. ></p> > ></body> ></section> ></chapter> ></guide>
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