Distcc/Cross-Compiling/fr

Ce guide vous explique comment configurer distcc pour la compilation croisée à travers différentes architectures de processeur.

Introduction
est un outil qui vous permet de partager les tâches de compilation d'un logiciel sur plusieurs ordinateurs en réseau. Tant que les ordinateurs en réseau utilisent tous la même chaîne d'outils compilée pour la même architecture, aucune configuration spéciale de  n'est requise. Mais que faire pour compiler pour différentes architectures en utilisant des ordinateurs différents ? Ce guide va vous montre comment configurer  pour compiler pour différentes architectures.

Installer les utilitaires nécessaires
Tout d'abord, vous devez installer  sur toutes les machines qui seront impliquées dans le processus de compilation. est un outil qui permet une compilation facile de la chaîne des outils de compilation croisée. Il a été écrit à l'origine par Joshua Kinard et a été réécrit totalement par Mike Frysinger. Son utilisation est assez directe :  compile une chaîne d'outils complète en ciblant l'architecture Sparc. Ceci inclut binutils, gcc, glibc, et linux-headers. Si vous avez besoin de plus d'aide, essayez d'exécuter. Évidemment, vous devrez installer la chaîne des outils de compilation croisée sur tous les ordinateurs participants.

Next, you will need to emerge  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 Gentoo Distcc Documentation for more information on setting up and using.

Arch-specific notes
If you are cross-compiling between different subarchitectures for Intel x86 (e.g. i586 and i686), you must still build a full cross-toolchain for the desired CHOST, or else the compilation will fail. This is because i586 and i686 are actually different CHOSTs, despite the fact that they are both considered "x86." Please keep this in mind when you build your cross-toolchains. For example, if the target box is i586, this means that you must build i586 cross-toolchains on your i686 helper boxes.

Configuring distcc to cross-compile correctly
In the default distcc setup, cross-compiling will not work properly. The problem is that many builds just call  instead of the full compiler name (e.g.   ). When this compile gets distributed to a distcc helper box, the native compiler gets called instead of your shiny new cross-compiler.

Fortunately, there is a workaround for this little problem. All it takes is a wrapper script and a few symlinks on the box that will be running. I'll use my Sparc box as an example. Wherever you see  below, you will want to insert your own CHOST (   for an AMD64 box, for example). When you first emerge distcc, the directory looks like this:

Here is what you want to do:

Next, we'll create the new script on this box. Fire up your favorite editor and create a file with the following text in it, then save it as. Remember to change the CHOST (in this case,  ) to the actual CHOST of the box that will be running the emerge.

The new wrapper script

Next, we'll make the script executable and create the proper symlinks:

When you're done, will look like this:

Congratulations; you now have a (hopefully) working cross-distcc setup.

How this works
When  is called, it checks to see what it was called as (e.g.  ,   , etc.) 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 , it will look for   , which is likely to be the native compiler on the helper box, if it is not the same architecture as the box running. When the full name of the compiler is sent (e.g.  ), there is no confusion.

Acknowledgements
We would like to thank the following authors and editors for their contributions to this guide:


 * Andrew Gaffney
 * Joshua Saddler