Building i386 RPMs on x86_64

Dave Atkinson dave_atkinson at blueyonder.co.uk
Thu Sep 15 13:55:14 UTC 2005


On Thu, 2005-09-15 at 07:42 +0100, Paul Howarth wrote:
> On Wed, 2005-09-14 at 19:13 +0100, Dave Atkinson wrote:
> > Sorry if this issue's been addresses before (is there an effective way
> > to search fedora mailing lists?).
> > 
> > I've been trying to build some i386 RPMs on my x86_64 machine using
> > 
> > $ rpmbuild -ba --target i386 <spec file>
> > 
> > and it seems that this gives me library directories for 64-bit
> > libraries.  Specifically the %configure macro sets _libdir to
> > %{prefix}/lib64, but it should be %{prefix}/lib for i[3456]86 etc.
> > 
> > Am I missing something?
> 
> Try "man setarch"

Aha! Well, I certainly missed that! However 

$ setarch i386 rpmbuild -ba --target i386 <spec file>

builds <package>.rpm, but I still get

$ rpm -qlp <package>.rpm
...
/usr/lib64/...
/usr/lib64/...
...

Looking at /usr/lib/rpm/macros, from line 865 (rpm-4.4.1-22.x86_64) I
see the following:
[snip]
#==============================================================================
# ---- per-platform macros.
#       Macros that are specific to an individual platform. The values
here
#       will be used if the per-platform macro file does not exist..
#
%_arch                  x86_64
%_build_arch            x86_64
%_vendor                redhat
%_os                    linux
%_gnu                   -gnu
%_target_platform       %{_target_cpu}-%{_vendor}-%{_target_os}%{?_gnu}
[snip]

and sure enough, there are no platform-specific macros for archs other
than x86_64 and noarch on the FC4 x86_64 install.  

$ rpm -ql rpm | grep '/usr/lib/rpm/.*-linux'
/usr/lib/rpm/noarch-linux
/usr/lib/rpm/noarch-linux/macros
/usr/lib/rpm/x86_64-linux
/usr/lib/rpm/x86_64-linux/macros

It just so happens I have the FC4 i386 install on another disk (this
whole exercise is about trying to get rid of it ;).  Looking at the
files installed on that:

$ rpm --dbpath /oldsys/var/lib/rpm -qil rpm|grep '/usr/lib/rpm/.*-linux'
/usr/lib/rpm/athlon-linux
/usr/lib/rpm/athlon-linux/macros
/usr/lib/rpm/i386-linux
/usr/lib/rpm/i386-linux/macros
/usr/lib/rpm/i486-linux
/usr/lib/rpm/i486-linux/macros
/usr/lib/rpm/i586-linux
/usr/lib/rpm/i586-linux/macros
/usr/lib/rpm/i686-linux
/usr/lib/rpm/i686-linux/macros
/usr/lib/rpm/noarch-linux
/usr/lib/rpm/noarch-linux/macros
/usr/lib/rpm/pentium3-linux
/usr/lib/rpm/pentium3-linux/macros
/usr/lib/rpm/pentium4-linux
/usr/lib/rpm/pentium4-linux/macros

I tried copying the ones that didn't exist in x86_64 and re-running

$ setarch i386 rpmbuild -ba --target i386 rpms/SPECS/<package>.spec
$ rpm -qlp rpms/RPMS/i386/<package>.i386.rpm
...
/usr/lib64/...
/usr/lib64/...
...

but the libs _still_ get installed in /usr/lib64!

Anyone else think I should file a bug for this?  I think it would also
be nice if rpmbuild --showrc would respect --target.  At present, I get
this:

$ rpmbuild --showrc --target i386 | egrep '(_lib[[:space:]])|
optflags.*:'
optflags              : %{__global_cflags} -m64 -mtune=nocona
-14: _lib       lib64

which doesn't seem right to me.

Cheers,
Dave




More information about the users mailing list