Shipping *.so and binaries while building RPM package

sundar_ima picture sundar_ima · Jan 22, 2014 · Viewed 7.5k times · Source

I have created a python application in which I would like to ship .so and some binary files in the final RPM package. After long reading I found a way to add binaries/ image and other data files in setup.py. Now, when I build an RPM with python setup.py bdist_rpm command, it complains about architecture dependency:

    Arch dependent binaries in noarch package
error: command 'rpmbuild' failed with exit status 1

After googling I found that we can add:

#%define _binaries_in_noarch_packages_terminate_build 0

or removing the line BuildArch: noarch in the packagename.spec file to overcome the rpmbuild failure. However, every time I add or remove line from build/bdist.linux-i686/rpm/SPECS/packagename.spec the command python setup.py bdist_rpm always overwrites the .spe file.

Is there a way to avoid Arch dependent binaries and ship *.so and other binary files in rpm?

Answer

frans picture frans · Jul 4, 2014

.so files are always arch dependent as far as I know.

In your case to avoid having to edit the specs-file all the time you can add --force-arch=<your_arch> to our setup.py bdist_rpm

e.g.

python setup.py bdist_rpm --force-arch=x86_64