# GF23: Error while loading shared libraries: libstdc++.so.5

## Maedhros

Navigation: [Gentoo Fundamentals] [Table of Contents]

Q: Why am I getting the following error when trying to emerge anything?

```
/usr/bin/python: error while loading shared libraries: libstdc++.so.5: cannot open shared object file: No such file or directory
```

A: You have probably upgraded to gcc 3.4 without following the gcc upgrading guide. You will need to recompile everything that was previously linked to libstdc++.so.5, as described in the guide. However, since python is one of the programs that links to libstdc++.so.5, Portage won't work, so you'll have to work around that first.

You can temporarily fix python in one of two ways:

If you can find a binary package for your architecture of either gcc 3.3 or libstdc++-v3, you can untar them in the / directory. This will provide a working libstdc++.so.5, which should mean python and therefore portage works again. You should then emerge the binary package with a command like emerge -K '=sys-devel/gcc-3.3*' or emerge -K 'sys-libs/libstdc++-v3' so portage knows which files have been installed. You might be able to find suitable binaries here: http://dev.gentoo.org/~avenj/bins/.

You might also be able to get it to work by temporarily linking libstdc++.so.5 to libstdc++.so.6. You can find the location of the missing library by running find /usr -iname 'libstdc++.so.?'. You can then change to this directory and create libstdc++.so.5 as a symbolic link to libstdc++.so.6 by running ln -s libstdc++.so.6 libstdc++.so.5. This link should be removed after you re-emerge python.

You should then re-emerge python so it links against libstdc++.so.6. Now that python works again, you can run revdep-rebuild as described in the upgrading guide to fix the rest of your system.

If need any more help with this, please post to this thread: after gcc-3.4.3 emerge, emerge itself won't work anymore.

----------

