Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Rpmbuild for various architectures

3,524 views
Skip to first unread message

Menno (Flexor) Willemse

unread,
May 23, 2011, 5:54:06 AM5/23/11
to
Kind Members of this Newsgroup,

I have been given a Bunch of Files to install on our Linux systems by
a vendor who would rather gnaw off his own fingers than part with the
source code. I have a tar file, and I have been assured the files are
good, and even if they aren't, that's someone else's problem.

Actually, I have been given *two* bunches of files. One for use on 32-
bits systems, and one for use on 64-bit systems. We wish to install
these files, as-is, in a subdirectory of /opt, from an RPM package. So
go go rpmbuild. This is the spec file we use:

---8<---cut-here----------------------
#-------------------------------------------------------------------------
#
#
# UNIX AUTOMATION RPMBUILD SPEC FILE
#
# - To build: rpmbuild -bb <filename>
#
#-------------------------------------------------------------------------
#
%define _topdir /export/build/v3/%{name}/%{version}

Name : MYpackage
Version : 1.0.3.0
Release : 0
License : The strictest of licenses
Group : A fine group of people
Summary : The Package That Does Nothing
Packager : Menno (Flexor) Willemse <fle...@wanadoo.nl>
Autoreqprov : no
Buildroot : /export/build/v3/%{name}/%{version}/root
Buildarch : i386
Requires : bash

%description
This is an example package to test.

%changelog

%post
service package start
chkconfig package on

%preun
service package stop
chkconfig package off

#-------------------------------------------------------------------------
#
%files
/usr/share/doc/MYpackage-1.0.3.0/README

---8<---cut-here----------------------

Obviously, I'd add more files to the %files section. Now for building
packages, we have a nice shiny 64-bit virtual machine (Architecture is
x86_64). So if I do the build there with buildarch set to i386, as
shown above, I get the following message:

error: No compatible architectures found for build

I have tried many things to get rid of that message, including
actually setting the architecture of the machine to i386, but nothing
so far has helped. I'm about to give up and stick the number of bits
in the version number, which is hideous and perverse, but will bloody
well work. Is there any other way I can assure rpmbuild that the
architecture *is* compatible don't worry?

Thanks in advance,
Menno Willemse

Brian Bebeau

unread,
May 23, 2011, 11:23:27 AM5/23/11
to
On 5/23/2011 5:54 AM, Menno (Flexor) Willemse wrote:

> Buildroot : /export/build/v3/%{name}/%{version}/root
> Buildarch : i386
> Requires : bash

> Obviously, I'd add more files to the %files section. Now for building


> packages, we have a nice shiny 64-bit virtual machine (Architecture is
> x86_64). So if I do the build there with buildarch set to i386, as
> shown above, I get the following message:
>
> error: No compatible architectures found for build
>
> I have tried many things to get rid of that message, including
> actually setting the architecture of the machine to i386, but nothing
> so far has helped. I'm about to give up and stick the number of bits
> in the version number, which is hideous and perverse, but will bloody
> well work. Is there any other way I can assure rpmbuild that the
> architecture *is* compatible don't worry?

If you want it to install on multiple architectures, just get rid of
the "Buildarch" line. You don't *have* to have it. Use a script in the
install part to determine the architecture, then install the 64- or 32-
bit executables.

Menno (Flexor) Willemse

unread,
May 24, 2011, 3:27:03 AM5/24/11
to
On May 23, 4:23 pm, Brian Bebeau <bbeb...@computer.org> wrote:
>
> If you want it to install on multiple architectures, just get rid of
> the "Buildarch" line. You don't *have* to have it. Use a script in the
> install part to determine the architecture, then install the 64- or 32-
> bit executables.

Hmm. That's a good idea, actually. Package both versions in one
package. The only reason I want the buildarch parameter is so I can
tell the versions apart from the filename, and so that RPM can throw a
proper strop if I install it on the wrong platform. But this works as
well. Thanks for the idea.

Menno (Flexor) Willemse

unread,
May 25, 2011, 4:14:25 AM5/25/11
to
I have finally found out how to do this, with a little help from my
cow-orker. You do not, actually, use the Buildarch line, and in fact
the line must not be present in the file when you do it. Then, you
use:

rpmbuild --target i686 -bb Package.spec

If the Buildarch line *is* present in the spec file, it will still
fail. I tried being cute by using a shell selector to add the
parameter, so you could execute the spec file as a program, but that
didn't work:

#!/usr/bin/rpmbuild --target i686 -bb
...rest of the file.

Cannot be arsed to find out what's wrong. It works now.

Thanks all,
Menno Willemse

0 new messages