RPM says missing dependency but I have already installed that library (from source)

compilingdependenciesrpm

When installing a rpm package it warns that there is a necessary dependent library missing. In fact I have already installed that library from source, so I guess rpm just doesn't know about that.

Then can I let rpm know the existing library, and how? Maybe add some code in a rpm configure file?

By the way, installing the missing library (again) by rpm may solve the problem (quickly), but sometime there's no rpm version available.

Best Answer

The RPM dependency database cannot tell that you installed a package from source. The RPM database only knows about the metadata present in the RPM packages, a package installed from source does not contains this metadata.

Some configure scripts that build a package from source will produce pkg-config, which is metadata about the installed package. Yet, there is no clear-cut integration between the metadata from pkg-config and RPM metadata (or DEB metadata, or pacman metadata). When packaging a distro, the packagers insert the metadata in a specific format into the packages (e.g. RPM packages) and that metadata is the one used to determine dependencies. Not metadata provided in any other form.

On the other hand, you can have different versions of a library on the same system. By default (i.e. according to the GNU coding standards which most packages follow) a configure script should install its produce into /usr/local. Whilst packages packaged by the distro (e.g. RPM) should install their content into /usr.

Therefore, if you follow the convention (called FHS) and keep packages/libraries installed from source in /usr/local, then installing the same library through RPM will not conflict with your library (since the packagers of the distro do follow FHS).

When there is no RPM available, you can build it yourself. For that you need to build the package/library from source and install it into a dummy place (a build root). Then provide the metadata needed for the RPM package and package it into an RPM file. TLDP has a dated but very thorough guide on building RPMs.