Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
HOWTO: Get x86_64 boxes to run IA32 compiles via distcc
View unanswered posts
View posts from last 24 hours

Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
Steven Robertson
Tux's lil' helper
Tux's lil' helper

Joined: 26 Mar 2003
Posts: 140
Location: Tampa, FL

PostPosted: Mon May 02, 2005 7:38 pm    Post subject: HOWTO: Get x86_64 boxes to run IA32 compiles via distcc Reply with quote

Hey, all. This howto is copied pretty much wholesale from my post in this thread. If things don't make sense, let me know and I'll fix it. I'll edit this some day. Note that this trick will only work for x86 clients sending jobs to x86_64 multilib servers. Your best bet is to go with a 2005.0 or newer profile, especially on the server side. What follows is the copied material. Enjoy!

As long as your systems are running the same version of gcc, you can simply force distcc to add an -m32 flag to every compile to generate machine code that is for all practical purposes identical to a native 32bit compiler. It involves three files, plus some symlinks. Basically, I changed the official distccd init.d script to have a new path, which points to a directory of symlinks, each pointing to a bash script which calls the real gcc with the -m32 arg added. This is unfortunately necessary because any ebuild which calls strip_flags will fail to compile if you simply add an -m32 on the client end. Descriptions of what I did follow; at the end of this howto are examples of files that work.

The first file, /etc/init.d/distccd32, is a copy of /etc/init.d/distccd (the official version). However, one line has been changed; in the start-stop-daemon multi-line entry to start distccd, look for the line
PATH="$(gcc-config --get-bin-path):${PATH}" \

and change it to

(note that I used the default path of crossdev; this is not necessary, I did it so that if I ever decided to use crossdev, I could without changing anything. I do not use crossdev at all.).

The second file, /etc/conf.d/distccd32, is a copy of (you guessed it) /etc/conf.d/distccd; this time with the port specified in DISTCCD_OPTS changed to something other than the regular /etc/conf.d/distccd (default 3632). (I actually left it at 3632, and changed the real distccd to run at 3664, because that makes sense to me.) Also, be sure and change the location of the pid file if you plan on running both a 32 and a 64 bit version.

The third file, /home/crossdev/amd64/bin/crosscall, is a one-line bash script that calls the real version of gcc with the -m32 flag added. A copy of my version is at the end of this post. REMEMBER to chmod 755 the file!

The symlinks link gcc, g++, etc, to crosscall. Creating them is as simple as running:
# cd /home/crossdev/amd64/bin
# for BINARY in c++ cc cpp g++ g77 gcc i686-pc-linux-gnu-c++ i686-pc-linux-gnu-cpp i686-pc-linux-gnu-g++ i686-pc-linux-gnu-g77 i686-pc-linux-gnu-gcc; do ln -s crosscall $BINARY; done

That should do it! Works fine for all my systems, including a 133mhz Pentium MMX (my router/server). And here are the promised examples:

# $Header: /var/cvsroot/gentoo-x86/sys-devel/distcc/files/2.17/init,v 1.1 2004/08/22 19:14:10 lisa Exp $

depend() {
        need net
        use ypbind

start() {
        [ -e "${DISTCCD_PIDFILE}" ] && rm -f ${DISTCCD_PIDFILE} &>/dev/null

        ebegin "Starting distccd (32-bit toolchain)"
        chown distcc `dirname ${DISTCCD_PIDFILE}` &>/dev/null
        TMPDIR="${TMPDIR}" \
        PATH="/home/crossdev/amd64/bin" \
        /sbin/start-stop-daemon --start --quiet --startas ${DISTCCD_EXEC} \
        --pidfile ${DISTCCD_PIDFILE} -- \
        --pid-file ${DISTCCD_PIDFILE} -N ${DISTCCD_NICE} --user distcc \

        eend $?

stop() {
        ebegin "Stopping distccd (32-bit toolchain)"
        start-stop-daemon --stop --quiet --pidfile "${DISTCCD_PIDFILE}"
        rm -f "${DISTCCD_PIDFILE}"
        eend $?


# Copyright 2003 Gentoo Technologies, Inc
# $Header: /var/cvsroot/gentoo-x86/sys-devel/distcc/files/2.17/conf,v 1.1 2004/08/22 19:14:10 lisa Exp $
# distccd configuration file


# These next two options MUST differ from their
# regular /etc/conf.d/distccd counterparts.

DISTCCD_OPTS="${DISTCCD_OPTS} --log-level critical"


# Note that PATH is unset; specify full path of everything
/usr/bin/$( /usr/bin/echo $0 | /bin/grep -o '[^-/]*$' ) -m32 $@
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum