I'm packaging software in RPM and distributing it in different packages by architecture (32bit or 64bit).

Some libraries of my 32bit package have binaries that cannot be executed in 64bit systems (unless some additional libraries installed).

I've used file command to detect the interpreter needed to execute those binaries, and then added the required libraries as package's dependencies. This only solves a part of the problem, since then other required libraries may collide with the 64bit version installed on end-user's host.

So for sake of simplicity, I would like to know if there is a way to configure rpmbuild to forbid installing 32bit package in 64bit systems (in the same way that 32bit systems doesn't allow to install 64bit packages).

There is any rpmbuild option or .spec value available for that?


you don't need to do some kind of workaround for that. By default your rpms are built for the architecture you are building on. When building on 64bit system, your built rpms will be named package-version-release.x86_64.rpm ; whence only installable on 64bit systems.

rpmbuild also automatically determines most of your dependencies automatically (unless you use Autoreqprov=no inside your spec file). So when packaging a 32bit application; rpmbuild should normally create the correct requirements (like libc 32bit etc...).

When building a 32bit application and packaging this on a 64bit machine, the only thing you might want to do is force the resulting package to be of i586 architecture, which you can do in the spec file using

BuildArch: i586
  • Thanks for the answer! I build packages in a 64bit system and I use Autoreqprov=no to tackle manually package's dependencies. I also run rpmbuild with --target i386 to build 32bit packages (and also modify BuildArch: i386 to ensure the change). So, there is no other way to achieve what I want than not using Autoreqprov=no? – Alejandro S. Feb 19 at 12:51
  • no, I'm saying you should NOT use Autoreqprov=no. leaving autoreqprov enabled, rpmbuild will manage the dependencies himself. As you said the 32bit version could be installed if the correct dependencies are present. Well autoreqprov should add these dependencies for you – Chris Maes Feb 19 at 15:59
  • I understood what you meant. What I'm saying it's that I need to use Autoreqprov=no to avoid rpmbuild to scan some dependencies, so I need to use this value. That's why I'm looking for a way (if exists) to forbid the installation of my 32bit package on 64bit systems. If not, then I'll look for another approach. Thanks anyway! ;) – Alejandro S. Feb 19 at 16:26
  • ok. If you are always building a 64bit AND a 32bit version together, then you don't really need to forbid this. each package manager (yum, zypper) will automatically select 64bit if possible... – Chris Maes Feb 19 at 16:38
  • That won't work neither since the packages will only be available via web browser. Hence, there isn't any repository involved. – Alejandro S. Feb 19 at 16:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.