Where can I find GLIBCXX_3.4.29?
Asked Answered
J

10

58

I updated my GCC compiler from the GIT repo to version 11. Now my test code (GoogleTest/GoogleMock) is complaining about GLIBCXX_3.4.29 not being found. This is not a duplicate please reopen The answers posted in: Understanding the gcc version and the GLIBC, GLIBCXX versions in more detail (2 answers) doesn't answer the question.

Linker error is:

/usr/lib/x86_64-linux-gnu/libstdc++.so.6: version GLIBCXX_3.4.29 not found

The output of strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBCXX

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_3.4.20
GLIBCXX_3.4.21
GLIBCXX_3.4.22
GLIBCXX_3.4.23
GLIBCXX_3.4.24
GLIBCXX_3.4.25
GLIBCXX_3.4.26
GLIBCXX_3.4.27
GLIBCXX_3.4.28
GLIBCXX_DEBUG_MESSAGE_LENGTH

Where can I find 3.4.29?

Jestude answered 17/12, 2020 at 23:39 Comment(8)
I did find tarballs here: ftp.gnu.org/gnu/glibcJestude
I found the answer to my question and posting it here: The problem was caused by the GCC source code build/make install not installing the GLIBCXX_3.4.29 shared library. The GLIBCXX_3.4.29 library was placed under my GCC build directory.Jestude
I fixed the problem by pointing the soft link to the latest GLIBCXX version 3.4.29. Still I would like to know why the GCC make install didn't install the library.Jestude
After soft-link to GLIBCXX 3.4.29: strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBCXX 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_3.4.20 GLIBCXX_3.4.21 GLIBCXX_3.4.22 GLIBCXX_3.4.23 GLIBCXX_3.4.24 GLIBCXX_3.4.25 GLIBCXX_3.4.26 GLIBCXX_3.4.27 GLIBCXX_3.4.28 GLIBCXX_3.4.29 GLIBCXX_DEBUG_MESSAGE_LENGTHJestude
The question is a duplicate. Once you understand the relationship of GCC version to GLIBCXXX_... it is trivial to deduce that you updated GCC without updating libsdtd++.Lycanthrope
@Employed Russian I apologize for the confusion and appreciate the comment.Jestude
@Employed Russian The question was "Where can I find 3.4.29?" even before I made the modification to the original post. I didn't ask about the cause of the linker error, that was obvious.Jestude
For people trying to use Manim: If you're receiving this error, ignore it - the video file was created but you do not have a default player installed.Derisible
J
20

After building GCC and installing the binaries, the softlink /usr/lib/x86_64-linux-gnu/libstdc++.so.6 wasn't updated to the latest version. Mine was still pointing to a previous version as mentioned in the comments above. Under GCC build directory I found the GLIBCXX_3.4.29 build directory and copied the library to /usr/lib/x86_64-linux-gnu and updated the softlink.

Jestude answered 20/12, 2020 at 20:57 Comment(4)
Most likely make install installed libstdc++.so. into /usr/local/lib, which isn't appropriate for your system.Lycanthrope
Yes, it created /usr/local/lib64 directory.Jestude
Interesting. On my system I don't have libstdc++ under x86_64-linux-gnu* (I hate that name by the way... don't know why it can't just simplify into /usr/lib/ as-is). I compiled the most recent gcc from source, and it works, but some old binaries seem to look for a less recent libstdc++. To me this is quite confusing right now. (I did, however had, use another prefix than /usr/ so perhaps this is one reason why my system is confused. It's even stranger because I can compile everything right now, only some programs can not find the proper GLIBCXX it seems.)Eldreeda
"... and updated the softlink." - that last bit is (part of) what we have ldconfig for.Kristinkristina
Y
34
sudo add-apt-repository ppa:ubuntu-toolchain-r/test # Ignore if not ubuntu

sudo apt-get update

sudo apt-get install gcc-4.9

sudo apt-get upgrade libstdc++6

After this is complete, make sure to run the following:

sudo apt-get dist-upgrade

Also, make sure to confirm the necessary dependencies are installed for the right GLIBCXX version.

strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBCXX

Also try the Quick Solution by @bobka

export LD_LIBRARY_PATH=/usr/local/lib64:$LD_LIBRARY_PATH # add to ~/zshrc OR bashrc whatever
Yardarm answered 4/2, 2022 at 17:46 Comment(2)
Did not work for me on Debian 11Emmett
Does one have to upgrade distro just for this?Terbecki
J
20

After building GCC and installing the binaries, the softlink /usr/lib/x86_64-linux-gnu/libstdc++.so.6 wasn't updated to the latest version. Mine was still pointing to a previous version as mentioned in the comments above. Under GCC build directory I found the GLIBCXX_3.4.29 build directory and copied the library to /usr/lib/x86_64-linux-gnu and updated the softlink.

Jestude answered 20/12, 2020 at 20:57 Comment(4)
Most likely make install installed libstdc++.so. into /usr/local/lib, which isn't appropriate for your system.Lycanthrope
Yes, it created /usr/local/lib64 directory.Jestude
Interesting. On my system I don't have libstdc++ under x86_64-linux-gnu* (I hate that name by the way... don't know why it can't just simplify into /usr/lib/ as-is). I compiled the most recent gcc from source, and it works, but some old binaries seem to look for a less recent libstdc++. To me this is quite confusing right now. (I did, however had, use another prefix than /usr/ so perhaps this is one reason why my system is confused. It's even stranger because I can compile everything right now, only some programs can not find the proper GLIBCXX it seems.)Eldreeda
"... and updated the softlink." - that last bit is (part of) what we have ldconfig for.Kristinkristina
U
11

Quick solution

Run export LD_LIBRARY_PATH=/usr/local/lib64:$LD_LIBRARY_PATH before building your project to fix the linkage issue. Consider adding this line into ~/.bashrc to make it permanent

Answer to the question

Where can I find 3.4.29?

When you were installing gcc from source, i.e. running sudo make install, you could have seen a message like this:

Libraries have been installed in:
   /usr/local/lib/../lib64

Hence, the desired GLIBCXX version is contained in /usr/local/lib64/libstdc++.so.6 (which is a symlink to libstdc++.so.6.0.29, actually). You can verify this by running strings /usr/local/lib64/libstdc++.so.6 | grep GLIBCXX_3.4.29

Solution explanation

Though you can update symlinks manually, I don't think it is a safe and recommended way. GCC suggest the following options, which are printed just in the same message during installation:

If you ever happen to want to link against installed libraries in a given directory, LIBDIR, you must either use libtool, and specify the full pathname of the library, or use the `-LLIBDIR' flag during linking and do at least one of the following:

  • add LIBDIR to the `LD_LIBRARY_PATH' environment variable during execution
  • add LIBDIR to the `LD_RUN_PATH' environment variable during linking
  • use the `-Wl,-rpath -Wl,LIBDIR' linker flag
  • have your system administrator add LIBDIR to `/etc/ld.so.conf'

Personally, I found modifying LD_LIBRARY_PATH the most convenient way (see Quick Solution above)

Urgent answered 24/12, 2021 at 3:4 Comment(0)
S
6

When I ran

strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBCXX

I clearly could see GLIBCXX_3.4.29

When I did a search for

find / -name "libstdc++.so*"

It came back many paths - but specifcally my torch conda environment had a duplicate...

/home/jp/miniconda3/envs/torch/lib/libstdc++.so
/home/jp/miniconda3/envs/torch/lib/libstdc++.so.6.0.21
/home/jp/miniconda3/envs/torch/lib/libstdc++.so.6.0.28
/home/jp/miniconda3/envs/torch/lib/libstdc++.so.6

I simply removed the extra file

sudo rm /home/jp/miniconda3/envs/torch/lib/libstdc++.so.6.0.21

and now things started working again (for now).

Segura answered 9/8, 2021 at 1:20 Comment(2)
strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBCXX if you can see your version with this command and have the anaconda environment... try this solution. Worked for me and saved my butt (it was around 3 hours I was sitting to solve this problem). Many thanks to @SeguraClosehauled
I couldn't see GLIBCXX_3.4.29 but I did see an extra libstdc++.so.6... file, deleting the extra file magically got the code to run. I don't what this did, but it worked!Savina
P
2

If you're trying to build a Dockerfile, I ended up switching from ubuntu:20.04 to ubuntu:22.04 as base image to get the correct GLIBCXX_ version.

Personalty answered 25/4, 2023 at 13:43 Comment(1)
This of course works but it's worth noting that by doing this one can no longer run software built with the new gcc on ubuntu 20.04. If it's a requirement for you to be able to run on older systems then unfortunately this does not work.Ostler
V
1

I went to /usr/lib/x86_64-linux-gnu/ folder, copied libstdc++.so.6.0.29 and pasted it to /home/xx/anaconda3/bin/ and /home/xx/anaconda3/lib and it worked.

Valora answered 14/6, 2022 at 19:57 Comment(0)
G
1

Short answer is, I resolved it by exporting the path.

I had the same error. My case is special since I'm using a shared GPU, which restricts my ability to make modifications to the Conda packages associated with the Conda that is running. However, I do have the capability to install my own packages and export the paths. When I execute Python, it looks in the default Conda path (the path where I don't have write priviledge) rather than the path that I installed these packages.

First I found the libstdc++.so.6.xxxx

find /home/liang142 -name "libstdc++.so*"

It's going to return a list

/home/liang142/.conda/pkgs/libgcc-5.2.0-0/lib/libstdc++.so
/home/liang142/.conda/pkgs/libgcc-5.2.0-0/lib/libstdc++.so.6
/home/liang142/.conda/envs/cent7/2020.11-py38/myenv/x86_64-conda-linux-gnu/lib/libstdc++.so
/home/liang142/.conda/envs/cent7/2020.11-py38/myenv/x86_64-conda-linux-gnu/lib/libstdc++.so.6
/home/liang142/.conda/envs/cent7/2020.11-py38/myenv/x86_64-conda-linux-gnu/lib/libstdc++.so.6.0.29

Then I found a version of libstdc++.so.6.xxxx that contain the GLIBCXX_3.4.29 package

strings /home/liang142/.conda/envs/cent7/2020.11-py38/myenv/lib/libstdc++.so.6.0.32 | grep GLIBCXX_3.4.29

Then I just export the path of that specific library (libstdc++.so.6.0.32 for my case)

export LD_LIBRARY_PATH=/home/liang142/.conda/envs/cent7/2020.11-py38/myenv/lib/:$LD_LIBRARY_PATH

Geraldina answered 23/9, 2023 at 3:28 Comment(0)
A
0

Here's is the approach that helped me is as follow:
OS:Ubuntu 23.10,
Dlib version: 19.24.2,
I am manually replacing the files temporary unitl this issue get's solved by Dlib
Start with:
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt install -y g++-11
After this enter command:
strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBCXX

This will display all the string in the link|so file
If we see our version i.e. GLIBCXX_3.4.29
Then we can go to the path /usr/lib/x86_64-linux-gnu/ using command
cd /usr/lib/x86_64-linux-gnu/
We can now open the folder usign the command
xdg-open .
Once the UI pops up find the file libstdc++.so.6 using search
In my case I got two files

  1. libstdc++.so.6
  2. libstdc++.so.6.0.32
    I copied them both to the path /anaconda3/envs/my_eny/lib and the files were replaced and working fine

Again to open the folder I used cd follwed by xdg-open .

OR

You can also create a symbolic link to the files in the x86_64-linux-gnu location
using command

ln source destination

Sharing this as it might help someone
Thank you for the opportunity

Arbitrage answered 29/11, 2023 at 11:48 Comment(0)
I
0

I had a problem running deepspeed that presented the same on a sagemaker. eventually found it on a different path strings /usr/local/lib64/libstdc++.so.6.0.29 | grep GLIBCXX_3.4.29 then updated the LD_LIBRARY_PATH to include /usr/local/lib64/libstdc and it solved the problem. hopefully this could save someone else the time

Indict answered 30/4 at 23:55 Comment(0)
S
0

It worked perfectly for me:

sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt update
sudo apt install -y g++-11

Then check if the version appears in the list:

strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBCXX
Silvanasilvano answered 1/5 at 16:34 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.