Here is an example, to allow distributing tasks from a 64-bit system (x86_64) to 32-bit systems (i686):
First of all, both the client and servers should have distcc installed, of course. Then run the distcc daemon at the servers. Be careful so that they are not refusing connections from the client.
The distcc servers should also have the corresponding cross toolchains installed.
In Gentoo, this is simple. Emerge
crossdev
and run crossdev --target x86_64-pc-linux-gnu
. (Experience tells us it is better to stip -march=...
from CFLAGS
when building the cross toolchain, otherwise we may (or may not) encounter strange errors, though some options like -march=nocona
are valid on both i686 and x86_64. The reason is beyond me...)Then commands
x86_64-pc-linux-gnu-{gcc,g++}
should be available.Most source packages are created with autotools, so they honor the environment variables
CC
and CXX
. At the client end, export CC='distcc x86_64-pc-linux-gnu-gcc'
and CXX='distcc x86_64-pc-linux-gnu-g++'
before compiling.It is important to use the full compiler name including the host architecutre (
x86_64-pc-linux-gnu
in this example). Otherwise the distcc servers call the native compilers, resulting in incompatible object files.Alternatively you may want to use the “transparent” method of calling distcc:
PATH="/usr/lib/distcc/bin:$PATH" make
. This does not work automatically. Instead, it is necessary to use a wrapper script to make sure the architecture is explicitly specified:# cd /usr/lib/distcc/bin # rm cc c++ gcc g++ # echo '#!/bin/bash' > distcc-wrapper # echo 'exec /usr/lib/distcc/bin/x86_64-pc-linux-gnu-g${0:$[-2]} "$@"' >> distcc-wrapper # chmod +x distcc-wrapper # ln -s distcc-wrapper cc # ln -s distcc-wrapper c++ # ln -s distcc-wrapper gcc # ln -s distcc-wrapper g++
Reference
[1] DistCC Cross-compiling Guide - Gentoo Documentation
No comments:
Post a Comment