<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/241634</link>
    <title>MATLAB Central Newsreader - running a c++ program using unix command</title>
    <description>Feed for thread: running a c++ program using unix command</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Tue, 31 Mar 2009 15:53:01 -0400</pubDate>
      <title>Re: running a c++ program using unix command</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/241634#639028</link>
      <author>free seek</author>
      <description>Did you try running matlab with the command&lt;br&gt;
LD_PRELOAD=/lib/libgcc_s.so.1:/usr/lib/libstdc++.so.6 matlab&lt;br&gt;
I had the same problem and change the environment variable LD_LIBRARY_PATH did not do anything for me. Using the command&lt;br&gt;
setenv('LD_PRELOAD','/lib/libgcc_s.so.1:/usr/lib/libstdc++.so.6');&lt;br&gt;
from matlab also did not do anything. Does anybody have an explanation for this?</description>
    </item>
    <item>
      <pubDate>Sun, 28 Dec 2008 05:19:02 -0500</pubDate>
      <title>running a c++ program using unix command</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/241634#618996</link>
      <author>John finn</author>
      <description>Hi,&lt;br&gt;
&lt;br&gt;
I am trying to run an executable (compiled c++ program) from within matlab using either of unix, system or ! and i keep getting this error &lt;br&gt;
&lt;br&gt;
&quot;matlabR2008a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.9' not found&quot; &lt;br&gt;
&lt;br&gt;
but running the same executable directly in the terminal in linux, works perfectly fine. Is there something different about the way matlab makes system calls to linux?&lt;br&gt;
&lt;br&gt;
specs of my setup are below: &lt;br&gt;
linux Mandriva 2008 &lt;br&gt;
x86_64 Intel(R) Core(TM)2 Quad CPU    Q6600  @ 2.40GHz GNU/Linux&lt;br&gt;
matlab version 7.6.0.324 (R2008a)&lt;br&gt;
&lt;br&gt;
thanks&lt;br&gt;
john</description>
    </item>
    <item>
      <pubDate>Mon, 29 Dec 2008 18:43:36 -0500</pubDate>
      <title>Re: running a c++ program using unix command</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/241634#619176</link>
      <author>Ashish Uthama</author>
      <description>On Sun, 28 Dec 2008 00:19:02 -0500, John finn &amp;lt;brainstuff@gmail.com&amp;gt; wrote:&lt;br&gt;
&lt;br&gt;
&amp;gt; Hi,&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; I am trying to run an executable (compiled c++ program) from within  &lt;br&gt;
&amp;gt; matlab using either of unix, system or ! and i keep getting this error&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &quot;matlabR2008a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.9' not  &lt;br&gt;
&amp;gt; found&quot;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; but running the same executable directly in the terminal in linux, works  &lt;br&gt;
&amp;gt; perfectly fine. Is there something different about the way matlab makes  &lt;br&gt;
&amp;gt; system calls to linux?&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; specs of my setup are below:&lt;br&gt;
&amp;gt; linux Mandriva 2008&lt;br&gt;
&amp;gt; x86_64 Intel(R) Core(TM)2 Quad CPU    Q6600  @ 2.40GHz GNU/Linux&lt;br&gt;
&amp;gt; matlab version 7.6.0.324 (R2008a)&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; thanks&lt;br&gt;
&amp;gt; john&lt;br&gt;
&amp;gt;&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
Using 'ldd' on this file from within MATLAB (using '!') and outside MATLAB  &lt;br&gt;
would give a hint.&lt;br&gt;
&lt;br&gt;
MATLAB updates LD_LIBRARY_PATH which is causing the executable to  &lt;br&gt;
dynamically link against MATLAB's libstdc++ (which it doest seem to like).  &lt;br&gt;
You might try resetting LD_LIBRARY_PATH in the same line that you shell  &lt;br&gt;
out.&lt;br&gt;
&lt;br&gt;
Or, equivalently, create a wrapper shell script which sets up the paths as  &lt;br&gt;
required and have MATLAB call it instead.</description>
    </item>
    <item>
      <pubDate>Mon, 29 Dec 2008 21:47:01 -0500</pubDate>
      <title>Re: running a c++ program using unix command</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/241634#619203</link>
      <author>John finn</author>
      <description>Hi Ashish, &lt;br&gt;
&lt;br&gt;
that was exactly the problem its fixed by running the program from a shell script adding the following line before calling the executable. &lt;br&gt;
&lt;br&gt;
export LD_LIBRARY_PATH=/usr/lib64;&lt;br&gt;
&lt;br&gt;
thanks for that&lt;br&gt;
&lt;br&gt;
&quot;Ashish Uthama&quot; &amp;lt;first.last@mathworks.com&amp;gt; wrote in message &amp;lt;op.umxsyyzga5ziv5@uthamaa.dhcp.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; On Sun, 28 Dec 2008 00:19:02 -0500, John finn &amp;lt;brainstuff@gmail.com&amp;gt; wrote:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Hi,&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; I am trying to run an executable (compiled c++ program) from within  &lt;br&gt;
&amp;gt; &amp;gt; matlab using either of unix, system or ! and i keep getting this error&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; &quot;matlabR2008a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.9' not  &lt;br&gt;
&amp;gt; &amp;gt; found&quot;&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; but running the same executable directly in the terminal in linux, works  &lt;br&gt;
&amp;gt; &amp;gt; perfectly fine. Is there something different about the way matlab makes  &lt;br&gt;
&amp;gt; &amp;gt; system calls to linux?&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; specs of my setup are below:&lt;br&gt;
&amp;gt; &amp;gt; linux Mandriva 2008&lt;br&gt;
&amp;gt; &amp;gt; x86_64 Intel(R) Core(TM)2 Quad CPU    Q6600  @ 2.40GHz GNU/Linux&lt;br&gt;
&amp;gt; &amp;gt; matlab version 7.6.0.324 (R2008a)&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; thanks&lt;br&gt;
&amp;gt; &amp;gt; john&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Using 'ldd' on this file from within MATLAB (using '!') and outside MATLAB  &lt;br&gt;
&amp;gt; would give a hint.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; MATLAB updates LD_LIBRARY_PATH which is causing the executable to  &lt;br&gt;
&amp;gt; dynamically link against MATLAB's libstdc++ (which it doest seem to like).  &lt;br&gt;
&amp;gt; You might try resetting LD_LIBRARY_PATH in the same line that you shell  &lt;br&gt;
&amp;gt; out.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Or, equivalently, create a wrapper shell script which sets up the paths as  &lt;br&gt;
&amp;gt; required and have MATLAB call it instead.</description>
    </item>
    <item>
      <pubDate>Wed, 14 Jan 2009 21:38:02 -0500</pubDate>
      <title>Re: running a c++ program using unix command</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/241634#621672</link>
      <author>Matthew </author>
      <description>Hello,&lt;br&gt;
&lt;br&gt;
I have the same problem.  I've tried the suggestions described here and on another thread that discusses it, but none of them have worked.  NB 'mexatexit.cpp' compiles and runs for me, but I need to use the STL classes.&lt;br&gt;
&lt;br&gt;
My file, 'matreader.mexglx', compiles fine except for this warning; &lt;br&gt;
&lt;br&gt;
Warning: You are using gcc version &quot;4.2.4&quot;.  The earliest gcc version supported&lt;br&gt;
with mex is &quot;4.0.0&quot;.  The latest version tested for use with mex is &quot;4.2.0&quot;.&lt;br&gt;
&lt;br&gt;
When I try to run it I get this:&lt;br&gt;
&lt;br&gt;
&amp;gt;&amp;gt; matreader(&quot;test&quot;)&lt;br&gt;
??? Invalid MEX-file '/home/matt/Projects/SaveData/matreader.mexglx':&lt;br&gt;
/home/matt/bin/glnx86/../../sys/os/glnx86/libstdc++.so.6: version&lt;br&gt;
`GLIBCXX_3.4.9' not found (required by&lt;br&gt;
/home/matt/Projects/SaveData/matreader.mexglx).&lt;br&gt;
&lt;br&gt;
So I went into &amp;lt;matlabroot&amp;gt;/sys/glnx86, where I found libstdc++.so.6, which in my case is a soft link to libstdc++.so.6.0.8 in the same directory.&lt;br&gt;
&lt;br&gt;
Then I went and found my version of libstdc++.so.6 in /usr/lib, as others have done.  There, it's a soft link to libstdc++.so.6.0.9 --a different version.  But when I changed the soft link in sys/glnx86 to point to this version, I got this error message when I tried to restart Matlab:&lt;br&gt;
&lt;br&gt;
/home/matt/bin/glnx86/MATLAB: /home/matt/bin/glnx86/../../sys/os/glnx86/libgcc_s.so.1: version `GCC_4.2.0' not found (required by /home/matt/bin/glnx86/../../sys/os/glnx86/libstdc++.so.6)&lt;br&gt;
&lt;br&gt;
(I am also getting a 'locking assertion' error but that seems Java-related.)  Finally when I run ldd from the shell, I get the following:&lt;br&gt;
&lt;br&gt;
	linux-gate.so.1 =&amp;gt;  (0xb7fc6000)&lt;br&gt;
	libmx.so =&amp;gt; not found&lt;br&gt;
	libmex.so =&amp;gt; not found&lt;br&gt;
	libmat.so =&amp;gt; not found&lt;br&gt;
	libm.so.6 =&amp;gt; /lib/tls/i686/cmov/libm.so.6 (0xb7f88000)&lt;br&gt;
	libstdc++.so.6 =&amp;gt; /usr/lib/libstdc++.so.6 (0xb7e95000)&lt;br&gt;
	libgcc_s.so.1 =&amp;gt; /lib/libgcc_s.so.1 (0xb7e8a000)&lt;br&gt;
	libpthread.so.0 =&amp;gt; /lib/tls/i686/cmov/libpthread.so.0 (0xb7e72000)&lt;br&gt;
	libc.so.6 =&amp;gt; /lib/tls/i686/cmov/libc.so.6 (0xb7d22000)&lt;br&gt;
	/lib/ld-linux.so.2 (0xb7fc7000)&lt;br&gt;
&lt;br&gt;
This has me pretty confused--so apparently it is finding libstdc++.so.6 in /usr/lib?!  I don't understand that.  NB I also altered LDPATH_PREFIX in /bin/scripts/matlab7rc.sh to equal '/usr/bin', to no effect.&lt;br&gt;
&lt;br&gt;
Please help, thank you!&lt;br&gt;
&lt;br&gt;
Matlab 2007b, Dell Inspiron 640m, Ubuntu 8.04&lt;br&gt;
&lt;br&gt;
Matt&lt;br&gt;
&lt;br&gt;
&quot;John finn&quot; &amp;lt;brainstuff@gmail.com&amp;gt; wrote in message &amp;lt;gj7286$dm1$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Hi,&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I am trying to run an executable (compiled c++ program) from within matlab using either of unix, system or ! and i keep getting this error &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &quot;matlabR2008a/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.9' not found&quot; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; but running the same executable directly in the terminal in linux, works perfectly fine. Is there something different about the way matlab makes system calls to linux?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; specs of my setup are below: &lt;br&gt;
&amp;gt; linux Mandriva 2008 &lt;br&gt;
&amp;gt; x86_64 Intel(R) Core(TM)2 Quad CPU    Q6600  @ 2.40GHz GNU/Linux&lt;br&gt;
&amp;gt; matlab version 7.6.0.324 (R2008a)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; thanks&lt;br&gt;
&amp;gt; john</description>
    </item>
    <item>
      <pubDate>Wed, 14 Jan 2009 22:24:04 -0500</pubDate>
      <title>Re: running a c++ program using unix command</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/241634#621694</link>
      <author>Ashish Uthama</author>
      <description>On Wed, 14 Jan 2009 16:38:02 -0500, Matthew &amp;lt;mp_nospam@yahoo.com&amp;gt; wrote:&lt;br&gt;
&lt;br&gt;
&amp;gt; Hello,&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; I have the same problem.  I've tried the suggestions described here and  &lt;br&gt;
&amp;gt; on another thread that discusses it, but none of them have worked.  NB  &lt;br&gt;
&amp;gt; 'mexatexit.cpp' compiles and runs for me, but I need to use the STL  &lt;br&gt;
&amp;gt; classes.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; My file, 'matreader.mexglx', compiles fine except for this warning;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Warning: You are using gcc version &quot;4.2.4&quot;.  The earliest gcc version  &lt;br&gt;
&amp;gt; supported&lt;br&gt;
&amp;gt; with mex is &quot;4.0.0&quot;.  The latest version tested for use with mex is  &lt;br&gt;
&amp;gt; &quot;4.2.0&quot;.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; When I try to run it I get this:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; matreader(&quot;test&quot;)&lt;br&gt;
&amp;gt; ??? Invalid MEX-file '/home/matt/Projects/SaveData/matreader.mexglx':&lt;br&gt;
&amp;gt; /home/matt/bin/glnx86/../../sys/os/glnx86/libstdc++.so.6: version&lt;br&gt;
&amp;gt; `GLIBCXX_3.4.9' not found (required by&lt;br&gt;
&amp;gt; /home/matt/Projects/SaveData/matreader.mexglx).&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; So I went into &amp;lt;matlabroot&amp;gt;/sys/glnx86, where I found libstdc++.so.6,  &lt;br&gt;
&amp;gt; which in my case is a soft link to libstdc++.so.6.0.8 in the same  &lt;br&gt;
&amp;gt; directory.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Then I went and found my version of libstdc++.so.6 in /usr/lib, as  &lt;br&gt;
&amp;gt; others have done.  There, it's a soft link to libstdc++.so.6.0.9 --a  &lt;br&gt;
&amp;gt; different version.  But when I changed the soft link in sys/glnx86 to  &lt;br&gt;
&amp;gt; point to this version, I got this error message when I tried to restart  &lt;br&gt;
&amp;gt; Matlab:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; /home/matt/bin/glnx86/MATLAB:  &lt;br&gt;
&amp;gt; /home/matt/bin/glnx86/../../sys/os/glnx86/libgcc_s.so.1: version  &lt;br&gt;
&amp;gt; `GCC_4.2.0' not found (required by  &lt;br&gt;
&amp;gt; /home/matt/bin/glnx86/../../sys/os/glnx86/libstdc++.so.6)&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; (I am also getting a 'locking assertion' error but that seems  &lt;br&gt;
&amp;gt; Java-related.)  Finally when I run ldd from the shell, I get the  &lt;br&gt;
&amp;gt; following:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; 	linux-gate.so.1 =&amp;gt;  (0xb7fc6000)&lt;br&gt;
&amp;gt; 	libmx.so =&amp;gt; not found&lt;br&gt;
&amp;gt; 	libmex.so =&amp;gt; not found&lt;br&gt;
&amp;gt; 	libmat.so =&amp;gt; not found&lt;br&gt;
&amp;gt; 	libm.so.6 =&amp;gt; /lib/tls/i686/cmov/libm.so.6 (0xb7f88000)&lt;br&gt;
&amp;gt; 	libstdc++.so.6 =&amp;gt; /usr/lib/libstdc++.so.6 (0xb7e95000)&lt;br&gt;
&amp;gt; 	libgcc_s.so.1 =&amp;gt; /lib/libgcc_s.so.1 (0xb7e8a000)&lt;br&gt;
&amp;gt; 	libpthread.so.0 =&amp;gt; /lib/tls/i686/cmov/libpthread.so.0 (0xb7e72000)&lt;br&gt;
&amp;gt; 	libc.so.6 =&amp;gt; /lib/tls/i686/cmov/libc.so.6 (0xb7d22000)&lt;br&gt;
&amp;gt; 	/lib/ld-linux.so.2 (0xb7fc7000)&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; This has me pretty confused--so apparently it is finding libstdc++.so.6  &lt;br&gt;
&amp;gt; in /usr/lib?!  I don't understand that.  NB I also altered LDPATH_PREFIX  &lt;br&gt;
&amp;gt; in /bin/scripts/matlab7rc.sh to equal '/usr/bin', to no effect.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Please help, thank you!&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Matlab 2007b, Dell Inspiron 640m, Ubuntu 8.04&lt;br&gt;
&amp;gt;&lt;br&gt;
&lt;br&gt;
I would suggest not altering the links by hand in your system directories  &lt;br&gt;
(I have been burned).&lt;br&gt;
And dont make the MATLAB lib's point to your system libs, as the message  &lt;br&gt;
indicated your system libs are newer than what MATLAB has been built and  &lt;br&gt;
tested for.&lt;br&gt;
&lt;br&gt;
The OP's issue was the executable needing the system libraries and NOT the  &lt;br&gt;
one's with MATLAB. He was able to solve this by changing his  &lt;br&gt;
LD_LIBRARY_PATH to have his system libs first in the path.&lt;br&gt;
&lt;br&gt;
Your issue appears to be the other way around, the MEX files needs  &lt;br&gt;
MATLAB's lib version and NOT the system's version. From **within MATLAB**,  &lt;br&gt;
use the ldd command to see what the MEX file links against. Then updated  &lt;br&gt;
LD_LIBRARY_PATH using&lt;br&gt;
&amp;nbsp;&amp;nbsp;setenv/getenv in MALTAB or&lt;br&gt;
&amp;nbsp;&amp;nbsp;!setenv ...; ldd &amp;lt;mex file&amp;gt;&lt;br&gt;
to ensure that it links against MATLAB libs first. I think the version in  &lt;br&gt;
your MATLAB install path would support STL's. But if it so turns out that  &lt;br&gt;
your STL use needs a newer version of GLIBC than what MATLAB  &lt;br&gt;
supports....you might be out of luck.&lt;br&gt;
&lt;br&gt;
Key points:&lt;br&gt;
ldd looks at LD_LIBRARY path to resolve .so's&lt;br&gt;
MATLAB changes this env value, hence ldd from a shell and from within  &lt;br&gt;
MATLAB might show different linkage.</description>
    </item>
    <item>
      <pubDate>Thu, 15 Jan 2009 02:13:02 -0500</pubDate>
      <title>Re: running a c++ program using unix command</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/241634#621716</link>
      <author>Matthew </author>
      <description>Ashish,&lt;br&gt;
&lt;br&gt;
Thanks very much for your suggestions.  Unfortunately I still haven't figured out how to make it work yet.  Running ldd from within Matlab (didn't know you could do that) did indeed produce different results, namely:&lt;br&gt;
&lt;br&gt;
&amp;gt;&amp;gt;!ldd matreader.mexglx&lt;br&gt;
./matreader.mexglx: /home/matt/sys/os/glnx86/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by ./matreader.mexglx)&lt;br&gt;
	linux-gate.so.1 =&amp;gt;  (0xb7f49000)&lt;br&gt;
	libmx.so =&amp;gt; /home/matt/bin/glnx86/libmx.so (0xb7ee1000)&lt;br&gt;
	libmex.so =&amp;gt; /home/matt/bin/glnx86/libmex.so (0xb7ed1000)&lt;br&gt;
	libmat.so =&amp;gt; /home/matt/bin/glnx86/libmat.so (0xb7eb1000)&lt;br&gt;
	libm.so.6 =&amp;gt; /lib/tls/i686/cmov/libm.so.6 (0xb7e79000)&lt;br&gt;
	libstdc++.so.6 =&amp;gt; /home/matt/sys/os/glnx86/libstdc++.so.6 (0xb7d9c000)&lt;br&gt;
	libgcc_s.so.1 =&amp;gt; /home/matt/sys/os/glnx86/libgcc_s.so.1 (0xb7d91000)&lt;br&gt;
	libpthread.so.0 =&amp;gt; /lib/tls/i686/cmov/libpthread.so.0 (0xb7d78000)&lt;br&gt;
	libc.so.6 =&amp;gt; /lib/tls/i686/cmov/libc.so.6 (0xb7c29000)&lt;br&gt;
	libut.so =&amp;gt; /home/matt/bin/glnx86/../../bin/glnx86/libut.so (0xb7b32000)&lt;br&gt;
	libicudata.so.36 =&amp;gt; /home/matt/bin/glnx86/../../bin/glnx86/libicudata.so.36 (0xb7b30000)&lt;br&gt;
	libicuuc.so.36 =&amp;gt; /home/matt/bin/glnx86/../../bin/glnx86/libicuuc.so.36 (0xb7a14000)&lt;br&gt;
	libicui18n.so.36 =&amp;gt; /home/matt/bin/glnx86/../../bin/glnx86/libicui18n.so.36 (0xb78e5000)&lt;br&gt;
	libicuio.so.36 =&amp;gt; /home/matt/bin/glnx86/../../bin/glnx86/libicuio.so.36 (0xb78da000)&lt;br&gt;
	libz.so.1 =&amp;gt; /home/matt/bin/glnx86/../../bin/glnx86/libz.so.1 (0xb78c6000)&lt;br&gt;
	libmwservices.so =&amp;gt; /home/matt/bin/glnx86/../../bin/glnx86/libmwservices.so (0xb7782000)&lt;br&gt;
	libmwmpath.so =&amp;gt; /home/matt/bin/glnx86/../../bin/glnx86/libmwmpath.so (0xb7750000)&lt;br&gt;
	libmwm_dispatcher.so =&amp;gt; /home/matt/bin/glnx86/../../bin/glnx86/libmwm_dispatcher.so (0xb76fa000)&lt;br&gt;
	libhdf5.so.0 =&amp;gt; /home/matt/bin/glnx86/../../bin/glnx86/libhdf5.so.0 (0xb75ca000)&lt;br&gt;
	/lib/ld-linux.so.2 (0xb7f4a000)&lt;br&gt;
	librt.so.1 =&amp;gt; /lib/tls/i686/cmov/librt.so.1 (0xb75c1000)&lt;br&gt;
	libdl.so.2 =&amp;gt; /lib/tls/i686/cmov/libdl.so.2 (0xb75bd000)&lt;br&gt;
	libxerces-c.so.27 =&amp;gt; /home/matt/bin/glnx86/../../bin/glnx86/../../bin/glnx86/libxerces-c.so.27 (0xb71f5000)&lt;br&gt;
	libmwmathutil.so =&amp;gt; /home/matt/bin/glnx86/../../bin/glnx86/../../bin/glnx86/libmwmathutil.so (0xb717e000)&lt;br&gt;
	libncurses.so.5 =&amp;gt; /lib/libncurses.so.5 (0xb714e000)&lt;br&gt;
	libboost_filesystem-gcc-mt-1_33_1.so.1.33.1 =&amp;gt; /home/matt/bin/glnx86/../../bin/glnx86/../../bin/glnx86/libboost_filesystem-gcc-mt-1_33_1.so.1.33.1 (0xb713e000)&lt;br&gt;
	libmwdatasvcs.so =&amp;gt; /home/matt/bin/glnx86/../../bin/glnx86/../../bin/glnx86/libmwdatasvcs.so (0xb7127000)&lt;br&gt;
	libmwxmlcore.so =&amp;gt; /home/matt/bin/glnx86/../../bin/glnx86/../../bin/glnx86/../../bin/glnx86/libmwxmlcore.so (0xb70b4000)&lt;br&gt;
&lt;br&gt;
Sorry that's a lot but crucially,&lt;br&gt;
&lt;br&gt;
	libstdc++.so.6 =&amp;gt; /home/matt/sys/os/glnx86/libstdc++.so.6 (0xb7d9c000)&lt;br&gt;
&lt;br&gt;
And indeed when I modify LD_LIBRARY_PATH as follows:&lt;br&gt;
&lt;br&gt;
&amp;gt;&amp;gt; oldpath = getenv('LD_LIBRARY_PATH');&lt;br&gt;
&amp;gt;&amp;gt; setenv('LD_LIBRARY_PATH', ['/usr/lib:' oldpath])&lt;br&gt;
&lt;br&gt;
the dependency changes accordingly, namely&lt;br&gt;
&lt;br&gt;
	libstdc++.so.6 =&amp;gt; /usr/lib/libstdc++.so.6 (0xb7d90000)&lt;br&gt;
&lt;br&gt;
Nothing else changes, in particular not&lt;br&gt;
&lt;br&gt;
	libgcc_s.so.1 =&amp;gt; /home/matt/sys/os/glnx86/libgcc_s.so.1 (0xb7d85000)&lt;br&gt;
&lt;br&gt;
which might be relevant? (Shot in the dark.)  In any case, when I recompile I get the same warning, and when I try to run the program again I get the same error.  I might as well not have changed anything.  NB when I restart Matlab, LD_LIBTARY_PATH is reset, maybe that means Matlab isn't 'seeing' the setenv change?  Anyway, I am definitely stumped at this point, please let me know if you have any more ideas!&lt;br&gt;
&lt;br&gt;
Best,&lt;br&gt;
Matt&lt;br&gt;
&lt;br&gt;
I just don't get it--if m&lt;br&gt;
&quot;Ashish Uthama&quot; &amp;lt;first.last@mathworks.com&amp;gt; wrote in message &amp;lt;op.unrpuerwa5ziv5@uthamaa.dhcp.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; On Wed, 14 Jan 2009 16:38:02 -0500, Matthew &amp;lt;mp_nospam@yahoo.com&amp;gt; wrote:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Hello,&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; I have the same problem.  I've tried the suggestions described here and  &lt;br&gt;
&amp;gt; &amp;gt; on another thread that discusses it, but none of them have worked.  NB  &lt;br&gt;
&amp;gt; &amp;gt; 'mexatexit.cpp' compiles and runs for me, but I need to use the STL  &lt;br&gt;
&amp;gt; &amp;gt; classes.&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; My file, 'matreader.mexglx', compiles fine except for this warning;&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; Warning: You are using gcc version &quot;4.2.4&quot;.  The earliest gcc version  &lt;br&gt;
&amp;gt; &amp;gt; supported&lt;br&gt;
&amp;gt; &amp;gt; with mex is &quot;4.0.0&quot;.  The latest version tested for use with mex is  &lt;br&gt;
&amp;gt; &amp;gt; &quot;4.2.0&quot;.&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; When I try to run it I get this:&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;&amp;gt; matreader(&quot;test&quot;)&lt;br&gt;
&amp;gt; &amp;gt; ??? Invalid MEX-file '/home/matt/Projects/SaveData/matreader.mexglx':&lt;br&gt;
&amp;gt; &amp;gt; /home/matt/bin/glnx86/../../sys/os/glnx86/libstdc++.so.6: version&lt;br&gt;
&amp;gt; &amp;gt; `GLIBCXX_3.4.9' not found (required by&lt;br&gt;
&amp;gt; &amp;gt; /home/matt/Projects/SaveData/matreader.mexglx).&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; So I went into &amp;lt;matlabroot&amp;gt;/sys/glnx86, where I found libstdc++.so.6,  &lt;br&gt;
&amp;gt; &amp;gt; which in my case is a soft link to libstdc++.so.6.0.8 in the same  &lt;br&gt;
&amp;gt; &amp;gt; directory.&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; Then I went and found my version of libstdc++.so.6 in /usr/lib, as  &lt;br&gt;
&amp;gt; &amp;gt; others have done.  There, it's a soft link to libstdc++.so.6.0.9 --a  &lt;br&gt;
&amp;gt; &amp;gt; different version.  But when I changed the soft link in sys/glnx86 to  &lt;br&gt;
&amp;gt; &amp;gt; point to this version, I got this error message when I tried to restart  &lt;br&gt;
&amp;gt; &amp;gt; Matlab:&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; /home/matt/bin/glnx86/MATLAB:  &lt;br&gt;
&amp;gt; &amp;gt; /home/matt/bin/glnx86/../../sys/os/glnx86/libgcc_s.so.1: version  &lt;br&gt;
&amp;gt; &amp;gt; `GCC_4.2.0' not found (required by  &lt;br&gt;
&amp;gt; &amp;gt; /home/matt/bin/glnx86/../../sys/os/glnx86/libstdc++.so.6)&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; (I am also getting a 'locking assertion' error but that seems  &lt;br&gt;
&amp;gt; &amp;gt; Java-related.)  Finally when I run ldd from the shell, I get the  &lt;br&gt;
&amp;gt; &amp;gt; following:&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; 	linux-gate.so.1 =&amp;gt;  (0xb7fc6000)&lt;br&gt;
&amp;gt; &amp;gt; 	libmx.so =&amp;gt; not found&lt;br&gt;
&amp;gt; &amp;gt; 	libmex.so =&amp;gt; not found&lt;br&gt;
&amp;gt; &amp;gt; 	libmat.so =&amp;gt; not found&lt;br&gt;
&amp;gt; &amp;gt; 	libm.so.6 =&amp;gt; /lib/tls/i686/cmov/libm.so.6 (0xb7f88000)&lt;br&gt;
&amp;gt; &amp;gt; 	libstdc++.so.6 =&amp;gt; /usr/lib/libstdc++.so.6 (0xb7e95000)&lt;br&gt;
&amp;gt; &amp;gt; 	libgcc_s.so.1 =&amp;gt; /lib/libgcc_s.so.1 (0xb7e8a000)&lt;br&gt;
&amp;gt; &amp;gt; 	libpthread.so.0 =&amp;gt; /lib/tls/i686/cmov/libpthread.so.0 (0xb7e72000)&lt;br&gt;
&amp;gt; &amp;gt; 	libc.so.6 =&amp;gt; /lib/tls/i686/cmov/libc.so.6 (0xb7d22000)&lt;br&gt;
&amp;gt; &amp;gt; 	/lib/ld-linux.so.2 (0xb7fc7000)&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; This has me pretty confused--so apparently it is finding libstdc++.so.6  &lt;br&gt;
&amp;gt; &amp;gt; in /usr/lib?!  I don't understand that.  NB I also altered LDPATH_PREFIX  &lt;br&gt;
&amp;gt; &amp;gt; in /bin/scripts/matlab7rc.sh to equal '/usr/bin', to no effect.&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; Please help, thank you!&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; Matlab 2007b, Dell Inspiron 640m, Ubuntu 8.04&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I would suggest not altering the links by hand in your system directories  &lt;br&gt;
&amp;gt; (I have been burned).&lt;br&gt;
&amp;gt; And dont make the MATLAB lib's point to your system libs, as the message  &lt;br&gt;
&amp;gt; indicated your system libs are newer than what MATLAB has been built and  &lt;br&gt;
&amp;gt; tested for.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; The OP's issue was the executable needing the system libraries and NOT the  &lt;br&gt;
&amp;gt; one's with MATLAB. He was able to solve this by changing his  &lt;br&gt;
&amp;gt; LD_LIBRARY_PATH to have his system libs first in the path.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Your issue appears to be the other way around, the MEX files needs  &lt;br&gt;
&amp;gt; MATLAB's lib version and NOT the system's version. From **within MATLAB**,  &lt;br&gt;
&amp;gt; use the ldd command to see what the MEX file links against. Then updated  &lt;br&gt;
&amp;gt; LD_LIBRARY_PATH using&lt;br&gt;
&amp;gt;   setenv/getenv in MALTAB or&lt;br&gt;
&amp;gt;   !setenv ...; ldd &amp;lt;mex file&amp;gt;&lt;br&gt;
&amp;gt; to ensure that it links against MATLAB libs first. I think the version in  &lt;br&gt;
&amp;gt; your MATLAB install path would support STL's. But if it so turns out that  &lt;br&gt;
&amp;gt; your STL use needs a newer version of GLIBC than what MATLAB  &lt;br&gt;
&amp;gt; supports....you might be out of luck.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Key points:&lt;br&gt;
&amp;gt; ldd looks at LD_LIBRARY path to resolve .so's&lt;br&gt;
&amp;gt; MATLAB changes this env value, hence ldd from a shell and from within  &lt;br&gt;
&amp;gt; MATLAB might show different linkage.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; </description>
    </item>
    <item>
      <pubDate>Fri, 16 Jan 2009 21:48:44 -0500</pubDate>
      <title>Re: running a c++ program using unix command</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/241634#622189</link>
      <author>Ashish Uthama</author>
      <description>On Wed, 14 Jan 2009 21:13:02 -0500, Matthew &amp;lt;mp_nospam@yahoo.com&amp;gt; wrote:&lt;br&gt;
&lt;br&gt;
&amp;gt; Ashish,&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Thanks very much for your suggestions.  Unfortunately I still haven't  &lt;br&gt;
&amp;gt; figured out how to make it work yet.  Running ldd from within Matlab  &lt;br&gt;
&amp;gt; (didn't know you could do that) did indeed produce different results,  &lt;br&gt;
&amp;gt; namely:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; !ldd matreader.mexglx&lt;br&gt;
&amp;gt; ./matreader.mexglx: /home/matt/sys/os/glnx86/libstdc++.so.6: version  &lt;br&gt;
&amp;gt; `GLIBCXX_3.4.9' not found (required by ./matreader.mexglx)&lt;br&gt;
&amp;gt; 	linux-gate.so.1 =&amp;gt;  (0xb7f49000)&lt;br&gt;
&amp;gt; 	libmx.so =&amp;gt; /home/matt/bin/glnx86/libmx.so (0xb7ee1000)&lt;br&gt;
&amp;gt; 	libmex.so =&amp;gt; /home/matt/bin/glnx86/libmex.so (0xb7ed1000)&lt;br&gt;
&amp;gt; 	libmat.so =&amp;gt; /home/matt/bin/glnx86/libmat.so (0xb7eb1000)&lt;br&gt;
&amp;gt; 	libm.so.6 =&amp;gt; /lib/tls/i686/cmov/libm.so.6 (0xb7e79000)&lt;br&gt;
&amp;gt; 	libstdc++.so.6 =&amp;gt; /home/matt/sys/os/glnx86/libstdc++.so.6 (0xb7d9c000)&lt;br&gt;
&amp;gt; 	libgcc_s.so.1 =&amp;gt; /home/matt/sys/os/glnx86/libgcc_s.so.1 (0xb7d91000)&lt;br&gt;
&amp;gt; 	libpthread.so.0 =&amp;gt; /lib/tls/i686/cmov/libpthread.so.0 (0xb7d78000)&lt;br&gt;
&amp;gt; 	libc.so.6 =&amp;gt; /lib/tls/i686/cmov/libc.so.6 (0xb7c29000)&lt;br&gt;
&amp;gt; 	libut.so =&amp;gt; /home/matt/bin/glnx86/../../bin/glnx86/libut.so (0xb7b32000)&lt;br&gt;
&amp;gt; 	libicudata.so.36 =&amp;gt;  &lt;br&gt;
&amp;gt; /home/matt/bin/glnx86/../../bin/glnx86/libicudata.so.36 (0xb7b30000)&lt;br&gt;
&amp;gt; 	libicuuc.so.36 =&amp;gt; /home/matt/bin/glnx86/../../bin/glnx86/libicuuc.so.36  &lt;br&gt;
&amp;gt; (0xb7a14000)&lt;br&gt;
&amp;gt; 	libicui18n.so.36 =&amp;gt;  &lt;br&gt;
&amp;gt; /home/matt/bin/glnx86/../../bin/glnx86/libicui18n.so.36 (0xb78e5000)&lt;br&gt;
&amp;gt; 	libicuio.so.36 =&amp;gt; /home/matt/bin/glnx86/../../bin/glnx86/libicuio.so.36  &lt;br&gt;
&amp;gt; (0xb78da000)&lt;br&gt;
&amp;gt; 	libz.so.1 =&amp;gt; /home/matt/bin/glnx86/../../bin/glnx86/libz.so.1  &lt;br&gt;
&amp;gt; (0xb78c6000)&lt;br&gt;
&amp;gt; 	libmwservices.so =&amp;gt;  &lt;br&gt;
&amp;gt; /home/matt/bin/glnx86/../../bin/glnx86/libmwservices.so (0xb7782000)&lt;br&gt;
&amp;gt; 	libmwmpath.so =&amp;gt; /home/matt/bin/glnx86/../../bin/glnx86/libmwmpath.so  &lt;br&gt;
&amp;gt; (0xb7750000)&lt;br&gt;
&amp;gt; 	libmwm_dispatcher.so =&amp;gt;  &lt;br&gt;
&amp;gt; /home/matt/bin/glnx86/../../bin/glnx86/libmwm_dispatcher.so (0xb76fa000)&lt;br&gt;
&amp;gt; 	libhdf5.so.0 =&amp;gt; /home/matt/bin/glnx86/../../bin/glnx86/libhdf5.so.0  &lt;br&gt;
&amp;gt; (0xb75ca000)&lt;br&gt;
&amp;gt; 	/lib/ld-linux.so.2 (0xb7f4a000)&lt;br&gt;
&amp;gt; 	librt.so.1 =&amp;gt; /lib/tls/i686/cmov/librt.so.1 (0xb75c1000)&lt;br&gt;
&amp;gt; 	libdl.so.2 =&amp;gt; /lib/tls/i686/cmov/libdl.so.2 (0xb75bd000)&lt;br&gt;
&amp;gt; 	libxerces-c.so.27 =&amp;gt;  &lt;br&gt;
&amp;gt; /home/matt/bin/glnx86/../../bin/glnx86/../../bin/glnx86/libxerces-c.so.27  &lt;br&gt;
&amp;gt; (0xb71f5000)&lt;br&gt;
&amp;gt; 	libmwmathutil.so =&amp;gt;  &lt;br&gt;
&amp;gt; /home/matt/bin/glnx86/../../bin/glnx86/../../bin/glnx86/libmwmathutil.so  &lt;br&gt;
&amp;gt; (0xb717e000)&lt;br&gt;
&amp;gt; 	libncurses.so.5 =&amp;gt; /lib/libncurses.so.5 (0xb714e000)&lt;br&gt;
&amp;gt; 	libboost_filesystem-gcc-mt-1_33_1.so.1.33.1 =&amp;gt;  &lt;br&gt;
&amp;gt; /home/matt/bin/glnx86/../../bin/glnx86/../../bin/glnx86/libboost_filesystem-gcc-mt-1_33_1.so.1.33.1  &lt;br&gt;
&amp;gt; (0xb713e000)&lt;br&gt;
&amp;gt; 	libmwdatasvcs.so =&amp;gt;  &lt;br&gt;
&amp;gt; /home/matt/bin/glnx86/../../bin/glnx86/../../bin/glnx86/libmwdatasvcs.so  &lt;br&gt;
&amp;gt; (0xb7127000)&lt;br&gt;
&amp;gt; 	libmwxmlcore.so =&amp;gt;  &lt;br&gt;
&amp;gt; /home/matt/bin/glnx86/../../bin/glnx86/../../bin/glnx86/../../bin/glnx86/libmwxmlcore.so  &lt;br&gt;
&amp;gt; (0xb70b4000)&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Sorry that's a lot but crucially,&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; 	libstdc++.so.6 =&amp;gt; /home/matt/sys/os/glnx86/libstdc++.so.6 (0xb7d9c000)&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; And indeed when I modify LD_LIBRARY_PATH as follows:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; oldpath = getenv('LD_LIBRARY_PATH');&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; setenv('LD_LIBRARY_PATH', ['/usr/lib:' oldpath])&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; the dependency changes accordingly, namely&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; 	libstdc++.so.6 =&amp;gt; /usr/lib/libstdc++.so.6 (0xb7d90000)&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Nothing else changes, in particular not&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; 	libgcc_s.so.1 =&amp;gt; /home/matt/sys/os/glnx86/libgcc_s.so.1 (0xb7d85000)&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; which might be relevant? (Shot in the dark.)  In any case, when I  &lt;br&gt;
&amp;gt; recompile I get the same warning, and when I try to run the program  &lt;br&gt;
&amp;gt; again I get the same error.  I might as well not have changed anything.   &lt;br&gt;
&amp;gt; NB when I restart Matlab, LD_LIBTARY_PATH is reset, maybe that means  &lt;br&gt;
&amp;gt; Matlab isn't 'seeing' the setenv change?  Anyway, I am definitely  &lt;br&gt;
&amp;gt; stumped at this point, please let me know if you have any more ideas!&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Best,&lt;br&gt;
&amp;gt; Matt&lt;br&gt;
&lt;br&gt;
Are you facing this issue with all MEX files you create? Does this project  &lt;br&gt;
source code have any specific GLIBC version dependencies?&lt;br&gt;
&lt;br&gt;
Without any changes (in link targets or env variables), you should be able  &lt;br&gt;
to compile a simple MEX file (a printf ) and run it. This would link  &lt;br&gt;
against the libraries in MATLAB install path. If not, please post what you  &lt;br&gt;
see (warnings/error message, outputs of LDD from within MATLAB).&lt;br&gt;
&lt;br&gt;
Any changes you do to LD_LIBRARY_PATH from within MATLAB (using SETENV)  &lt;br&gt;
are not retained between MATLAB sessions. For that matter, it is not  &lt;br&gt;
retained in a *nix shell either. You would have to explicitly set it each  &lt;br&gt;
time if you so choose (use startup.m/matlabrc).</description>
    </item>
    <item>
      <pubDate>Sun, 18 Jan 2009 16:51:02 -0500</pubDate>
      <title>Re: running a c++ program using unix command</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/241634#622358</link>
      <author>Matthew </author>
      <description>Hi Ashish,&lt;br&gt;
&lt;br&gt;
mexatexit.cpp compiles and runs for me just fine.  The headers I use which aren't in mexatexit are &amp;lt;fstream&amp;gt; and &amp;lt;iostream&amp;gt;.  And mexcpp.cpp, which includes &amp;lt;fstream&amp;gt; DOESN'T run in the same manner--compiles with warning, then gives the same error message.  I doubt this is related but I can only compile these programs when I copy them to a directory which isn't a subdirectory of Matlab; otherwise I get a 'permission denied, can't create matreader.o'--despite chmod 777.  Like I say probably irrelevant but I thought I'd mention it.&lt;br&gt;
&lt;br&gt;
Best,&lt;br&gt;
Matt&lt;br&gt;
&lt;br&gt;
&quot;Ashish Uthama&quot; &amp;lt;first.last@mathworks.com&amp;gt; wrote in message &amp;lt;op.unvdjikya5ziv5@uthamaa.dhcp.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Are you facing this issue with all MEX files you create? Does this project  &lt;br&gt;
&amp;gt; source code have any specific GLIBC version dependencies?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Without any changes (in link targets or env variables), you should be able  &lt;br&gt;
&amp;gt; to compile a simple MEX file (a printf ) and run it. This would link  &lt;br&gt;
&amp;gt; against the libraries in MATLAB install path. If not, please post what you  &lt;br&gt;
&amp;gt; see (warnings/error message, outputs of LDD from within MATLAB).&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Any changes you do to LD_LIBRARY_PATH from within MATLAB (using SETENV)  &lt;br&gt;
&amp;gt; are not retained between MATLAB sessions. For that matter, it is not  &lt;br&gt;
&amp;gt; retained in a *nix shell either. You would have to explicitly set it each  &lt;br&gt;
&amp;gt; time if you so choose (use startup.m/matlabrc).&lt;br&gt;
&amp;gt; </description>
    </item>
    <item>
      <pubDate>Tue, 12 May 2009 11:47:01 -0400</pubDate>
      <title>Re: running a c++ program using unix command</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/241634#649160</link>
      <author>Hyung-Sung Jung</author>
      <description>&quot;free seek&quot; &amp;lt;nospam@gmail.com&amp;gt; wrote in message &amp;lt;gqte8t$kl$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Did you try running matlab with the command&lt;br&gt;
&amp;gt; LD_PRELOAD=/lib/libgcc_s.so.1:/usr/lib/libstdc++.so.6 matlab&lt;br&gt;
&amp;gt; I had the same problem and change the environment variable LD_LIBRARY_PATH did not do anything for me. Using the command&lt;br&gt;
&amp;gt; setenv('LD_PRELOAD','/lib/libgcc_s.so.1:/usr/lib/libstdc++.so.6');&lt;br&gt;
&amp;gt; from matlab also did not do anything. Does anybody have an explanation for this?&lt;br&gt;
&lt;br&gt;
I have the similar problem in R2009a. There was no problem in R2008a.&lt;br&gt;
I have encounter the following problem to build rapid accelerator simulation execution file.&lt;br&gt;
&lt;br&gt;
/home/junghs/bin/MATLAB_2009a/bin/glnxa64/libmwservices.so: undefined reference to `std::bad_alloc::what() const@GLIBCXX_3.4.9'&lt;br&gt;
/home/junghs/bin/MATLAB_2009a/bin/glnxa64/libut.so: undefined reference to `std::basic_ostream&amp;lt;char, std::char_traits&amp;lt;char&amp;gt; &amp;gt;&amp; std::basic_ostream&amp;lt;char, std::char_traits&amp;lt;char&amp;gt; &amp;gt;::_M_insert&amp;lt;bool&amp;gt;(bool)@GLIBCXX_3.4.9'&lt;br&gt;
/home/junghs/bin/MATLAB_2009a/bin/glnxa64/libmwsl_solver_rtw.so: undefined reference to `std::basic_ostream&amp;lt;char, std::char_traits&amp;lt;char&amp;gt; &amp;gt;&amp; std::basic_ostream&amp;lt;char, std::char_traits&amp;lt;char&amp;gt; &amp;gt;::_M_insert&amp;lt;unsigned long&amp;gt;(unsigned long)@GLIBCXX_3.4.9'&lt;br&gt;
/home/junghs/bin/MATLAB_2009a/bin/glnxa64/libut.so: undefined reference to `std::basic_ostream&amp;lt;char, std::char_traits&amp;lt;char&amp;gt; &amp;gt;&amp; std::basic_ostream&amp;lt;char, std::char_traits&amp;lt;char&amp;gt; &amp;gt;::_M_insert&amp;lt;long&amp;gt;(long)@GLIBCXX_3.4.9'&lt;br&gt;
/home/junghs/bin/MATLAB_2009a/bin/glnxa64/libmwm_interpreter.so: undefined reference to `std::basic_istream&amp;lt;char, std::char_traits&amp;lt;char&amp;gt; &amp;gt;&amp; std::basic_istream&amp;lt;char, std::char_traits&amp;lt;char&amp;gt; &amp;gt;::_M_extract&amp;lt;unsigned long&amp;gt;(unsigned long&amp;)@GLIBCXX_3.4.9'&lt;br&gt;
/home/junghs/bin/MATLAB_2009a/bin/glnxa64/libmwm_interpreter.so: undefined reference to `std::basic_ostream&amp;lt;char, std::char_traits&amp;lt;char&amp;gt; &amp;gt;&amp; std::basic_ostream&amp;lt;char, std::char_traits&amp;lt;char&amp;gt; &amp;gt;::_M_insert&amp;lt;void const*&amp;gt;(void const*)@GLIBCXX_3.4.9'&lt;br&gt;
/home/junghs/bin/MATLAB_2009a/bin/glnxa64/libmwsl_solver_rtw.so: undefined reference to `std::basic_ostream&amp;lt;char, std::char_traits&amp;lt;char&amp;gt; &amp;gt;&amp; std::__ostream_insert&amp;lt;char, std::char_traits&amp;lt;char&amp;gt; &amp;gt;(std::basic_ostream&amp;lt;char, std::char_traits&amp;lt;char&amp;gt; &amp;gt;&amp;, char const*, long)@GLIBCXX_3.4.9'&lt;br&gt;
/home/junghs/bin/MATLAB_2009a/bin/glnxa64/libmwsl_solver_rtw.so: undefined reference to `std::basic_ostream&amp;lt;char, std::char_traits&amp;lt;char&amp;gt; &amp;gt;&amp; std::basic_ostream&amp;lt;char, std::char_traits&amp;lt;char&amp;gt; &amp;gt;::_M_insert&amp;lt;double&amp;gt;(double)@GLIBCXX_3.4.9'&lt;br&gt;
/home/junghs/bin/MATLAB_2009a/bin/glnxa64/libmwm_interpreter.so: undefined reference to `std::basic_istream&amp;lt;char, std::char_traits&amp;lt;char&amp;gt; &amp;gt;&amp; std::basic_istream&amp;lt;char, std::char_traits&amp;lt;char&amp;gt; &amp;gt;::_M_extract&amp;lt;double&amp;gt;(double&amp;)@GLIBCXX_3.4.9'&lt;br&gt;
&lt;br&gt;
I have two kinds of linux platform, Ubuntu &amp; centOS.&lt;br&gt;
To solve the above problem in Ubuntu OS, I have just copied 'libstdc++.so.6.0.9' (which is provided by matlab) to /usr/lib directory and have made soft link to 'libstdc++.so.6'. After this operation, I have cleared the above problem.&lt;br&gt;
But I cannot clear this issue in centOS platform. Please give me your precious comments.&lt;br&gt;
&lt;br&gt;
Thanks.</description>
    </item>
    <item>
      <pubDate>Fri, 24 Jul 2009 12:38:02 -0400</pubDate>
      <title>Re: running a c++ program using unix command</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/241634#667913</link>
      <author>Michael Hamilton</author>
      <description>&lt;br&gt;
I had this same error when trying to use a C++ program with mex:&lt;br&gt;
&lt;br&gt;
&amp;gt;&amp;gt; mexcpp(3,4)&lt;br&gt;
??? Invalid MEX-file '/home/hamilton/projects/slita/matlab_mex/mexcpp.mexa64':&lt;br&gt;
/matlab2007b/bin/glnxa64/../../sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required&lt;br&gt;
by /home/hamilton/projects/slita/matlab_mex/mexcpp.mexa64).&lt;br&gt;
&lt;br&gt;
Note that I was using the stock, mexcpp.cpp C++ example including in the distribution of Matlab, which I have copied to a local directory.  This error occurs when I compile using the mex command at the Unix command line, after configuration with mex --setup for gcc.&lt;br&gt;
&lt;br&gt;
After turning on verbose in the mex command and manually compiling with various options, I narrowed it down to the -O option.  Without the -O option in the compile command, the program works in matlab.  With the -O option in the compile command, the GLIBCXX error mentioned above shows up....&lt;br&gt;
&lt;br&gt;
So, I edited my ~/.matlab/R2007b/mexopts.sh line in the glnxa64 section:&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;CXXOPTIMFLAGS='-O -DNDEBUG'&lt;br&gt;
change to:&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;CXXOPTIMFLAGS='-DNDEBUG'&lt;br&gt;
&lt;br&gt;
The -O in the LDOPTIMFLAGS  doesn't matter (I assume because -O when linking doesn't really do much, it's the compiling, right?)&lt;br&gt;
&lt;br&gt;
Why this happens I don't know.  Perhaps I need to install some &quot;optimized&quot; version of the libraries?   I haven't seen this particular solution documented for this error, so, I thought I'd add it for posterity.  Hope it helps someone.  I've been set back by this for months.&lt;br&gt;
&lt;br&gt;
Background info:&lt;br&gt;
My OS:  (from cat /etc/lsb-release)&lt;br&gt;
DISTRIB_ID=Ubuntu&lt;br&gt;
DISTRIB_RELEASE=8.10&lt;br&gt;
DISTRIB_CODENAME=intrepid&lt;br&gt;
DISTRIB_DESCRIPTION=&quot;Ubuntu 8.10&quot;&lt;br&gt;
&lt;br&gt;
uname -a:&lt;br&gt;
Linux HOSTNAME 2.6.27-14-generic #1 SMP Wed Apr 15 19:29:46 UTC 2009 x86_64 GNU/Linux&lt;br&gt;
&lt;br&gt;
Matlab version: 7.5.0.338 (R2007b)&lt;br&gt;
&lt;br&gt;
Best Regards,&lt;br&gt;
Mike</description>
    </item>
  </channel>
</rss>

