4

I am using Matlab for ubuntu R2014a and I am not able to run a code because I get the following error

/usr/local/MATLAB/R2014a/bin/glnxa64/../../sys/os/glnxa64/libstdc++.so.6:version 'GLIBCXX_3.4.21' not found

when I run:

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

Here you can see that I have GLIBCXX_3.4.21 but then also I get the error!

8

Actually I figured out what was wrong, as my system was GCC 5.2.1,

the file /usr/local/MATLAB/R2014a/bin/glnxa64/../../sys/os/glnxa64/libstdc++.so.6 was designed for GCC 4.4.X so Matlab was actually picking the wrong file. I just made a symbolic link to my system's libstdc++.so.6 using this on terminal -

ln -s /usr/lib/x86_64-linux-gnu/libstdc++.so.6 /usr/local/MATLAB/R2014a/bin/glnxa64/../../sys/os/glnxa64/libstdc++.so.6

4

It looks like /usr/local/MATLAB/R2014a/bin/glnxa64/../../sys/os/glnxa64/libstdc++.so.6 is missing the glibc version and not /usr/lib/x86_64-linux-gnu/libstdc++.so.6. Now Matlab first tries the libstdc++.so.6 in the Matlab path and fails.

From a post from mathworks the following should work to start matlab with the system libstdc++.so.6

LD_PRELOAD="/usr/lib/x86_64-linux-gnu/libstdc++.so.6" matlab
  • The link is dead, and when clicking through to the Google Groups, that's dead as well (no results found). Solution still works though. – Adriaan Mar 22 at 15:16
0

The link from @Thomas is available in the WayBack machine but this didn't work for me as I'm missing GLIBCXX_3.4.22 which judging by strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBC is actually missing. I fixed this by following these steps (also here):

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.