version `GLIBCXX_3.4.26' not found even though libstdc++.so.6 recent enough

I realize there are many questions like this, but the difference from the others is that my libstdc++.so.6 actually does appear to be up to date enough (see below for the strings it exports). This is an error that comes up when trying to load a dynamic library that i just compiled myself. apt-get upgrade and the like tell me libstdc++.so.6 already is up to date (on version libstdc++6 is already the newest version (9.1.0-2ubuntu2~18.04)).

Full error i get when loading this library (in MATLAB R2019a):

'/home/dee/git_repos/Titta/TobiiMex/TobiiMex_matlab/64/TobiiMex_matlab.mexa64':
/usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.26' not found (required by
/home/dee/git_repos/Titta/TobiiMex/TobiiMex_matlab/64/TobiiMex_matlab.mexa64)

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

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
GLIBC_2.2.5
GLIBC_2.3
GLIBC_2.14
GLIBC_2.6
GLIBC_2.4
GLIBC_2.18
GLIBC_2.16
GLIBC_2.3.4
GLIBC_2.17
GLIBC_2.3.2
GLIBCXX_DEBUG_MESSAGE_LENGTH

What can i try to fix this?


Solution 1:

Search for other versions of libstdc++.so.6 in your system. You are probably picking up an older version of the dynamic lib.

Solution 2:

may export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/x86_64-linux-gnu/ help?

Solution 3:

Installing libstdc++6 and gcc-9 helped me. Hope it will help you too.

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