jam jam - 1 year ago 142
C++ Question

Failed dependency on libstdc++(GLIBCXX_...) when installing RPM

I have a linux box on which I've compiled and installed a newer version of GCC (4.3.9), which is present in /usr/lib.

I used this compiler to build a set of libraries which I have bundled into an RPM, but when I come to try install that RPM it gives the the following errors:

rpm -ivh my-rpm.i586.rpm
error: Failed dependencies:
libstdc++.so.6(GLIBCXX_3.4.10) is needed by my-rpm.i586
libstdc++.so.6(GLIBCXX_3.4.11) is needed by my-rpm.i586
libstdc++.so.6(GLIBCXX_3.4.15) is needed by my-rpm.i586
libstdc++.so.6(GLIBCXX_3.4.20) is needed by my-rpm.i586
libstdc++.so.6(GLIBCXX_3.4.9) is needed by my-rpm.i586

I know that these symbols are provided by the gcc I compiled:

strings /usr/lib/libstdc++.so.6 | grep GLIBCXX

And if I do ldd on any of the .so files packaged into the RPM I can see that it is expecting the correct libstdc++:

ldd BUILDROOT/usr/lib/libfoo.so
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xb7635000)

So I think my only issue is getting RPM's dependency resolver to look in the right place. This answer implies LD_LIBRARY_PATH is what determines that search path, but setting this in my .bashrc doesn't seem to have helped (and I can see it is set with echo in the same shell I am running rpm -i from).

What variables do I need to set (and where) to get the RPM installer to understand where my libstdc++ is?

Answer Source

The problem is that rpm works with "metadata". The official libstdc++6 package provides:


rpm won't start investigating the installed /usr/lib/libstdc++.so.6 to see if it provides GLIBCXX_3.4.10. Afaik there is no way to tell rpm to do so. I see multiple ways to solve this problem; in order of my preference:

  1. rebuild the libstdc++ 4.3.9 rpm yourself and install it; then all the dependencies will work out fine (you can look here to find gcc*src.rpm). As for me; that is the only future-proof solution!
  2. when packaging my-rpm; use the option AutoReqProv: no; to tell rpm not to scan automatically for his requirements. Of course then you might run into dependency problems; where you'll have to determine and install the dependencies manually.
  3. when installing my-rpm; use the option --nodeps to ignore the dependencies. This might cause trouble with other dependencies (because now all dependencies will be ignored).
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download