133

Whey I try to run the program Layout Editor (available on this site) on Ubuntu 14.04.1 64-bit LTS I get the following output in the terminal:

$ layout
layout: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by layout)

I tried the command strings on /usr/lib/x86_64-linux-gnu/libstdc++.so.6 as following and here is the input and the output:

$ 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_DEBUG_MESSAGE_LENGTH

How can I resolve this issue I somehow guess that it is related with GCC but cannot figure out how to fix the problem. Furthermore, I have tried a PPA as suggested on How do I use the latest GCC on Ubuntu? and there is a similar question for an older version of Ubuntu at GLIBCXX_3.4.15 not found. However, after I ran sudo update I get numerous warnings and the list I obtained with the strings command did not have new entries after installing gcc 4.9, so I purged the PPA(Toolchains Test Builds) with ppa-purge. Any help, suggestions on how to proceed are greatly appreciated.

Vesnog
  • 2,223
  • 4
  • 21
  • 33
  • Found a solution already? – Steven Roose Feb 05 '15 at 01:48
  • 1
    @StevenRoose I was able to solve the problem, after adding some backports and installing some software but I do not remember the details clearly when I remember them I will post them as an answer. – Vesnog Feb 05 '15 at 09:40
  • It seems that this is an effect of symbol linking: http://stackoverflow.com/questions/2856438/how-can-i-link-to-a-specific-glibc-version You simply aren't linking to a library version recent enough. – Ciro Santilli OurBigBook.com May 14 '15 at 12:10
  • Possible duplicate of [/usr/lib/i386-linux-gnu/libstdc++.so.6: version \`GLIBCXX\_3.4.19' not found](http://askubuntu.com/questions/306467/usr-lib-i386-linux-gnu-libstdc-so-6-version-glibcxx-3-4-19-not-found) – user9869932 Sep 23 '16 at 16:32

9 Answers9

122

I was having the same problem when trying to run other program, and found a solution on StackOverflow.

Basically, just do the following commands: Firstly, install:

sudo apt-get install libstdc++6

This should already be installed by default, but try it anyway. If it doesn't solve it, just do the following:

sudo add-apt-repository ppa:ubuntu-toolchain-r/test 
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade

I didn't perform the "dist-upgrade" command, but the ones before solved it for me

Paulo
  • 1,244
  • 1
  • 9
  • 2
  • I think this was the solution I found after adding the repositories first, thanks for the answer. – Vesnog Feb 08 '15 at 12:13
  • 9
    sudo apt-get dist-upgrade solved my problem – ady Sep 03 '15 at 23:22
  • 2
    problem solved without the need for `dist-upgrade` as `upgrade` proposed and updated my system with the latest `libstdc++` – arainone Apr 01 '16 at 22:17
  • 2
    repository addition, 'update' and a 'dist-upgrade' were all needed on my end. – virtualxtc Jan 09 '17 at 20:33
  • 7
    after the update you can check the latest version of GLIBCXX as `strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBCXX` – Krishan Kumar Mourya Oct 06 '17 at 20:37
  • 2
    Ubuntu 16.04: In Nov. 2017, adding the 'untrusted, and unsupported' [ppa:ubuntu-toolchain-r/test](https://launchpad.net/~ubuntu-toolchain-r/+archive/ubuntu/test) via add-`apt-repository` updated `/usr/lib/x86_64-linux-gnu/libstdc++.so.6` up to and including GLIBCXX_3.4.24 -- and besides, this updates basicall ALL c/c++/fortran development tools on your machine – knb Nov 16 '17 at 08:42
  • What if I'm not root? I'm on a user on a cluster that someone else set up and runs... so I can't use sudo apt-get or even just apt-get in the case of libdistc++.so.6... – Tanner Strunk Mar 14 '18 at 05:43
  • Ubuntu 16.04 and Filezilla 3.32: same story, works after dist-upgrade. – D.Bugger Apr 29 '18 at 16:10
  • 1
    Without adding that extra repository I only got up to 3.4.21 installed and an app I was installing required 3.4.22 With that repo I now have up to 3.4.25 – Davos May 14 '18 at 05:21
  • "sudo apt-get install libstdc++6" and installing gcc-9 helped me. Thanks. – WesternGun Mar 30 '21 at 14:53
  • for my case, i have to execute "apt-get install software-properties-common" first – SalutonMondo Jun 28 '21 at 06:25
  • Solid answer, still working on Ubuntu 20.04.3. Cheers! – Waldir Leoncio Sep 09 '21 at 06:48
  • DONT FORGET to open a new terminal session after or your env will not be updated. – ldgorman Jun 10 '22 at 14:12
69

It happened to me with anaconda 4.0.0 (as @mjp stated), but the fix for me was to run this command in my environment:

conda install libgcc
muru
  • 193,181
  • 53
  • 473
  • 722
t-bltg
  • 963
  • 8
  • 12
18

I had this issue - it was because Anaconda2 didn't have the GLIBCXX_3.4.20 version of whatever that thing is. Only up to .19, the same as yours.

However, Ubuntu's library did have it. So I just created a softlink/shortcut in the Anaconda library to the actual Linux library containing that GLIBCXX_3.4.20, replacing the previous one, and it worked fine after restarting the python GUI (Spyder).

There should be a folder called libstdc++.so.6 in the Anaconda library, which is here: ~/anaconda2/lib. Within this folder is the versions of the script/library-code-thing, excluding the one that you're missing: GLIBCXX_3.4.20

Follow these steps to solve the issue:

  1. go to the right location and backup your current anaconda2 shortcut (change its name so it isn't overwritten):

    cd ~/anaconda2/lib
    mv -vf libstdc++.so.6 libstdc++.so.6.old
    
  2. create a new shortcut using the ln command (I am assuming that I am in the previous location ~/anaconda2/lib):

    ln -s /usr/lib/x86_64-linux-gnu/libstdc++.so.6 ./libstdc++.so.6
    
  3. restart spyder / other interface you use

It should now work!

Danibix
  • 2,047
  • 2
  • 18
  • 27
mjp
  • 429
  • 4
  • 9
8

I solved problem like this (but GLIBCXX_3.4.21) on CentOS but it is not dependent from os. The library is part of gcc compiler so need to install or compile appropriate version of gcc. This is table of versions of gcc and versions of appropriate libstdc++:

GCC 4.9.0: libstdc++.so.6.0.20
GCC 5.1.0: libstdc++.so.6.0.21
GCC 6.1.0: libstdc++.so.6.0.22
GCC 7.1.0: libstdc++.so.6.0.23
GCC 7.2.0: libstdc++.so.6.0.24
GCC 8.0.0: libstdc++.so.6.0.25

( full list of versions is here )

It is not dependent from how to install gcc - it may be installed from package or compiled and installed from sources.

It is possible that system gcc libraries is available instead of newely installed. So need to specify environment variable where to find libraries for example in command line like this:

$ LD_LIBRARY_PATH=/usr/local/lib64 command args ...
oklas
  • 181
  • 2
  • 4
  • 2
    I fixed this permanently by updating the link `/usr/lib64/libstdc++.so.6` to point to the newer version I had at `/usr/local/lib64/libstdc++.so.6` with this command: `ln -fs /usr/local/lib64/libstdc++.so.6 /usr/lib64/libstdc++.so.6`. The old version remains with no link pointing to it if you need to revert. A bit of a hack but it works. – Matthew Aug 22 '19 at 20:44
3

Before installing:

This workaround is required to avoid libstdc++ errors while running "extended" hugo with SASS support.

wget -q -O libstdc++6 http://security.ubuntu.com/ubuntu/pool/main/g/gcc-5/libstdc++6_5.4.0-6ubuntu1~16.04.10_amd64.deb
sudo dpkg --force-all -i libstdc++6

Installation:

wget -q -O hugo.deb https://github.com/gohugoio/hugo/releases/download/v0.46/hugo_extended_0.46_Linux_64bit.deb
sudo dpkg -i hugo.deb

I found this solution here on the Hugo support forum

Zanna
  • 69,223
  • 56
  • 216
  • 327
2

I've had that numerous times through out the years with many different packages. It has always been resolved by:

sudo apt-get dist-upgrade

If your dist is upgradable, it will almost always bring down a new C++ library and reconfig things such as that they work again. The issue is almost always caused by your system not pointing to the right library. In my case, usually caused by pointing to a cross-compiler version of a library.

ar2015
  • 397
  • 8
  • 19
1

I had the same issue while installing Ubuntu 18.04 in Virtualbox with the live-server image. I'm not sure what I did wrong but got the same error

"apt-get: symbol lookup error: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: undefined symbol: , version GLIBCXX_3.4.11"

I was using 64-bit and had to download this file by using

wget http://security.ubuntu.com/ubuntu/pool/main/g/gcc-8/libstdc++6_8.4.0-1ubuntu1~18.04_amd64.deb

and installed using dpkg -i. Then everything runs normal with APT.

Then did an apt-get upgrade to make sure all is well.

Kulfy
  • 17,416
  • 26
  • 64
  • 103
1
sudo cp /usr/bin/YourGccVersionLibrary/lib64/libstdc++.so.6 /usr/bin/YourGccVersionLibrary/lib64/libstdc++.so.6.0.20 /usr/lib/x86_64_linux-gnu/
David Foerster
  • 35,754
  • 55
  • 92
  • 145
Mati
  • 19
  • 1
  • 5
    Welcome to Ask Ubuntu! I recommend [edit]ing this answer to expand it with specific details about what this command is supposed to achieve. (See also [How do I write a good answer?](/help/how-to-answer) for general advice about what sorts of answers are considered most valuable on Ask Ubuntu.) – David Foerster Nov 11 '15 at 21:47
  • 7
    Why `cp` and not `ln -s`? – A.B. Nov 12 '15 at 08:01
0

This worked for me (even for newer glibcxx such as GLIBCXX_3.4.29)

sudo add-apt-repository ppa:ubuntu-toolchain-r/test

sudo apt upgrade libstdc++6

water stone
  • 418
  • 2
  • 5
  • 14