ziyuang ziyuang - 1 year ago 66
Linux Question

How to tell mex to link with the libstdc++.so.6 in /usr/lib instead of the one in the MATLAB directory?

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

version `GLIBCXX_3.4.15' not found
(required by /usr/lib/i386-linux-gnu/libppl_c.so.4)

version `GLIBCXX_3.4.15' not found
(required by /usr/lib/i386-linux-gnu/libppl.so.9)

strings /usr/lib/i386-linux-gnu/libstdc++.so.6 | grep 'GLIBCXX'
I confirm that this
has that version string. I reviewed
and modified the variable
in that script, but it doesn't work. So if I don't use symbolic link, where can I config the path of the
that mex uses? Thank you.

Answer Source

You need to create a symbolic link to the gcc 4.7 library so matlab knows to use it. Something like:

ln -s {/path/to/file-name} {link-name}

If you don't want to use symbolic links, then just define this path in a terminal from which you launch matlab:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path/to/libstdc++.so.6
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download