2006-10-10
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
libraries).
The chain of events seems to be that mock
defers to yum
, which
defers to RPM stuff, which defaults to using whatever it finds in the
host's /etc/rpm/platform
if such a file exists. To get around this,
you have to:
- temporarily rename
/etc/rpm/platform
to something else, and then - run
mock
as '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.
A trivial script: wcat
Here's wcat
, which is short for 'web page cat':
#!/bin/sh exec wget -q -O - "$@"
(At some point I may need to add '-e robots=off
' to this, but I
haven't needed it yet.)
I have a flaw when it comes to my little scripts: often, I think that sometime is too small and trivial to bother turning into a script, so I don't for ages. And then when I give in and make the script, I rediscover that automation promotes action, because I start using the new script all over.
This is exactly what's happened with wcat
; now that I have it, I've
been discovering all sorts of situations where it is just what I want,
and I can't imagine how and why I lived without it for so long.
(I suspect that pretty soon I am going to find myself writing wless
,
which will just be something like 'wcat "$@" | less
'.)