/lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by ./test)
50 views (last 30 days)
Show older comments
Hello all, My server is currently running CentOS linux. I compiled a test Matlab script using the following command:
>> mcc -m test.m
This generated an executable file called "test".
I defined the LD_LIBRARY_PATH as follows since I was getting errors:
$ export LD_LIBRARY_PATH="/usr/local/MATLAB/R2017a/bin/glnxa64:$LD_LIBRARY_PATH";
$ export LD_LIBRARY_PATH="/usr/local/MATLAB/R2017a/runtime/glnxa64:$LD_LIBRARY_PATH"
But now, when I try to execute the test script I get a whole bunch of errors. Below are the first few errors:
./test: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by ./test)
./test: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/local/MATLAB/R2017a/bin/glnxa64/libmwlaunchermain.so)
./test: /lib64/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /usr/local/MATLAB/R2017a/bin/glnxa64/libmwlaunchermain.so)
./test: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/local/MATLAB/R2017a/bin/glnxa64/libmwcpp11compat.so)
I tried making a symoblic link as suggested from someone with similar problems but it did not help
$ sudo ln -s /usr/lib64/libstdc++.so.6 ./libstdc++.so.6
I also tried the following:
$ sudo yum install glibc
$ sudo yum install gcc
$ sudo yum install libgcc
$ sudo yum update
$ sudo yum upgrade
But nothing worked.
The strings command gives the following output:
$ strings /usr/lib64/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
GLIBC_2.3
GLIBC_2.2.5
GLIBC_2.14
GLIBC_2.4
GLIBC_2.3.2
GLIBCXX_DEBUG_MESSAGE_LENGTH
Any help would be appreciated. Thanks in advance. Ken
0 Comments
Answers (2)
Rahul Goel
on 23 Oct 2017
It appears that your application is still picking the libstdc++.so.6 from /lib64/ folder instead of the one shipped by MCR. It can be due to multiple resons(like LD_LIBRARY_PATH not being correctly set.). Do the following on the linux prompt to determine the location of libstdc++ your application is currently pointing to and change the LD_LIBRARY_PATH accordingly to let it pick from the MCR:
% ldd test | grep libstdc++
David Sambell
on 30 Jan 2023
Edited: David Sambell
on 30 Jan 2023
I found the strings command incredibly useful in identifying which libstdc++ shared objects contained the GLIBC versions needed. What I came to realise was there are two separate environments to consider: the build environment in which the target was built (provided by cmake in my case), and the runtime environment defined by MATLAB. It seems the build environment was using a later version of libstdc++, obtained from /usr/lib64, than what MATLAB was loading at runtime, obtained from /usr/local/MATLAB/R2019a/sys/os/glnxa64. Hence the solution for my problem became trivial: update the symbolic link in glnxa64 to use the library in lib64 (cd into glnxa64; sudo ln -s /usr/lib64/libstdc++.so.6.0.30 libstdc++.so.6).
0 Comments
See Also
Categories
Find more on Test Execution in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!