"Missing" lib for rpm install when it is present in rpm file
If neither of the other existing answers work for you, make sure you've set the SONAME
for your library. This is set via the 'soname' linker option which adds meta information to specify the library's shared object name. The Automatic Dependencies section of the "Maximum RPM" guide does a decent job of explaining how this relates to the rpm build process.
This answer (to a different question) explains SONAME
's purpose quite well, and the question itself explains the syntax.
Here's the most important portions of that answer, lightly edited for clarity and grammar:
soname
is used to indicate what binary api compatibility your library supports.
SONAME
is used at compilation time by the linker to determine, from the library file, what the actual target library version is. gcc -lNAME
will seek for libNAME
.so (symlink or file) then extract itsSONAME
that will certainly be more specific (e.g. libfoo.so links to libfoo.so.1.2.4 that containsSONAME
libfoo.so.1).
And here's the syntax:
gcc -shared -fPIC -Wl,-soname,libfoo.so.1 -o libfoo.so.1.2.4 foo.c
See also the Program Library HOWTO's section of "Creating a Shared Library" for further explanation.
A likely reason why your shared library is not detected by the "automatic provides" mechanism is that it is not executable.
Add something like this to your %install
section:
find %buildroot -type f \( -name '*.so' -o -name '*.so.*' \) -exec chmod 755 {} +
Source.