Thursday, April 7, 2011

/usr/lib/ version GLIBCXX_3.4.XX required by

Have you every tried to start up a new program and received this cryptic error:

/usr/lib/ version GLIBCXX_3.4.XX required by...

If you have, browsing the internet will usually lead you to believe that you must update your version of libstdc++ or upgrade to a newer distribution of your favourite OS. Well if upgrading is out of the question and you already have the latest verion of libstdc++ installed on your system from your distro's repositories. You also tried to upgrade it to a newer version and you get a whole bunch of dependency errors (which will be the case since the newer version is incompatible with most things that are currently compiled on your system), you can follow these steps.

Firstly find out what versions of GLIBCXX are supported on your system:

strings /usr/lib/ | grep CXX

Replacing X with the highest version number in of libstdc++ you have in the /usr/lib directory). Note that if you are running 64bit, it will be in /usr/lib64.

Now you will notice that the version of GLIBCXX you are requiring is not on that list. Your distro will most certainly have a newer version of this to install from a newer repository, but it will break other things on your system if you go ahead and try to install it. The trick now is to only run with that version of libstdc++ for the program you are trying to run.

To do this, download the rpm or package that contains the newer version of libstdc++ from a newer version of the distribution's repository. Try not to go too far ahead, make an educated guess as to which version you might need from which distro (for instnace if you are using openSUSE 11.1, check 11.2 first) If it came in an rpm do the following in a temp directory to extract the rpm without installing it:

rpm2cpio libstdc++.rpm | cpio -idmv

Now run the strings command from before, and see if it contains the right version of GLIBCXX you need. If it does, copy the out the fullname and the fully qualified link of libstdc++ into the ./lib directory of the program you are wanting to run.

Now create a small script with the following:




This will override what is in /usr/lib/ and now all is now right with the world once again, executing the script should now allow your program to run.

No comments:

Post a Comment