[distcc] compiling with distcc on x86_64 from within a 32-bit chroot?

Benjamin R. Haskell distcc at benizi.com
Sun Jun 26 16:37:18 MDT 2011


On Sun, 26 Jun 2011, Audio Phile wrote:

> $ ls /usr/bin | grep gcc
> gcc
> winegcc
> x86_64-unknown-linux-gnu-gcc
> x86_64-unknown-linux-gnu-gcc-4.6.0
>
> And in the chroot:
>
> $ ls /usr/bin | grep gcc
> gcc
> i686-pc-linux-gnu-gcc
> i686-pc-linux-gnu-gcc-4.6.0
>
> How would you suggest I proceed with the goal of keep just one distcc 
> server for both the native x86_64 environment and also for the 32-bit 
> chroot?

Create a script outside of the chroot with the name 
i686-pc-linux-gnu-gcc-4.6.0 (along with a versionless symlink).  The 
script should enter the chroot and pass all of its arguments to the 
corresponding gcc inside the chroot.  Then, when compiling, specify the 
fully-qualified `gcc`.  E.g.

To compile for x86_64:
make CC=x86_64-unknown-linux-gnu-gcc

To compile for i686 in the chroot:
make CC=i686-pc-linux-gnu-gcc

I'm unfamiliar with the schroot and makepkg commands, but after a quick 
glance at your ArchWiki entry, maybe this would serve as the script:

==> /usr/bin/chroot-gcc <==
#!/bin/sh
exec linux32 chroot /opt/arch32 $0 "$@"
# maybe: (not knowing anything about schroot...)
# exec schroot -p -- $0 "$@"
============================================

By using $0 there, you can then symlink it to whatever executables that 
you'd like to chroot, e.g.:

ln -s chroot-gcc /usr/bin/i686-pc-linux-gnu-gcc-4.6.0
ln -s chroot-gcc /usr/bin/i686-pc-linux-gnu-gcc

Depending on how you (or Arch) set up distcc, you might have to make a 
second set of symlinks in some directory akin to:

/usr/lib/distcc/bin/

(See the 'INSTALLING DISTCC' and 'MASQUERADING' sections of 
http://distcc.googlecode.com/svn/trunk/doc/web/man/distcc_1.html#TOC_10 
)

e.g.

ln -s ../../../bin/distcc /usr/lib/distcc/i686-pc-linux-gnu-gcc

-- 
Best,
Ben


More information about the distcc mailing list