Now mex in MATLAB 2012a only officially supports gcc 4.4.6 but I want to use gcc 4.7 at my own risk. Now If I compile something with mex directly, it will complain that
/usr/lib/gcc/i686-linux-gnu/4.7/cc1plus:
/usr/local/MATLAB/R2012a/sys/os/glnx86/libstdc++.so.6:
version `GLIBCXX_3.4.15' not found
(required by /usr/lib/i386-linux-gnu/libppl_c.so.4)
/usr/lib/gcc/i686-linux-gnu/4.7/cc1plus:
/usr/local/MATLAB/R2012a/sys/os/glnx86/libstdc++.so.6:
version `GLIBCXX_3.4.15' not found
(required by /usr/lib/i386-linux-gnu/libppl.so.9)
By strings /usr/lib/i386-linux-gnu/libstdc++.so.6 | grep 'GLIBCXX'
I confirm that this libstdc++.so.6
has that version string. I reviewed mexopts.sh
and modified the variable $RPATH
and $MLIBS
in that script, but it doesn't work. So if I don't use symbolic link, where can I config the path of the libstdc++.so.6
that mex uses? Thank you.
I was not able to find where my libstdc++.so.6 is, so I was not able to fully test the solution given by geek_girl. However, a modification of th1rdey3's worked. I ran in the matlab console:
This is the value I use for 'LD_LIBRARY_PATH' when compiling my C++ code in Eclipse (I am not using mex files, instead I create an executable of my C++ code in Eclipse and later run it from matlab shell). In my case the value of 'LD_LIBRARY_PATH' is that long because my C++ code uses boost's regex, matlab libraries (libmat, libmx and so on), GSL library and Armadillo. If you don't use all these libraries, setenv('LD_LIBRARY_PATH','') should be enough, I guess.
i tried both the answers.. but none worked for me.
however this worked for me. in matlab run this -
just for anyone who is facing the same problem.
P.S: I found this solution here