[Rpm-maint] Problems using RPM to build cross-compiled (MinGW/Windows) packages

Richard W.M. Jones rjones at redhat.com
Mon Aug 4 09:21:44 UTC 2008

Hi, I hope this is the right place to raise these issues.

We've recently been trying to build MinGW (a Windows cross-compiler)
plus MinGW packages for Fedora.  This "kinda" works, but there are
some problems because RPM itself doesn't understand cross-compilation,
or maybe we're just not using RPM right.

The problems we've seen so far:

(1) The default __os_install_post script does a lot of stuff which is
not just irrelevant, but in fact dangerous.  In particular it runs
Linux 'strip' on Windows binaries which corrupts them.  What we'd want
it to do is to run the Windows-aware 'i686-pc-mingw32-strip' (from
mingw-binutils) on Windows binaries/libraries instead.

(2) The default RPM_OPT_FLAGS are wrong in several respects for
cross-compiling.  One big problem is that they include '-m32' or
'-m64' depending on the host architecture (I think).  Our target
architecture is always 32 bit, so using -m64 is always wrong for us.
Also, defaults like -fstack-protector don't work properly on Windows.

(3) Auto-dependency generation doesn't work at all, so we end up with
manual 'Requires:' in the spec files.  I'm not even sure if there is a
naming convention for Windows library deps.

(4) Running configure in a subdirectory is common (ie. mkdir build; cd
build; ../configure).  This doesn't easily let me use %configure
although in the end I found a really gross hack which worked.

If you want to see some of our work, including example specfiles, then
take a look at (or 'hg clone'):
Please read the README file first since it explains the order in which
you have to build the packages.


Richard Jones, Emerging Technologies, Red Hat  http://et.redhat.com/~rjones
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.

More information about the Rpm-maint mailing list