Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
363 views
in Technique[技术] by (71.8m points)

c++ - /usr/../libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by ...)

I have been stuck on this problem for several weeks and been looking around on Internet for solution but so far not so good...

So I have a program written by someone else and I try to compile it in Matlab to make it work. My computer is Red-hat enterprise Linux workstation (64 bits) with gcc 4.4.3 and Matlab 2011b installed. The gcc is compatible with my Matlab (http://www.mathworks.com/support/compilers/R2011b/glnxa64.html).

The compilation works fine (I mean, no error message occurs in Matlab command window). But after compilation, every time when I use a specific function from the compilation (it's call "mexLasso"), it will show up errors like this:

***Invalid MEX-file '/usr/local/matlab_R2011b/toolbox/spams-matlab/build/mexLasso.mexa64': /usr/local/matlab_R2011b/bin/glnxa64/../../sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by /usr/local/matlab_R2011b/toolbox/spams-matlab/build/mexLasso.mexa64)

Error in test (line 24) alpha=mexLasso(X,D,param);*

So I type "strings /usr/lib/libstdc++.so.6 | grep GLIBC" in the terminal, and I found the "GLIBCXX_3.4.11" is actually in it.

I've been using Linux and gcc stuff for only several months...so there are still a lot of things I don't understand. It will be of great help if you can explain it in detail. Thanks!!

%% More detail: I got these programs on machine learning from http://spams-devel.gforge.inria.fr/downloads.html. The wierd thing is, after compilation, other functions in that package works fine (such as "mexTrainDL").

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The solution prompted by @whjiang works but have two limits:

  1. You may be required a sudo privilege to change the library symbol link.
  2. The change is global and can affect all users

So there is another.

As explained by this answer from MATLAB Central, the problem is caused by Matlab:

Matlab internally changes the LD_LIBRARY_PATH to prefer <MatlabPATH >/sys/os/<ARCH>

and the <MatlabPATH>/sys/os/libstdc++.so.6 is out of date.

The solution is set LD_PRELOAD when calling Matlab like this,

env LD_PRELOAD=/usr/lib/libstdc++.so.6  <MatlabPATH>/bin/matlab -desktop

The path of libstdc++.so.6 my be different from os to os. For example, on my LMDE2, the path is /usr/lib/x86_64-linux-gnu/libstdc++.so.6.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...