24. 08. 08

speeding up the build on the c3

it finally worked out really well and i managed to overcome all the gcc problems i previously had by following this guide: Click.
In fact i did not change my chost on this system, after endless problems i did a reinstall with the right chost, but gcc, glibc and binutils where broken anyways…
after some hours (you really should prepare yourself for endless compiling) the compilers did work.
so i could focus on the main task, setting up mythtv.

Well, as i already experienced while dealing with the gcc stuff, compiling takes ages on this little bird.
That’s why i thought about using the other machines at home as compiler nodes.

In other words:How to do distributed computing and cross compiling on Gentoo using icecream and crossdev

I am using Icecream (sys-devel/icecream) and crossdev (sys-devel/crossdev)
The decision for icecream was easy, it supports its own “scheduler” which distributes the compile jobs to the machine which is capable of compiling the required arch and has the least cpu load.
so if you plan on distributing compile jobs across several hosts with different arches, and if you know that your nodes won’t be online all the time, use icecream.
if you plan on using machines which will be on all the time and you don’t care about the load, you should use distcc.

In my opinion icecream is more simple and “plug and play”.
You could just setup icecream on any host, start it, it will broadcast for the scheduler on your net, announce its compiling capabilities and start receiving jobs.
simple as that.

ok, prerequisites:
Some Machines running Linux
Network Connection between every Machine that participates.
Working Compilers on the participating Machines 😀

On Gentoo this is really easy:
just type:emerge -av sys-devel/icecream sys-devel/crossdev

after that you should modify /etc/conf.d/icecream
Modify the Number of Jobs this particular Machine can take (similar to make.conf’s -jN Option)
Select wether this machine should run the scheduler which distributes the jobs. (the scheduler should run on a fast machine since it will be preferred when distributing jobs)
Enter the Adress of the Scheduler just in case the broadcasting fails.

add the following line to /etc/make.conf to tell portage to use icecream:
PREROOTPATH=/usr/lib/icecc/bin

start icecream (/etc/init.d/icecream start)

do not worry if you can not see much progress in the logs (/var/log/iceccd and icecc_scheduler)
this is because of the verbosity level of icecream, the default is very quiet.
i recommend switching to -vvv (in /etc/conf.d(icecream) for the first few jobs to observe wether it works to your likes.

if the machines on your net are not using the same arch and/or chost you should now setup crossdev.
do this by simply invoking this command on every host that should do cross compiling:crossdev -s4 --target #-s4 = stage 4

this will now build all the requiered compilers and stuff to $PORTDIR_OVERLAY
so if you did not specify this in your make.conf you should do this before invoking crossdev:
/etc/make.conf:
PORTDIR_OVERLAY=/usr/local/portage

on your target machine (in my case this is the epia c3 frontend) you should now follow these steps:
(for this example i will use an i586 target since this is what my c3 needs)
cd /usr/lib/icecc/bin
#wrapper to let icecream know which arch you want to compile
echo "\#\!/bin/bash" > i586-pc-linux-gnu-wrapper
echo 'exec /usr/lib/icecc/bin/i586-pc-linux-gnu-g${0:$[-2]} "$@"' >> i586-pc-linux-gnu-wrapper
chmod +x i586-pc-linux-gnu-wrapper
#link to the wrapper script
for file in cc gcc c++ g++; do
rm $file
ln -s i586-pc-linux-gnu-wrapper $file
done