NSLU2-Linux
view · edit · print · history

GentooSlug.HowToGentooSlugDistccCrossCompile History

Hide minor edits - Show changes to markup

May 07, 2007, at 11:56 PM by jaguarondi -- Added a command to monitor network status
Added line 72:
  • You can also check if things are working with "netstat -n 1 | grep ip.of.client.machine"
May 07, 2007, at 11:32 PM by jaguarondi -- typo in the path of distcc
Changed line 68 from:
# export PATH=/usr/lib/disctcc/bin:$PATH
to:
# export PATH=/usr/lib/distcc/bin:$PATH
November 05, 2006, at 02:17 PM by Benjamin Wiedmann --
Changed lines 24-26 from:

# gcc-config -l to get a list of available compilers

 [1] armeb-softfloat-linux-uclibc-3.4.6 *
 [5] x86_64-pc-linux-gnu-3.4.6 *
to:

To get a list of available compilers do:

# gcc-config -l

...
[1] armeb-softfloat-linux-uclibc-3.4.6
...
[5] x86_64-pc-linux-gnu-3.4.6
...
Changed lines 36-37 from:

And then stepping back to utilizing crossdev (see above).

to:

And then continue with the steps noted above.

November 05, 2006, at 02:13 PM by Benjamin Wiedmann --
Added lines 22-32:
This didn't work for me. I first had to switch both compiler profiles to slug compatible versions by doing:

# gcc-config -l to get a list of available compilers

 [1] armeb-softfloat-linux-uclibc-3.4.6 *
 [5] x86_64-pc-linux-gnu-3.4.6 *
followed by:

# gcc-config armeb-softfloat-linux-uclibc-3.4.6 # gcc-config x86_64-pc-linux-gnu-3.4.6

And then stepping back to utilizing crossdev (see above).

October 28, 2006, at 03:02 PM by bernied -- changed distcc to distccd in line beginning with rc-update
Changed line 11 from:
  • # rc-update add distcc default
to:
  • # rc-update add distccd default
July 09, 2006, at 09:26 AM by Kevin Harris -- Better wiki formatting, adding a link to a distcc fixup script, since I can\'t upload.
Changed lines 37-40 from:
Here's a script that will correct it for you: Attach:fixup_distcc.sh Δ
to:
Here's a script that will correct it for you: DistccCrossCompileFixupScript
Changed lines 43-49 from:
#include <stdio.h>
int main(int argc, const char** argv)
{
printf("Hello, World\n");
return 0;
}
to:
#include <stdio.h>
int main(int argc, const char** argv)
{
  printf("Hello, World\n");
  return 0;
}
July 09, 2006, at 09:03 AM by Kevin Harris --
Changed lines 43-50 from:
#include <stdio.h> int main(int argc, const char** argv) { printf("Hello, World\n"); return 0; }
to:
#include <stdio.h>
int main(int argc, const char** argv)
{
printf("Hello, World\n");
return 0;
}
July 09, 2006, at 08:41 AM by Kevin Harris -- Adding content for distcc installation and configuration
Changed lines 5-9 from:

I'm in the think-tank for now (I've seen it done seperately, so it's just a matter of doing it the gentoo way)

Setup the host (gentoo desktop)

...

to:

Setup a distcc host (gentoo desktop)

  • install distcc
# emerge distcc
  • Edit the /etc/conf.d/distccd to specify allowed hosts
  • Start distcc and set it to run every time you boot up
    • # /etc/init.d/distccd start
    • # rc-update add distcc default
  • Install crossdev
# emerge crossdev
  • Install your cross compiler
The below text assumes that your slug's gentoo installation is big-endian with uclibc. You should use the same value you used for your CHOST in /etc/make.conf (on your slug).
# crossdev armeb-softfloat-linux-uclibc
Note: If the currently unmasked compiler is a different version than the one used on your slug, you will need to specify the gcc version you will be using on your slug.
Example:
# crossdev --gcc 3.4.6 armeb-softfloat-linux-uclibc
This won't always result in the exact gcc version, but it should be a binary-compatible version.
Changed lines 23-24 from:

...

to:
  • Install distcc
# emerge distcc
  • Tell portage to use distcc by adding "distcc" to your FEATURES list in /etc/make.conf
  • Increase the number of files compiled at the same time by adding a -jN flag to your MAKEOPTS in /etc/make.conf
I find that -j2 works pretty good. Any more than that and a non-fattened slug will start swapping.
  • Specify the machines to remotely run distcc
# distcc-config --set-hosts "<machine1>/count1 <machine2>/count2"
Replace <machineN> with the name (if it can be resolved) of a distcc host.
The /countN is optional, and can be used to limit the number of concurrent builds on a distcc host.
Example:
# distcc-config --set-hosts "192.168.0.3/2"
Note that localhost is NOT in the list. It will fall back to the local host if the remote one is down, but every other compilation should be done on a remote machine to ease the burden on the poor slug.
  • Modify the /usr/lib/distcc/bin directory so the proper compiler will be invoked on the remote distcc hosts.
Here's a script that will correct it for you: Attach:fixup_distcc.sh Δ
Changed lines 42-44 from:

...
helloworld

to:
  • On your slug, create the normal hello world program. That would be something like this:
#include <stdio.h> int main(int argc, const char** argv) { printf("Hello, World\n"); return 0; }
  • Add the distcc directory to your path (portage builds will do this automatically if distcc is in the FEATURES)
# export PATH=/usr/lib/disctcc/bin:$PATH
  • Compile your hello world program with lots of distcc verbosity
# DISTCC_VERBOSE=1 gcc -c hello.c -o hello.o
  • Look for a line that says something like this: "compile hello.c on 192.168.0.3/2 completed ok"
  • Link your object file into an executable and run it
# gcc hello.o -o hello
# ./hello
Note that distcc will run the preprocessor and linker on the slug so it will not build remotely if your compilation line does linking as well.
  • Repeat the above test with g++ (just to be safe).
February 03, 2006, at 08:50 PM by Stein --
Changed line 21 from:
to:
February 03, 2006, at 08:48 PM by Stein --
Changed line 21 from:
to:
February 03, 2006, at 08:42 PM by Stein --
Added line 21:
February 03, 2006, at 12:51 PM by Stein --
Changed lines 2-3 from:

I'll try to figure out a easy and seamless way of using "emerge" command at the slug to automaticly start cross-compile on gentoo desktop. Therby greatly reducing compile time on the slug.

to:

HowTo use a "distcc-farm" to crosscompile for the slug.

I'll try to figure out a easy and seamless way of using "emerge" command at the slug to automaticly start cross-compile on gentoo desktop. Therby greatly reducing compile time on the slug.

February 03, 2006, at 12:48 PM by Stein --
Changed lines 2-3 from:

I'll try to figure out a easy and seamless way of using "emerge" command at the slug to automaticly start cross-compile on gentoo desktop. Therby greatly reducing compile time on the slug.

to:

I'll try to figure out a easy and seamless way of using "emerge" command at the slug to automaticly start cross-compile on gentoo desktop. Therby greatly reducing compile time on the slug.

Added lines 6-15:

Setup the host (gentoo desktop)

...

Setup the slug

...

Check that it works

...
helloworld

February 03, 2006, at 12:43 PM by Stein --
Changed lines 2-3 from:

I'll try to figure out a easy, seamless way of using "emerge" command at the slug to seamless start cross-compile on gentoo desktop. Therby greatly reducing compile time for the slug.

to:

I'll try to figure out a easy and seamless way of using "emerge" command at the slug to automaticly start cross-compile on gentoo desktop. Therby greatly reducing compile time on the slug.

February 03, 2006, at 12:41 PM by Stein --
Added lines 1-9:

Stein: I'll try to figure out a easy, seamless way of using "emerge" command at the slug to seamless start cross-compile on gentoo desktop. Therby greatly reducing compile time for the slug.

I'm in the think-tank for now (I've seen it done seperately, so it's just a matter of doing it the gentoo way)

Refs:
http://distcc.samba.org/man/distcc_1.html
http://www.gentoo.org/doc/en/distcc.xml
http://dev.gentoo.org/~vapier/CROSS-COMPILE-HOWTO\\

view · edit · print · history · Last edited by jaguarondi.
Based on work by jaguarondi, Benjamin Wiedmann, bernied, Kevin Harris, and Stein.
Originally by Stein.
Page last modified on May 07, 2007, at 11:56 PM