Compiling x86 binaries on x86-64

What ways are there to compile x86 binaries on an x86-64 system?
There are some emulators I would like to compile but they rely on assembly code written for x86.

To compile an i386 kernel on x86_64, one passes ARCH=i386 to make. I have no idea if it works for user code, but worth a try.

You can build 32-bit binaries on 64-bit systems but you have to modify the makefiles to use --march=i686 for gcc and other mods for ld. Maybe also fro as. I forget the details, it was a long time ago that I did this. Also you have to have 32-bit development packages loaded and 32-bit runtime packages to execute.

It might be less intrusive and less hassle to build them in a 32-bit virtual machine.

Simple ‘-m32’ switch for gcc is enough. Make also sure, that you have all 32bit libraries you’ll need for linking.