Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Automatically install build dependencies prior to building an RPM package

I am trying to build a .rpm package. I have just followed the steps to do that. Till now all steps were gone fine but now i just stuck with this step. I just ran the following command and got this error:

rpmbuild -ba asterisk.spec

error: Failed build dependencies:      gtk2-devel is needed by asterisk-1.8.12.2-1.fc15.x86_64     libsrtp-devel is needed by asterisk-1.8.12.2-1.fc15.x86_64     [... more ...]     freetds-devel is needed by asterisk-1.8.12.2-1.fc15.x86_64     uw-imap-devel is needed by asterisk-1.8.12.2-1.fc15.x86_64 

I am using fedora-15. How to resolve this error?

How I do install all depencencies during installation of src.rpm package. Is it possible?

like image 480
Juned Avatar asked Nov 05 '12 06:11

Juned


People also ask

Does Yum automatically install dependencies?

RPM can make a sysadmin's life a lot easier by presenting these dependencies – and tools relying on RPM such as the rpm utility, or yum can automatically solve these dependencies, and install all additional packages needed for a new component to run properly.

What kind of file is required in order to build an RPM?

In order to build RPMs, you will need source code, which usually means a compressed tar file that also includes the SPEC file. The SPEC file typically contains instructions on how to build RPM, what files are part of package and where it should be installed.


2 Answers

You can use the yum-builddep command from the yum-utils package to install all the build dependencies for a package.

The arguments can either be paths to spec files, paths to source RPMs or the names of packages which exist as source RPMs in a configured repository, for example:

yum-builddep my-package.spec 

or

yum-builddep my-package.src.rpm 

The same thing can be achieved on newer versions of Fedora that use dnf as their package manager by making sure that dnf-plugins-core is installed and then doing:

dnf builddep my-package.spec 

or

dnf builddep my-package.src.rpm 
like image 69
TomH Avatar answered Sep 23 '22 04:09

TomH


yum-builddep doesn't seem to work if the mirror you use doesn't serve source RPMs. This may not handle all cases, but it usually works for me:

sudo yum install -y $(<rpmbuild> | fgrep 'is needed by' | awk '{print $1}') 

where <rpmbuild> is your rpmbuild command (e.g., rpmbuild -ba foo.spec).

like image 37
jjlin Avatar answered Sep 21 '22 04:09

jjlin