Might as well start with the obvious: I’m a RPM tyro. I’ve only written one RPM spec file from scratch, and that only possible by leaning heavily on this excellent RPM tutorial.
Recently I was writing a Makefile to replace a documented manual process for creating an RPM, and I encountered the following weirdness: an RPM I created would not install, citing missing shared libraries, but running ldd on the executable extracted from the RPM showed that the loader could find the libraries, and in fact the executable loaded and ran with out complaint.
More concretely, output from
rpm -i --test foo.rpm
error: Failed dependencies: libcidr.so.0()(64bit) is needed by dnsapserver-126.96.36.199b1a2eb-12.x86_64 libevent-2.0.so.5()(64bit) is needed by dnsapserver-188.8.131.52b1a2eb-12.x86_64 libevent_pthreads-2.0.so.5()(64bit) is needed by dnsapserver-184.108.40.206b1a2eb-12.x86_64 libmemcached.so.9()(64bit) is needed by dnsapserver-220.127.116.11b1a2eb-12.x86_64
…but output from
libcidr.so.0 => /usr/local/lib/libcidr.so.0 (0x00007fef28d21000) libevent-2.0.so.5 => /usr/lib64/libevent-2.0.so.5 (0x00007fef2935d000) libevent_pthreads-2.0.so.5 => /usr/lib64/libevent_pthreads-2.0.so.5 (0x00007fef28f2a000) libmemcached.so.9 => /usr/lib64/libmemcached.so.9 (0x00007fef2912c000)
sudo make install sudo ldconfig -v
My initial work-around was to install the RPM without checking dependencies:
sudo rpm -i --nodeps foo.rpm
That works, but every time I did it, I felt like I really needed to shower.
A real solution, suggested by a colleague after I mentioned this ugliness during a stand-up meeting: install the packages by using RPMs.
Apparently, rpm checks an rpm database rather than using ldd or some other mechanism to determine what’s available. And apparently installing from make results in the libraries being available to the loader, but with no updates to the RPM database.
This makes sense, but by no means can I assure you that it’s the solution in every case. What is certain is that in this case, it worked for me.
In any event, now that rpm has quit complaining, I’m a happy camper, and my water bill is getting some relief.
“So just how DOES one extract the contents from an RPM file?” I hear you ask.
“Use rpm2cpio,” I answer, “like this:”
rpm2cpio foo.rpm | cpio -idmv