On Wed, 2011-04-27 at 10:28 -0700, Ian Lance Taylor wrote: > Paul Smith <paul@xxxxxxxxxxxxxxxxx> writes: > > >> I think the simplest way to do this would be to configure as usual on a > >> 64-bit system, and build it using something like > >> make BOOT_CFLAGS="-m32 -g -O2" > > > > I tried to build on a 64bit system setting CC="gcc -m32" and CXX="g++ > > -m32" when running configure. But this failed. I'll look up > > BOOT_CFLAGS and see what I can find out. > > Setting CC and CXX won't help, because that won't affect the later > bootstrap stages. Setting BOOT_CFLAGS should affect the way the later > bootstrap stages are built, and should cause them to build 32-bit > binaries. I haven't actually tried it. Ah, I see. So CC/CXX are used to build the stage1 compiler (xgcc) but not the final compiler... that makes perfect sense now that you mention it :-). > > One, build on a 32bit host and use --target=x86_64-pc-linux-gnu (or > > something) to get a 64bit cross compiler (I assume(?) the resulting > > compiler will also be able to build 32bit targets). > > That should work. > > > Two, build on a 64bit host and figure out a way to force the resulting > > compiler to be a 32bit application. Would the best way of doing that be > > using configure with CC="gcc -m32"? Or setting --host=i686-pc-linux-gnu > > (or similar)? Or...? > > That should work, but use BOOT_CFLAGS as I suggested. OK. I'm going to start with the first (build on a 32bit system with --target) as it seems the simpler option. > I'm sorry, you're quite right. I did not know about that. You're > right, using --enable-targets=all when bootstrapping on a 32-bit ought > to give you a compiler which supports the -m64 option. What failed when > you tried that? Well to be honest I tried so many different things that I've lost track of what failed when. Let me start fresh and I'll get back to you with details if/when I run into things.