libstdc++.so.6: version `GLIBCXX_3.4.20' not found

Here's a solution for this problem in Ubuntu 16.04

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-4.9
sudo apt-get upgrade libstdc++6

You can check if you get GLIBCXX desired version like this:

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

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 ...