Howto build i386 packages on x86_64 FC-6

Hans de Goede j.w.r.degoede at hhs.nl
Fri Oct 27 08:55:04 UTC 2006


Hi all,

As you know from previous mails I've been doing some experimenting with
building i386 packages on x86_64 (trying to see if the new
multilib-devel really works).

I currently have a working setup for this which I would like to share
with you, for the why of these please see my previous mail titled:
"State of multilib development update"

Here is the how:

1 One time preperation steps
============================

1a) Create a dir somewhere which is not in your default $PATH,
    I use $HOME/rpmbuild-i386

1b) Add the following gcc, cc, g++ and ld wrapper scripts to this dir:

gcc
---
#!/bin/bash

exec /usr/bin/gcc -m32 "$@"
---

cc
---
#!/bin/bash

exec /usr/bin/gcc -m32 "$@"
---

g++
---
#!/bin/bash

exec /usr/bin/g++ -m32 "$@"
---

ld
---
#!/bin/bash

exec /usr/bin/ld -b elf32-i386 "$@"
---


1c) Somewhere in your $PATH add the following rpmbuild-i386 wrapper
    script:

rpmbuild-i386
---
#!/bin/bash

export PATH=$HOME/rpmbuild-i386:$PATH
export PKG_CONFIG_PATH=/usr/lib/pkgconfig

exec setarch i386 rpmbuild --target i386 "$@"
---

    Notice that you should modify the export PATH=xxx line to match your
    setup

1d) mark all these scripts as executable

1e) rm /etc/rpm/platform (see:
    https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=194123


2 Per package steps
===================

2a) Manually check you've got i386 versions installed of all
    BuildRequires (and of the Requires of those BuildRequires)

    This must be done because rpmbuild will hapily try to build an i386
    package when you've only got an x86_64 version of the required
    foo-devel, since you do have (a version of) foo-devel

    Notice that there are exceptions here, in the case of
    desktop-file-utils and ImageMagick (when only using convert) the
    x86_64 versions will do fine.

2b) Build the package using rpmbuild-i386 instead of plean rpmbuild,
    for example: "rpmbuild-i386 -bb bar.spec"


Enjoy and Regards,

Hans


p.s.

It is possible to create a make-i386 command in a very similar way,
perhaps it is an idea to create a little package called build-i386 for this?




More information about the fedora-devel-list mailing list