https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80759
--- Comment #19 from ro at CeBiTec dot Uni-Bielefeld.DE <ro at CeBiTec dot Uni-Bielefeld.DE> --- > --- Comment #18 from Daniel Santos <daniel.santos at pobox dot com> --- > I intended to respond to your comments from 6 days ago sooner, but better late > than never! Again, sorry for the delay No worries at all: I'm way late here myself ;-) > (In reply to r...@cebitec.uni-bielefeld.de from comment #14) >> You need to make certain to have the necessary 32-bit libraries and >> headers. Apart from that, configure --target=i686-pc-linux-gnu >> --enable-targets=all should be enough, together with CC='gcc -m32' >> CXX='g++ -m32'. I don't pass --enable-multilib, this happens by default. > > I think I'll need to figure this part out soon, as I posted earlier about > strange problems when calling exec. As it turns out, there are a lot of > variables in the generated script that aren't being populated, > ORIGINAL_AS_FOR_TARGET being one of them. The "exec: --: invalid option" > problem is occurs because ORIGINAL_AS_FOR_TARGET expands to an empty string > and > the first thing after "exec" is the argument "--32" that is intended for the > AS > program. I now remembered what you're probably missing: as soon as configure and the gcc build process are run with --target=<some target> which differs from the (guessed by config.sub) values for --host and --build, they conclude that a cross-configuration/-build is running and make their set of assumptions on how to locate cross-ar/as/ld. In the case at hand (and any multilibbed target in general), this is wrong: this is *not* a cross-build since the host can execute both 32 and 64-bit binaries and many of those assumptions are wrong. The way to convince configure of that fact is to run it with --build=i686-pc-linux-gnu --host=i686-pc-linux-gnu --target=i686-pc-linux-gnu This way, you'll get a native build and all problems should vanish. While in theory both /usr/bin/as and /usr/bin/ld should be capable of performing both 32 and 64-bit assemblies/links, I found it best to provide an i686-pc-linux-gnu gas and gld with --with-as=<path to gas> --with-gnu-as --with-ld=<path to ld> --with-gnu-ld to avoid a couple of corner cases. You should configure binutils in the same way, perhaps again with CC='gcc -m32' CXX='g++ -m32'. I'll comment on the rest later once I find some time. Rainer