Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where can I find GLIBCXX_3.4.29?

Tags:

c++

gcc

libstdc++

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?

like image 981
James Smith Avatar asked Dec 17 '20 23:12

James Smith


1 Answers

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)

like image 125
Вовка Avatar answered Sep 18 '22 11:09

Вовка