There are still some issues with trying to do this (in particular, not all
configure scripts and makefiles can be easily fooled into building for
32-bit). However, the following works pretty good for me:
cd /wherever/your/rpm/build/area/is
# need to make the directories where the generated RPMs will end up
mkdir -p RPMS/{i386,i586,i686}
rpmbuild -ba --target i386-linux \
--define '_lib lib' --define '_libdir /usr/lib' \
SPECS/specfilename.spec
It is not necessary, or desired, to add to the BuildArch: field; this is
generally used when you want to limit the build to only certain
architectures. (For instance, when making .noarch RPMs)
I would have assumed that '--target i386-linux' would be sufficient, but I
also needed to redefine %_lib and %_libdir as shown above. (Otherwise,
/usr/lib64, etc. are still passed to ./configure and the build will fail)
I've only tried building a few 32-bit RPMs this way but it works for me.
You may also want to look at the scripts that Fedora uses for automated
RPM building, e.g. 'mock'- they might already have solved this problem for
all packages.
You may find the following script useful:
/afs/engin.umich.edu/system/templates/tools/dorpmbuild
That is what we use for building RPMs, it does the following:
- ensures that your environment and $PATH is clean before starting
(so that you don't run mystery programs instead of the correct
compiler, etc.)
- Defines %dist appropriately- most Red Hat specfiles have the
Release: as something like '10%{dist}' and this turns into
'10.el5'
- Supports 32-bit builds as above
- Captures the entire output of the build process in a log file,
which you can refer to later on (or compare against subsequent
builds or builds of later versions) to check for errors, etc.
Use as follows:
# build for native arch
cd SPECS
dorpmbuild specfile.spec
or
# build 32-bit package on x86_64
cd SPECS
dorpmbuild -32 specfile.spec
The log file is saved in the current working directory under the name:
$RPMNAME-$RPMVERSION-$RPMRELEASE.$RPMARCH-build.out
-Chris
[EMAIL PROTECTED]
On Wed, 5 Mar 2008, Jeremy Hallum wrote:
I'd like to be able to cross build i386/i686 RPMS on my x86_64 RHEL5.1
box. I note in the rpm docs that you can put multiple archs in the
BuildArch: field in the .spec file, but when I try to rpmbuild an
i386/i686 rpm it says No compatible Architectures. What package am I
missing to allow this?
Thanks for any help you can give.
-jeremy
--
Jeremy Hallum
System Adminstrator, Research Systems Group
LSA Information Technology
University of Michigan
[EMAIL PROTECTED]
_______________________________________________
rhelv5-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/rhelv5-list
_______________________________________________
rhelv5-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/rhelv5-list