/lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by ./test)

34 views (last 30 days)
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

Answers (2)

Rahul Goel
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++
  1 Comment
Kenneth Watanabe
Kenneth Watanabe on 24 Oct 2017
I ran "ldd test | grep libstdc+" and got the following output:
ldd test | grep libstdc+
./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)
./test: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/local/MATLAB/R2017a/bin/glnxa64/libmwi18n.so)
./test: /lib64/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /usr/local/MATLAB/R2017a/bin/glnxa64/libmwi18n.so)
./test: /lib64/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /usr/local/MATLAB/R2017a/bin/glnxa64/libmwservices.so)
./test: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/local/MATLAB/R2017a/bin/glnxa64/libmwservices.so)
./test: /lib64/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /usr/local/MATLAB/R2017a/bin/glnxa64/libboost_filesystem.so.1.56.0)
./test: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/local/MATLAB/R2017a/bin/glnxa64/libboost_filesystem.so.1.56.0)
./test: /lib64/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /usr/local/MATLAB/R2017a/bin/glnxa64/libicuuc.so.56)
./test: /lib64/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /usr/local/MATLAB/R2017a/bin/glnxa64/libicui18n.so.56)
./test: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/local/MATLAB/R2017a/bin/glnxa64/libut.so)
./test: /lib64/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /usr/local/MATLAB/R2017a/bin/glnxa64/libut.so)
./test: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/local/MATLAB/R2017a/bin/glnxa64/libmwfl.so)
./test: /lib64/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /usr/local/MATLAB/R2017a/bin/glnxa64/libmwfl.so)
./test: /lib64/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /usr/local/MATLAB/R2017a/bin/glnxa64/libmx.so)
./test: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/local/MATLAB/R2017a/bin/glnxa64/libmwlivecode.so)
./test: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/local/MATLAB/R2017a/bin/glnxa64/libmwregexp.so)
./test: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/local/MATLAB/R2017a/bin/glnxa64/libmwmpath.so)
./test: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/local/MATLAB/R2017a/bin/glnxa64/libmwflstoragevfs.so)
./test: /lib64/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /usr/local/MATLAB/R2017a/bin/glnxa64/libmwmlutil.so)
./test: /lib64/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /usr/local/MATLAB/R2017a/bin/glnxa64/libmwsettingscore.so)
./test: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/local/MATLAB/R2017a/bin/glnxa64/libmwsettingscore.so)
./test: /lib64/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /usr/local/MATLAB/R2017a/bin/glnxa64/libmwms.so)
./test: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/local/MATLAB/R2017a/bin/glnxa64/libmwopcmodel.so)
./test: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/local/MATLAB/R2017a/bin/glnxa64/libmwopczippackage.so)
./test: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/local/MATLAB/R2017a/bin/glnxa64/libmwopcmwservices.so)
./test: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/local/MATLAB/R2017a/bin/glnxa64/libmwwebproxy.so)
./test: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/local/MATLAB/R2017a/bin/glnxa64/libboost_log.so.1.56.0)
./test: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/local/MATLAB/R2017a/bin/glnxa64/libboost_regex.so.1.56.0)
./test: /lib64/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /usr/local/MATLAB/R2017a/bin/glnxa64/libboost_regex.so.1.56.0)
./test: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/local/MATLAB/R2017a/bin/glnxa64/libboost_serialization.so.1.56.0)
./test: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/local/MATLAB/R2017a/bin/glnxa64/libCppMicroServices.so.3.0.0)
./test: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/local/MATLAB/R2017a/bin/glnxa64/libPocoCrypto.so.31)
./test: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/local/MATLAB/R2017a/bin/glnxa64/libPocoFoundation.so.31)
./test: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/local/MATLAB/R2017a/bin/glnxa64/libPocoJSON.so.31)
./test: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/local/MATLAB/R2017a/bin/glnxa64/libPocoNet.so.31)
./test: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/local/MATLAB/R2017a/bin/glnxa64/libPocoUtil.so.31)
./test: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/local/MATLAB/R2017a/bin/glnxa64/libPocoXML.so.31)
./test: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/local/MATLAB/R2017a/bin/glnxa64/libmwdservices.so)
./test: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/local/MATLAB/R2017a/bin/glnxa64/libmwflnetwork.so)
./test: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/local/MATLAB/R2017a/bin/glnxa64/libmwstoragefileprovider.so)
./test: /lib64/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /usr/local/MATLAB/R2017a/bin/glnxa64/libmwfoundation_extdata_array.so)
./test: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/local/MATLAB/R2017a/bin/glnxa64/libmwfoundation_extdata_array.so)
./test: /lib64/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /usr/local/MATLAB/R2017a/bin/glnxa64/libmwxmlcore.so)
libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007f54b5573000)

Sign in to comment.


David Sambell
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).

Categories

Find more on Verify Generated Code and Deployed Code Artifacts in Help Center and File Exchange

Tags

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!