PSA: RPMs and Required Libs

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

…resulted in

error: Failed dependencies: is needed by dnsapserver- is needed by dnsapserver- is needed by dnsapserver- is needed by dnsapserver-

…but output from

ldd foo.exe

…included => /usr/local/lib/ (0x00007fef28d21000) => /usr/lib64/ (0x00007fef2935d000) => /usr/lib64/ (0x00007fef28f2a000) => /usr/lib64/ (0x00007fef2912c000)

Here was the problem: I had installed libcidr, libevent,  and libmemcached by building them from source, and then using make to install them:

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



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s