0. Introduction
Many people have bought an amd64 box and want it help their other x86 boxes compiling their stuff...
It's easier than most people think! Some guides advice to use crossdev. But that's not neccesairy! x86_64 gcc can compile fully x86-compatible 32-bit binaries with the -m32 option. That's it. But to make this thing working with distcc in a gentoo way, check this out.

1. Get the Stuff
Of course you need distcc at all boxes and the target's(I'll call the x86 machine target in this HowTo) gcc version installed on the host(s)(I'll call the amd64 helper(s) host(s))(Note: The target's gcc version hasn't to be the default on the hosts).
Get gcc-config and target's binutils version as well.

2. Let's wrap around
Now we install the x86 wrapper script on the host.

At last, but not least, we have to create the symlinks for all compilers:
for c in {g++,gcc,c++,cpp}; do ln -s i686-pseudo-wrapper.sh ${c}; ln -s ${c} i686-pc-linux-gnu-${c}; done
(I think we can omit ln -s i686-pc-linux-gnu-gcc i686-pc-linux-gnu-gcc-<t's ver>)

Now, cd /etc/init.d and do ln -s distccd distccd-x86 or cp distccd distccd-x86 if you prefer to not edit distccd(Note: The way we edit distccd won't affect the default amd64 distccd). I use the symlink because of flexibility. If you have three distccds, e.g. distccd-x86-3.4.4, distccd-x86-4.1.1 and distccd-amd64-3.4.4, you only have to create the configs in conf.d and the symlinks.
Edit distccd (or distccd-x86 if you don't like the symlink method) and change the red stuff(or, if you did't use the symlink method, only make static changes...so don't use variables like $_a_suffix etc.):

Now, your x86 distccd is finish! start it with /etc/init.d/distccd-x86(Note: If the host's default gcc version isn't the target's one, please use /etc/conf.d,init.d/distccd-x86-<t's gcc version> so the right bin paths are extracted.)

4. Configure distcc(on the target!)
simply add host-ip:3633/3 or something similar that fits your needs to /etc/distcc/hosts(Note: You don't need to set the port if you use the default port for distccd-x86)
And of course set MAKEOPTS="-j4" or similar in your make.conf.
Now test it!

I use this method for quiet a while and I already ran emerge -uD world on a x86 successfully, so I think it works

Well, this would be more 'correct', but then I can't colorize some points. And I think it's much easier to see the points one has to change than find them oneself. Or am I missing something _________________# make config; not war
registered linux user # 265707

Last edited by all-inc. on Tue Oct 03, 2006 11:21 pm; edited 1 time in total

!!! ERROR: sys-devel/gcc-4.1.1 failed.
Call stack:
ebuild.sh, line 1546: Called dyn_compile
ebuild.sh, line 937: Called src_compile
ebuild.sh, line 1255: Called toolchain_src_compile
toolchain.eclass, line 24: Called gcc_src_compile
toolchain.eclass, line 1534: Called gcc_do_make
toolchain.eclass, line 1408: Called die

!!! emake failed with profiledbootstrap
!!! If you need support, post the topmost build error, and the call stack if relevant.

Please note that this error only appears in some applications and many others compiles well.
Ther exist any workaround?

The errors you described are very easy to explain: Never use distcc with different compiler versions!
That means, never use distcc when you compile your new gcc. the reason is, that when you compile gcc, it compiles in 2 stages:

the new gcc gets compiled with the old compiler(no prob with distcc..same versions)

the new gcc gets again compiled with the previous compiled new gcc.(The versions have changed, distcc will break! and it should ) why this? so the code for the new gcc is genereated from the new gcc sounds weird, but if you think about it, you will understand that it's better. using gcc-4 compiled from a gcc-3 would be paradox. you want to use the optimized code from gcc-4, but the gcc itself is compiled from gcc-3...would be stupid.

there are some packages known to break when using distcc...most of them have "make -j1" in the src_compile() function in their ebuild so they won't use distcc(eg openoffice)... when some packages break with distcc, this has nothing to do with this method...it's just that it won't work with distcc on different archs at all(no matter if you use a real cross compiler or this wrapper script). if you experience distcc troubles with some packages, feel free to post at bugs.gentoo.org . of course, you should mention that your distcc helper boxes are amd64 and use gcc -m32.

i hope i could help you, sebastian_________________# make config; not war
registered linux user # 265707

Last edited by all-inc. on Tue Oct 03, 2006 11:35 pm; edited 3 times in total

Hello. I'm having trouble getting the distccd init script to work, and was hoping someone could help me troubleshoot it. My host computer has both GCC 3.4.6 and 4.1.1, with 4.1.1 being the default. My target computer has GCC 3.4.6.

hi, if I start my distccd with log-level debug, I also get this warning messages! But nevertheless it works perfectly, so I think the problems you experience haven't anything to do with this messages...the start-stop-daemon invocation fails, so try to substitute --quiet by --verbose in the /etc/init.d/distccd file... hopefully this will give us some useful information. dmesg | tail -n 20 could be interesitng, too. If all this doesn't help, please try to start your distccd manually with all options the start-stop-daemon would start it:

you could also extract some debug infos from the init script by inserting the following lines just before the TMPDIR="${TMPDIR}" \ line:

Code:

echo "_PATH is ${_PATH}"
echo "DISTCCD_OPTS are ${DISTCCD_OPTS}"

and what else comes into your mind...

hope we'll find something

[EDIT] Please also add the output of your syslog that belongs to the distccd (/var/log/everything/current or /var/log/messages) or add --log-file /var/log/distccd-x86-3.4.6.log to the DISTCCD_OPTS (this option is recommend to use in the distccd manpage...see man distccd) and post its output. [/EDIT]_________________# make config; not war
registered linux user # 265707

ok, good that we found the problem hmm, your IP seems to be requested from a DHCP, right? perhaps your IP isn't always 192.168.1.99, what shows ifconfig ? Is it really your ip?_________________# make config; not war
registered linux user # 265707

Ah, that's the point where you made an error! the --listen option specifies on which ip to listen on, that means, to which ip to bind! your distccd runs on the .25 machine, right? so you have to set --listen 192.168.1.25 because you bind to this address. this option doesn't mean listen for the given ip. --allow is for this. The one you called host is the machine with distccd running, I assume ^^
Of course distccd also works without --listen, it doesn't care, if it listens on all or only the given ip. It's just a security option. If this host is, eg., connected to the internet directly and you haven't set your firewall proper, some users could access the distccd service from the internet. OK, this doesn't happen every day, but who knows... _________________# make config; not war
registered linux user # 265707

hi,
SVCNAME is provided by /sbin/runscript. (have a look at /sbin/runscript.sh)
in the lines 21 and 23 at your quotes i read:

Quote:

21 [[ ${_a_suffix} == "x86" ]] && \
23 sed -e 's:x86_64:i686:g') || \

this commands can't show "/etc/init.d/distccd-x86: line 21: : command not found" ... this doesn't make sense
please show the correct lines that cause the error messages.[/glsa]_________________# make config; not war
registered linux user # 265707

got all running,
(except distcc bugs on distcc-config --install, not creating the simlinks in /usr/lib/distcc/lib, which i did manualy)
but updating world stopped on initng-0.6.7
it uses cmake, if it may have anything to do with that, i get :

error: CPU you selected does not support x86-64 instruction set

i've tried redefining " CC=i686-pc-linux-gnu-gcc emerge initng -u "
in case it was not pasing the correct cc version. thought i understand from this distcc-x86 script that it doesnt actually needs it (or does it?).
but it didnt work anyways.

As I mentioned before, there are just some programs that stop compiling with errors, e.g. yours CPU you selected does not support x86-64 instruction set. Especially programs that act on a low level, like initng does. In that case just compile the package without distcc. if you experience such errors, please mail them at bugs.gentoo.org so they can change the ebuild to not use distccd in the future. but include some informations like the host and target machine archs and that you use this method here...
--edit-- ah, and you don't need CC=i686-pc-linux-gnu-gcc or similar --edit--

if i use the wrapper script on my target computer
so that /usr/lib/distcc/bin/gxx is mapped to /usr/lib/disticc/bin/i686-pc-linux-gnu-gxx
as the crossdev howto explains

then initng compiles with distcc

so i changed things around in the script changing

Code:

exec /usr/lib/distcc/bin/i686-pc-linux-gnu-g${0:$[-2]} "$@"

to

Code:

exec /usr/bin/distcc -m32 "$@"

and it works fine, it yields the same "CPU you selected does not support x86-64 instruction set" error if "-m32" is ommited

so i changed the line again to

Code:

exec /usr/lib/distcc/bin/x86_64-pc-linux-gnu-g${0:$[-2]} -m32 "$@"

and created the corresponding links of x86_64....-gxx to point to /usr/bin/distcc
but i'm getting problems here for some reason despite i removed localhost from /etc/distcc/hosts
it still does some compilation on localhost
so i made a symlink from x86_64--- to /usr/bin/gxx on the target
with no succes for the moment (but trying this might be a stupid idea)

anyhow, there is something going wrong somewhere

i'd love to put logs of distcc but i can't find the log anywhere
i wonder if distcc is actually using my configure options from /etc/conf.d/distcc....

Last edited by Fi on Wed Nov 15, 2006 10:21 pm; edited 1 time in total

hi,
does this problem occur if you compile without distcc? please try for every problem if it occurs without distcc...
if you use ccache and updated your gcc, then clean your ccache database!
and pleeaassee add debug information/echo'ing to your script(s)!

sorry, i've of course tried without distcc and everything works fine,
i dont use ccache

i have the log level of distcc set to critical but havnt found any log (/var/log/critical??).
about debuging messages. i'm not sure what you would need

for the moment i've finished updating my system without distcc as i had too many problems

if nobody else is having problems, it migth be my install, perhaps some conflict between crossdev which i had installed before and your scripts.
perhaps also network problems, when using distcc with my wireless network, (my amd64 box is used as master) the atheros drivers fails and i have to reinitialisze the network device, i never had this problem in any other situations !!!?!
so i switch to ieee1394 network link. but i still have problems with distcc.

i'll try to find some time to modify my scripts and retry compiling, and post more information