Issue
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
...
GLIBCXX_3.4.10
GLIBCXX_3.4.11
...
GLIBCXX_3.4.15
...
GLIBCXX_3.4.20
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?
Solution
The problem is that rpm
works with "metadata". The official libstdc++6 package provides:
...
libstdc++.so.6(GLIBCXX_3.4.10)
libstdc++.so.6(GLIBCXX_3.4.11)
...
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:
- 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!
- when packaging my-rpm; use the option
AutoReqProv: no
; to tellrpm
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. - 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).
Answered By - Chris Maes Answer Checked By - Mary Flores (WPSolving Volunteer)