Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where does rpm look for dependencies?

I have an rpm which I have build using rpmbuild. Lets say it is sample.rpm. It builds successfully. The rpm has and executable (let's call it init).

When I try to install it using rpm -ivh sample.rpm it shows me failed dependencies.

Let's say the error is Failed dependency for: example.so which means that rpm is not able to locate this shared object file. (even though the so file exists in the same directory).

So, I install the rpm as rpm -ivh sample.rpm --nodeps (as I know that I have the required so files).

Why is rpm not able to install those rpms then? where does it look for the object files? (does the linux loader looks for these .so). I have LD_LIBRARY_PATH to include path to these .so and so when I run the installed file (init) from the rpm it runs.

Then why is rpm not able to install sample.rpm (where exactly does it look for dependencies)? Is it something that needs to be specified at the time when the rpm is build?

like image 822
Deepti Jain Avatar asked Jul 10 '12 17:07

Deepti Jain


1 Answers

The dependencies of an RPM file are specified in its .spec file on the "Requires:" line.

Sample SPEC file:

Summary: <Summary for my Linux project>
Name: <Name for my Linux project>
Version: 2.5.1
Release: GA
Requires: libx1.so >= 2.6.3
BuildArch: i586
Group: System / Applications
License: GPL 2.0
Vendor: <my organization>

You can also run this command to determine which dependencies are required:

$ rpm -q --requires <my_rpm>
libx1.so.2
$

The dependency libx1.so itself should be installed through an RPM, so that its presence is entered in a database maintained by the RedHat Package Manager. In other words, the physical presence of libx1.so on the file system is not the criteria for the dependency test.

To find out which package provides the dependency, run the command:

$ rpm -q --whatprovides libx1

If no package provides libx1.so, your RPM will continue to show a dependency error unless you remove libx1.so from the "Requires:" line.

To disable automatic detection of dependencies, you can add this to your .spec file:

AutoReqProv: no

A lot more information is at rpm.org and rpm5.org.

like image 164
nohup Avatar answered Oct 04 '22 22:10

nohup