View previous topic :: View next topic |
Author |
Message |
dragonian n00b
Joined: 22 Feb 2005 Posts: 41
|
Posted: Wed Mar 23, 2005 3:43 am Post subject: using amd 64 for 32 bit distcc compiles |
|
|
Is there a way that I can use my athlon 64 box to host distcc compiles for my other x86-32 machines? It would be nice if i can use this compiling beast to recompile mythtv weekly on my slower machines?
The other machines use gcc-3.3.5, so just using distcc with 3.4.x is certainly not going to work. I tried to just re-build gcc 3.3.5 and it failed with issues with /emul/linux/x86/lib/libc.so.6. Is there an easy way to get the older version on a 64 bit arch, without breaking everything else?
I figured out that i can tell distcc to use the path a different gcc, is there anything else that I would need to do to make it work? |
|
Back to top |
|
|
dragonian n00b
Joined: 22 Feb 2005 Posts: 41
|
Posted: Thu Mar 24, 2005 5:37 pm Post subject: |
|
|
bump... anyone? |
|
Back to top |
|
|
embobo Guru
Joined: 19 May 2003 Posts: 311
|
Posted: Thu Mar 24, 2005 8:08 pm Post subject: Re: using amd 64 for 32 bit distcc compiles |
|
|
dragonian wrote: | Is there a way that I can use my athlon 64 box to host distcc compiles for my other x86-32 machines? It would be nice if i can use this compiling beast to recompile mythtv weekly on my slower machines?
I figured out that i can tell distcc to use the path a different gcc, is there anything else that I would need to do to make it work? |
Is your athlon 64 box running as a 64 bit system or in 32 bit emul? I assume the former because otherwise it would just work(tm). ia32 and AMD64 are different architectures. You need a cross-compiler (actually you may need the whole cross toolchain).
I'm in a similar situation and tried to emerge sys-devel/crossdev but it didn't work and I gave up. You may have better results. |
|
Back to top |
|
|
Sm1 Apprentice
Joined: 02 Dec 2003 Posts: 251 Location: Ames, IA
|
Posted: Thu Mar 24, 2005 8:15 pm Post subject: |
|
|
I'd be interested in this as well, any success stories from anyone using crossdev to cross compile for a different architecture?
I emerged crossdev and I'm building as we speak - I'll see what happens |
|
Back to top |
|
|
Sm1 Apprentice
Joined: 02 Dec 2003 Posts: 251 Location: Ames, IA
|
Posted: Thu Mar 24, 2005 8:38 pm Post subject: |
|
|
Okay looks like it failed at linux headers, I'll have to try some other versions of linux headers i guess:
Code: |
CRC-CCITT functions (CRC_CCITT) [N/m/y/?] (NEW) n
CRC32 functions (CRC32) [Y/?] y
CRC32c (Castagnoli, et al) Cyclic Redundancy-Check (LIBCRC32C) [M/n/y/?] m
:0: sorry, unimplemented: 64-bit mode not compiled in
:0: sorry, unimplemented: 64-bit mode not compiled in
SPLIT include/linux/autoconf.h -> include/config/*
CC scripts/mod/empty.o
scripts/mod/empty.c:1: sorry, unimplemented: 64-bit mode not compiled in
make[2]: *** [scripts/mod/empty.o] Error 1
make[1]: *** [scripts/mod] Error 2
make: *** [scripts] Error 2
!!! ERROR: cross-i686-pc-linux-gnu/linux-headers-2.6.8.1-r4 failed.
!!! Function compile_headers, Line 243, Exitcode 2
!!! prepare failed
!!! If you need support, post the topmost build error, NOT this status message.
|
|
|
Back to top |
|
|
Steven Robertson Tux's lil' helper
Joined: 26 Mar 2003 Posts: 140 Location: Tampa, FL
|
Posted: Thu Mar 24, 2005 11:43 pm Post subject: |
|
|
I didn't end up using crossdev. As long as your systems are running the exact 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 on what I did follow; at the end of this post 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
Code: | PATH="$(gcc-config --get-bin-path):${PATH}" \ |
and change it to
Code: | PATH="/home/crossdev/amd64/bin" |
(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:
Code: | # 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:
/etc/init.d/distccd32
Code: | #!/sbin/runscript
# $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 \
${DISTCCD_OPTS}
eend $?
}
stop() {
ebegin "Stopping distccd (32-bit toolchain)"
start-stop-daemon --stop --quiet --pidfile "${DISTCCD_PIDFILE}"
rm -f "${DISTCCD_PIDFILE}"
eend $?
} |
/etc/conf.d/distccd32
Code: |
# 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
DISTCCD_OPTS=""
DISTCCD_EXEC=/usr/bin/distccd
# These next two options MUST differ from their
# regular /etc/conf.d/distccd counterparts.
DISTCCD_PIDFILE=/var/run/distccd/distccd32.pid
DISTCCD_OPTS="${DISTCCD_OPTS} --port 3632"
DISTCCD_OPTS="${DISTCCD_OPTS} --log-level critical"
DISTCCD_OPTS="${DISTCCD_OPTS} --allow 192.168.0.0/24"
DISTCCD_NICE="15" |
/home/crossdev/amd64/bin/crosscall
Code: | #!/bin/bash
# Note that PATH is unset; specify full path of everything
/usr/bin/$( /usr/bin/echo $0 | /bin/grep -o '[^-/]*$' ) -m32 $@
|
|
|
Back to top |
|
|
Sm1 Apprentice
Joined: 02 Dec 2003 Posts: 251 Location: Ames, IA
|
Posted: Thu Mar 24, 2005 11:59 pm Post subject: |
|
|
Sounds wonderful - I'll get this going later on this evening. |
|
Back to top |
|
|
dragonian n00b
Joined: 22 Feb 2005 Posts: 41
|
|
Back to top |
|
|
Sm1 Apprentice
Joined: 02 Dec 2003 Posts: 251 Location: Ames, IA
|
Posted: Thu Mar 31, 2005 6:12 pm Post subject: |
|
|
I actually followed Steven Robertson's way of doing it already- and his worked perfectly, now i just have to remember to upgrade gcc at the same time on each of these.... |
|
Back to top |
|
|
Steven Robertson Tux's lil' helper
Joined: 26 Mar 2003 Posts: 140 Location: Tampa, FL
|
Posted: Fri Apr 01, 2005 12:04 am Post subject: |
|
|
Sm1: Glad to hear it! As a side note, the "exact same" rule is a little flexible, so don't sweat it. (By a little, I mean I've used 3.3.5 alongside 3.4.3 without incident. But it theoretically should prove disasterous to do so. :) Even so, it's still best not to run different minor versions against each other.) |
|
Back to top |
|
|
tarzan420 Tux's lil' helper
Joined: 05 Jul 2003 Posts: 81 Location: Fairbanks AK
|
Posted: Wed Apr 06, 2005 4:43 pm Post subject: |
|
|
S.R.: Thanks for your tip - I was looking at setting up the same thing, knowing that -m32 was a whole lot easier than building a new toolchain.
Now my dual 242 can help my bud upgrade from 1.4rc1.... ( I think we may just reinstall, rather than trying to upgrade - he's on dialup, on a 500mHz machine, so he doesn't update often.) _________________ The power of Unix coupled with a pleasing interface and scores of usable desktop applications is a disgusting perversion of everything Unix stands for. |
|
Back to top |
|
|
kon Apprentice
Joined: 05 Mar 2004 Posts: 156 Location: Russia. Saint-Petersburg
|
Posted: Thu Apr 07, 2005 1:05 pm Post subject: |
|
|
Steven Robertson: thank you very much. |
|
Back to top |
|
|
racoontje Veteran
Joined: 19 Jul 2004 Posts: 1290
|
Posted: Wed Apr 20, 2005 7:35 pm Post subject: |
|
|
Kick (see my other topic)...
Why is this even neccessary? I know I could just copy and hope it works, but I'd like to know /why/ the default install (identical gcc's compiled with multilib that get the -m32 flag passed) doesn't work. |
|
Back to top |
|
|
JustinHoMi Tux's lil' helper
Joined: 21 Apr 2005 Posts: 97
|
Posted: Mon Apr 25, 2005 1:31 pm Post subject: |
|
|
He explains it above. Some scripts will strip the flags before compiling.
Quote: | 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. |
|
|
Back to top |
|
|
JustinHoMi Tux's lil' helper
Joined: 21 Apr 2005 Posts: 97
|
Posted: Mon Apr 25, 2005 1:33 pm Post subject: |
|
|
BTW, this appears to work great so far. I'm compiling xfce4 right now... we'll see if it runs!
Any luck getting distccmon to work without editing the source and recompiling? |
|
Back to top |
|
|
Sm1 Apprentice
Joined: 02 Dec 2003 Posts: 251 Location: Ames, IA
|
Posted: Mon Apr 25, 2005 1:36 pm Post subject: |
|
|
Distccmon worked fine for me when I tried it, just launch it with the appropriate environment variable path and your set. I have gotten to the point where I don't care about the data that is shown on it however, and stopped bothering with it. |
|
Back to top |
|
|
JustinHoMi Tux's lil' helper
Joined: 21 Apr 2005 Posts: 97
|
Posted: Mon Apr 25, 2005 1:39 pm Post subject: |
|
|
Hmm, oh well.... I'm just curious to see how many jobs it sends over.
I used:
Code: | DISTCC_DIR="/var/tmp/portage/.distcc/" distccmon-gnome |
|
|
Back to top |
|
|
isolationism Tux's lil' helper
Joined: 01 Nov 2004 Posts: 127
|
Posted: Mon Apr 25, 2005 3:54 pm Post subject: |
|
|
This sounds really nice -- I have two AMD64 machines on the network which have been distributed-compiling for each other for a while (with limited success -- lots of apps just bomb out unless I disable the distcc feature before emerging) but they don't need it that badly -- On the other hand, I have a little 1GHz EPIA for running Freevo that could use all the help it can get to get back up and running (I'm switching from the old 2.4 kernel to a 2.6.11 / 2005.0 profile).
I've followed Steven Robertson's example and am crossing my fingers. I'm emerging gcc-3.4.3-r1 on my x86 box now so that all the gcc versions are identical (I saw your note that you may be able to get away with this ut I figured eh, why not play it safe) and will hopefully be cross-compiling a little later this afternoon. |
|
Back to top |
|
|
JustinHoMi Tux's lil' helper
Joined: 21 Apr 2005 Posts: 97
|
Posted: Mon Apr 25, 2005 3:58 pm Post subject: |
|
|
Where did you get your EPIA? I've been thinking about getting one for my mythtv.
Justin |
|
Back to top |
|
|
thepustule Apprentice
Joined: 22 Feb 2004 Posts: 212 Location: Toronto, Canada
|
Posted: Mon Apr 25, 2005 9:17 pm Post subject: What about PPC |
|
|
I guess the same thing could be done to distcc-cross-compile for the PPC platform on a Dual Opteron? |
|
Back to top |
|
|
JustinHoMi Tux's lil' helper
Joined: 21 Apr 2005 Posts: 97
|
Posted: Mon Apr 25, 2005 9:32 pm Post subject: |
|
|
No. you'd have to install a cross-compiler (search). The reason this specific trick works with amd64 and x86 is because the amd64 is capable of running 32bit x86 binaries and the amd64 version of gcc is capable of building 32bit or 64bit binaries To use distcc across different platforms that are not binary compatible you'd have to use crossdev or such. |
|
Back to top |
|
|
Sm1 Apprentice
Joined: 02 Dec 2003 Posts: 251 Location: Ames, IA
|
Posted: Tue Apr 26, 2005 12:49 am Post subject: |
|
|
Just an FYI, I was never able to get crossdev to work on amd64. |
|
Back to top |
|
|
RiverRat n00b
Joined: 07 Oct 2004 Posts: 65 Location: Colorado
|
Posted: Tue Apr 26, 2005 4:06 am Post subject: How To |
|
|
Anbody out there working on writing a howto for this. I would also like to get my Athalon64 to compile for my older x86 but I'm trying to stay as close to an 'official' release as possible. Hopefully there will be an ebuild for everything soon. _________________ RiverRat |
|
Back to top |
|
|
JustinHoMi Tux's lil' helper
Joined: 21 Apr 2005 Posts: 97
|
Posted: Tue Apr 26, 2005 4:30 am Post subject: |
|
|
It's very easy to set it up. Took me less than 5 minutes, and easily reversible. |
|
Back to top |
|
|
isolationism Tux's lil' helper
Joined: 01 Nov 2004 Posts: 127
|
Posted: Tue Apr 26, 2005 5:16 am Post subject: |
|
|
I got everything set up but makes (whether done manually or through emerge) just crapped right out with an "error 110" -- the servers don't seem to have recorded any logs despite my having asked them to log errors. :S I probably have something wrong with my configuration, but for now I haven't been able to make use of the cc. Since everyone else has reported success though I'll keep at it and see if I can find out where I screwed up.
JustinHoMi: I bought the EPIA at a local computer store here in town named RB Computing (I'm in Ottawa, Canada). I'm not going to link to it as I don't know what the "spam" rules are for this board, but I'm sure you can find it if you want to look it up. There are a number of online retailers that sell them; you just have to find the right one. I've found only the "higher end" small shops are likely to carry them; big box stores, OEM retailers and the like aren't very likely to carry them. I also bought my case there, too -- A Travla C137. They're small and VCR-sized and can fit a full 3.5" hard drive AND a PCI card. If you don't need either (e.g. are willing to live with a Laptop HDD, CF drive or pxe-boot system) then you can fit into something even smaller that's about the size of a 5.25" external CD writer shoebox and even has a little handle on the back. Fun little toys. |
|
Back to top |
|
|
|