/sbin/ldconfig.real: /usr/lib/libstdc++.so.5 is not a symbolic link

I keep getting this error:

fmf@kodi:~$ sudo ldconfig  
/sbin/ldconfig.real: /usr/lib/libstdc++.so.5 is not a symbolic link  

Any idea on how to fix it?

fmf@kodi:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.1 LTS
Release: 16.04
Codename: xenial

Solution 1:

The most likely cause is that there are two files with almost the same name with identical contents, and one should be a symlink to the other, but is not. Here are two files in my /usr/lib that are OK

libgimpui-2.0.so.0 -> libgimpui-2.0.so.0.800.16
libgimpui-2.0.so.0.800.16 

(This symlink is so that programs that look for libgimpui-2.0.so.0 will find the newer version)

You apparently have libstdc++.so.5 and a related file such as libstdc++.so.5.300.0 or maybe libstdc++.so.6 and their contents are exactly the same. Do cd /usr/lib; ls and see if this is the case.

Check that the two files are the same, for example do (replace the correct filename in this command):

diff libstdc++.so.5 libstdc++.so.[rest.of.filename]

If they are the same, diff returns no output.

If and only if they are the same, delete libstdc++.so.5 and make a symlink to the other file with that name.

sudo rm libstdc++.so.5
sudo ln -s libstdc++.so.[rest.of.filename] libstdc++.so.5

Based on this question on Stack Overflow