How can I build a rpm for i386 target on a x86-64 machine?

From the Fedora documentation for rpm, spec files, and rpmbuild:

The --target option sets the target architecture at build time. Chapter 3,
Using RPM covers how you can use the --ignoreos and --ignorearch options 
when installing RPMs to ignore the operating system and architecture that 
is flagged within the RPM. Of course, this works only if you are installing 
on a compatible architecture.

On the surface level, the --target option overrides some of the macros in 
the spec file, %_target, %_target_arch, and %_target_os. This flags the RPM 
for the new target platform.

Under the covers, setting the architecture macros is not enough. You really 
cannot create a PowerPC executable, for example, on an Intel-architecture 
machine, unless you have a PowerPC cross compiler, a compiler that can make 
PowerPC executables.

http://docs.fedoraproject.org/en-US/Fedora_Draft_Documentation/0.1/html/RPM_Guide/ch-rpmbuild.html

So, as it says, make sure you have the additional compilers installed (for example gcc.i686 & gcc.x86_64).


Since you are using "-bb" flag which means you are building from binary so you don't need to install compilers for other architectures.

Just get rid of the "Buildarch" line in your spec file and pass it from the command line

--target i386

or

--target x86_64

And it should create the rpms for you.