Cross building i386 RPMs on an x86_64 Fedora Core 5 machine
The more I do stuff on my x86_64 Fedora Core 5 machine, the more I come to understand that people must not have actually tried to use this stuff. The latest adventure was trying to build an i386 RPM.
The best tool for this is mock, a tool for
rebuilding RPMs in distribution environments, like (in theory) 'Fedora
Core 5 for i386'. In practice, it needs some clubbing. The main
problem is that when
mock sets up its build area, it winds up
installing x86_64 packages instead of i386 packages, which means
that compiling anything in the build area fails (it tries to build
i386 binaries without necessary bits like
crt1.o, or even shared
The chain of events seems to be that
mock defers to
defers to RPM stuff, which defaults to using whatever it finds in the
/etc/rpm/platform if such a file exists. To get around this,
you have to:
- temporarily rename
/etc/rpm/platformto something else, and then
linux32 mock ...', so that mock and everything it runs thinks it's in a 32-bit environment.
(I got this from a Fedora Extras mailing list post.)
Mach, the alternative to mock, does not suffer from this problem but has a number of its own that probably make it a worse choice for cross-building RPMs. (It's a better choice if you want a general compilation environment, but still not a great one.)
I can't really call this a mock bug, because it never actually claims to support cross-building. It just comes with tantalizing configuration files that make it look like it does.
Update, November 17th: this mock problem has been fixed in recent updates on at least Fedora Core 5 and FC6, making me happy and making cross-building much easier.