TransWikia.com

"libstdc++.so.6: cannot open shared object file: No such file or directory"

Ask Ubuntu Asked by UsagiYojimbo on December 10, 2021

I wrastled with the program according to the info in this question. Now it is installed but I can’t figure out how to run it. A friend running the same version of Ubuntu had no problems getting it to start after installing it the same way.

This is what I’ve done:

$ ./Psychonauts
./Psychonauts: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory

So I went ahead and:

$ sudo apt-get install libstdc++.so.6
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package libstdc++.so.6
E: Couldn't find any package by regex 'libstdc++.so.6'

It should be noted that I only started using Linux a few days ago.

Okay, so I did manage to install apt-file and apt-file update.

However then we hit another snag.

usagiyojimbo@Usagi:~$ sudo apt-file find libstdc++.so.6
[sudo] password for usagiyojimbo: 
E: The cache is empty. You need to run 'apt-file update' first.

I have done that, when I do it says:

File is up-to-date.
Ignoring source without Contents File:
a link they won't let me post

Or

File is up-to-date.
Downloading Index a link
No Index available.
Downloading complete file a link

I am still getting the same error when I try to run Psychonauts.

5 Answers

I could fix it with the help of a friend of mine.

Since the binary was of 32-bit, we could fix it with the following command:

sudo apt-get install libstdc++5:i386

Answered by Sankar Basu on December 10, 2021

I'll share with you the way that worked for me. First of all you should find if any other copy of this file is already on your machine:

$ locate libstdc++.so.6

the output:

/snap/core/6405/usr/lib/x86_64-linux-gnu/libstdc++.so.6
/snap/core/6405/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21
/snap/core/6405/usr/share/gdb/auto-load/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21-gdb.py
/snap/core/6531/usr/lib/x86_64-linux-gnu/libstdc++.so.6
/snap/core/6531/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21
/snap/core/6531/usr/share/gdb/auto-load/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21-gdb.py
/snap/core/6673/usr/lib/x86_64-linux-gnu/libstdc++.so.6
/snap/core/6673/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21
/snap/core/6673/usr/share/gdb/auto-load/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21-gdb.py
/usr/lib/x86_64-linux-gnu/libstdc++.so.6
/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.25
/usr/share/gdb/auto-load/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.25-gdb.py

As you can see there are many /snap/core/... versions of this file. (if not this method doesn't works for you)

The you should make a backup from the existing file:

$ sudo mv /usr/lib/x86_64-linux-gnu/libstdc++.so.6 /usr/lib/x86_64-linux-gnu/libstdc++.so.6.backup

Then you can replace the latest snap version into the corrupted file:

sudo cp /snap/core/6673/usr/lib/x86_64-linux-gnu/libstdc++.so.6 /usr/lib/x86_64-linux-gnu/libstdc++.so.6

The try running desired command again .

Answered by Saeed Falsafin on December 10, 2021

I think Psychonauts is a 32bit application. You will need to install:

apt-get install lib32stdc++6

Answered by jhilmer on December 10, 2021

You get the error message:

E: Unable to locate package libstdc++.so.6
E: Couldn't find any package by regex 'libstdc++.so.6'

because you tried to install a file libstdc++.so.6 that you can't install, because it is located in a debian package.

You can use apt-file to search for the package that contains that file. To install it, type:

sudo apt-get install apt-file

Then you have to update the index.

sudo apt-file update

After that, you can search for the package which contains the file libstdc++.so.6:

sudo apt-file find libstdc++.so.6

Then you find a lot packages that contains the searched file. In your case, the correct package is libstdc++6:

libstdc++6: /usr/lib/x86_64-linux-gnu/libstdc++.so.6

Then you can install the needed package:

sudo apt-get install libstdc++6

Answered by BuZZ-dEE on December 10, 2021

You are almost there, just used a few more characters than you needed:

sudo apt-get install libstdc++6

... should do the trick.

Answered by Braiam on December 10, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP