- How to fix: /usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.15′ not found
- «libstdc++.so.6: cannot open shared object file: No such file or directory»
- 5 Answers 5
- What are libstdc++.so.6 and GLIBCXX_3.4.20
- What is GCC?
- How to Install GCC on Linux?
- What is Libstdc++.so.6?
- How to Install Libstdc++.so.6 on Linux?
- What is GLIBCXX_3.4.20?
- Conclusion
- What is libstdc++ so 6 in Linux?
- What is the libstdc++.so.6 in Linux?
- Key Features of libstdc++.so.6:
- How to Install libstdc++6 in Linux?
- How to Uninstall libstdc++6 in Linux?
- Conclusion
How to fix: /usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.15′ not found
Here are some links which I found and tried, but none worked for me:
(My old question: I somehow got it fixed a few days after posting this question, but I can’t remember how exactly I did it)
I see some people fixed it by moving libstdc++(i think) to some directory and then pointing or linking idk what to that directory, but that just puzzled me.
(Edit:) — Running: strings /usr/lib/libstdc++.so.6 | grep GLIBC in terminal gives me: strings ‘/usr/lib/libstdc++.so.6’: No such file . Could that be the problem? And if so, how do I install this library?
(Edit2:) Anyone else know of a solution?
(Edit3) Still in need of a solution. is there a way to see on which distro a shared library was compiled on? I know I once compiled this same library a while ago, but can’t remember!!
(Edit4) ldd my_lib_.so gives me:
linux-gate.so.1 => (0xb77d7000) libstdc++.so.6 => /usr/lib/i386-linux-gnu/libstdc++.so.6 (0xb76c1000) libgcc_s.so.1 => /lib/i386-linux-gnu/libgcc_s.so.1 (0xb76a4000) libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb74fa000) libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xb74ce000) /lib/ld-linux.so.2 (0xb77d8000)
ldd program_im_loading_so_into gives me:
linux-gate.so.1 => (0xb77d8000) libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xb77c0000) libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xb77a5000) libstdc++.so.6 => /usr/lib/i386-linux-gnu/libstdc++.so.6 (0xb76bb000) libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xb768f000) libgcc_s.so.1 => /lib/i386-linux-gnu/libgcc_s.so.1 (0xb7672000) libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb74c9000) /lib/ld-linux.so.2 (0xb77d9000)
running strings /usr/lib/i386-linux-gnu/libstdc++.so.6 | grep GLIBCXX gives me:
GLIBCXX_3.4 GLIBCXX_3.4.1 GLIBCXX_3.4.2 GLIBCXX_3.4.3 GLIBCXX_3.4.4 GLIBCXX_3.4.5 GLIBCXX_3.4.6 GLIBCXX_3.4.7 GLIBCXX_3.4.8 GLIBCXX_3.4.9 GLIBCXX_3.4.10 GLIBCXX_3.4.11 GLIBCXX_3.4.12 GLIBCXX_3.4.13 GLIBCXX_3.4.14 GLIBCXX_3.4.15 GLIBCXX_3.4.16 GLIBCXX_3.4.17 GLIBCXX_3.4.18 GLIBCXX_3.4.19 GLIBCXX_DEBUG_MESSAGE_LENGTH
and finally here’s my gcc version:
`gcc version 4.6.4 (Ubuntu/Linaro 4.6.4-1ubuntu1~12.04)`
«libstdc++.so.6: cannot open shared object file: No such file or directory»
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
$ 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.
File is up-to-date. Ignoring source without Contents File: a link they won't let me post
File is up-to-date. Downloading Index a link No Index available. Downloading complete file a link
5 Answers 5
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.
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
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.
Run sudo apt-file update and after that sudo apt-file find libstdc++.so.6 . Read above answer exactly.
Not sure what I did differently, but it apt-file find worked this time. I get the list of packages. When I try to install it says libstdc++6 is already the newest version. When I try to ./Psychonauts it still says no such file or directory.
And if you’re messing around with 32-bit hardware, make sure to specify at the end: sudo apt-get install libstdc++6:i386
I think Psychonauts is a 32bit application. You will need to install:
apt-get install lib32stdc++6
You are almost there, just used a few more characters than you needed:
sudo apt-get install libstdc++6
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:
/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 .
What are libstdc++.so.6 and GLIBCXX_3.4.20
GNU Compiler Collection or GCC is a free and open-source compiler system. It was developed by the GNU Project, which supports a wide range of programming languages, including C, C++, Objective-C, and many others. The libstdc++.so.6 is a shared library, a collection of classes, functions, and algorithms to simplify the development of C++ applications. The GLIBCXX_3.4.20 is a version symbol used in the C++ standard library, which is libstdc++.so.6.
This guide explains the libstdc++.so.6 and GLIBCXX_3.4.20.
- GCC
- Install GCC on Linux
- Libstdc++.so.6
- Install Libstdc++ .so.6
- GLIBCXX_3.4.20
What is GCC?
The GNU Compiler Collection (GCC) is an open-source compiler system created by the GNU Project. It supports a wide range of programming languages, including C, C++, Objective-C, and others. It is typically used to convert source code into executable code. GCC includes several tools for compiling, linking, debugging, and optimizing software. It is widely used in the software development industry to create programs, libraries, and operating systems.
How to Install GCC on Linux?
The GCC comes in the build-essential package, which can be installed using these commands:
$ sudo apt install build-essential #Ubuntu/Debian $ sudo dnf install build-essential #Fedora $ sudo yum install build-essential #CentOS
The above command shows the installation of GCC on Ubuntu 22.04 LTS.
What is Libstdc++.so.6?
Libstdc++.so.6 is a critical shared library that implements the GLIBCXX_3.4.20 and other versions. It is used by many compilers and applications built using C++. It contains commonly used functions, classes, and algorithms for containers, iterators, and algorithms. This library is portable and compatible with various systems and platforms.
How to Install Libstdc++.so.6 on Linux?
The “libstdc++6” is included in the official repositories of all distributions of Linux and is installed using these commands:
$ sudo apt install libstdc++6 #Ubuntu/Debian $ sudo yum install libstdc++.so.6 #CentOS $ sudo dnf install libstdc++ #Fedora
The above figure shows the installation of “libstdc++6” on Ubuntu 22.04 LTS and here is a detailed guide on it.
What is GLIBCXX_3.4.20?
GLIBCXX_3.4.20 is a version of the C++ Standard Library included in the GNU C Library (glibc) that provides new features and enhancements over earlier versions. It was released with GCC 4.8 and features improvements such as move semantics support, range-based for loops, and variadic templates.
Applications and programs are written with GCC 4.8 or later that utilize functionality available exclusively in GLIBCXX_3.4.20 or later will require this library version to be present at runtime. To execute the program correctly, the system must have a compatible version of the libstdc++.so.6 shared libraries containing GLIBCXX_3.4.20.
Note: Since it is a library, there is no need to install it as it comes with libstdc++.so.6 whose installation is mentioned above.
Conclusion
GCC is a popular open-source compiler system widely used in software development to create programs, libraries, and operating systems. Libstdc++.so.6 is a crucial shared library used by many compilers and C++ applications, containing functions, and algorithms. GLIBCXX_3.4.20 is a version of the C++ Standard Library that is required for programs utilizing its exclusive functionality. Therefore, these tools play a vital role in the development and execution of C++ programs, making them essential components of the software development process.
This guide has explained the libstdc++.so.6 and GLIBCXX_3.4.20.
TUTORIALS ON LINUX, PROGRAMMING & TECHNOLOGY
What is libstdc++ so 6 in Linux?
libstdc++.so.6 is a shared library that is part of the GNU Standard C++ Library. It implements the standard C++ library functions and classes, such as std::string, std::vector, and std::map.
This library contains the basic information of the GCC compiler, like the version details.
This post will elaborate on the basic introduction of Linux’s “libstdc++.so.6”.
- What is the libstdc++.so.6 in Linux?
- Key Features of libstdc++.so.6:
- Install the libstdc++6 in Linux
- Uninstall libstdc++6 in Linux
What is the libstdc++.so.6 in Linux?
The “libstdc++” helps to transform the C++ code into the machine language, which can be read and understood by the computer and perform the specified operation.
Key Features of libstdc++.so.6:
Some key features of libstdc++.so.6 are listed below:
- Implements the C++ Standard Library per the ISO standards.
- Ensures the primary functions such as input/output streams, standard classes, and functions.
- Dynamic Linking enables the latest version of the libstdc++.so.6 is being used.
- Optimized implementation of the standard data structures and algorithms.
- Regularly updated to have the updated version of the library.
How to Install libstdc++6 in Linux?
The “libstdc++6” package is included in the repository of various Linux distributions when they are installed on the computer. For the installation of libstdc++6, we have to follow the steps:
Step 1: Update the Packages
First, update all the Linux packages to their latest releases:
In other Linux distributions, the package can be updated using the command:
CentOS-based Linux OS | $ sudo yum update |
Fedora-based Linux OS | $ sudo dnf update |
Step 2: Install libstdc++6
Next, install the package of libstdc++6 with the apt package manager:
$ sudo apt install libstdc++6 -y
In other Linux distributions, it can be installed using the commands:
CentOS-based Linux OS | $ sudo yum install libstdc++.so.6 |
Fedora-based Linux OS | $ sudo dnf install libstdc++ |
How to Uninstall libstdc++6 in Linux?
If you are using Ubuntu-based Linux OS and want to delete the “libstdc++6” with all its configuration files:
From the figure, we can see that many other packages like “apt” depends on “libstdc++6” (lib-apt)
If you are using the Fedora-based or CentOS-based Linux distributions then use the commands:
CentOS-based Linux OS | $ sudo yum remove libstdc++.so.6 |
Fedora-based Linux OS | $ sudo dnf -y remove libstdc++ |
Conclusion
The “libstdc++6” is a dependency package of the GCC compiler, and “libstdc++.so.6” is the symbolic link that points to the GCC path. The “libstdc++” package is a dependency package of “GCC” and other packages like an apt package manager. In this blog, information about the “libstdc++6” package has been explored, and its installation method has been explored for Linux distributions.