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

Audio Phile da_audiophile at yahoo.com
Mon Jun 27 14:50:20 MDT 2011


I think I understand your suggestion and I believe that I setup it up according to your teachings but it's not working to call the gcc inside the chroot.  

I made the one-liner you suggested in my home dir and installed it as you suggested.  Here is the script for your reference:

$ cat chroot-gcc
#!/bin/sh
exec schroot -p -- $0 "$@""

Now I installed it and setup the links you suggested:
 
$ chmod 755 chroot-gcc
# cp chroot-gcc /usr/bin/chroot-gcc
# ln -s /usr/bin/chroot-gcc /usr/bin/i686-pc-linux-gnu-gcc-4.6.0
# ln -s /usr/bin/chroot-gcc /usr/bin/i686-pc-linux-gnu-gcc
# ln -s /usr/bin/distcc /usr/lib/distcc/bin/i686-pc-linux-gnu-gcc

That's it!  The odd thing is that make CC=x command doesn't seem to call the script at all:

$ cd /dev/shm/linux-2.6.39

<<here I have the kernel source with a .config file ready to compile>>

<<As a test, prove which make is running from the native x86_64 environment>>

$ make --version
GNU Make 3.82
Built for x86_64-unknown-linux-gnu

<<As a sanity check, prove that the schroot command will indeed call the gcc within the 32-bit chroot>>

$ schroot -p -- make --version
GNU Make 3.82
Built for i686-pc-linux-gnu

<<Now, try calling your script via the CC= command.  It doesn't seem to work for me though>>

$ make --version CC=i686-pc-linux-gnu-gcc
GNU Make 3.82
Built for x86_64-unknown-linux-gnu

Did I mess up something?  Thank you kindly in advance for your time and kind advice!

--- On Sun, 6/26/11, Benjamin R. Haskell <distcc at benizi.com> wrote:

> From: Benjamin R. Haskell <distcc at benizi.com>
> Subject: Re: [distcc] compiling with distcc on x86_64 from within a 32-bit chroot?
> To: "Audio Phile" <da_audiophile at yahoo.com>
> Cc: "Martin Pool" <mbp at sourcefrog.net>, distcc at lists.samba.org
> Date: Sunday, June 26, 2011, 6:37 PM
> 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