3

I'm running ubuntu 12.04 and matlab R2012a.

Not sure what the problem is exactly, but I can build my mex file just fine. But when it is run I receive this error

Invalid MEX-file '/home/br/Documents/MATLAB/langmod/rss2mysql/mexUrl2dbSrc.mexa64':/usr/local/MATLAB/R2012a/bin/glnxa64/../../sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by /usr/local/lib/libmysqlcppconn.so.5)

which I find particularly strange, becuase if I run the following in the terminal

strings /usr/local/MATLAB/R2012a/bin/glnxa64/../../sys/os/glnxa64/libstdc++.so.6 | grep GLIBC

I see:

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
GLIBC_2.2.5
GLIBC_2.3
GLIBC_2.14
GLIBC_2.4
GLIBC_2.3.4
GLIBC_2.3.2
GLIBCXX_DEBUG_MESSAGE_LENGTH

What do i do to fix this? Any help would be appreciated.

thanks, Brian

Amro
  • 123,847
  • 25
  • 243
  • 454
brneuro
  • 326
  • 1
  • 5
  • 15
  • 2
    Related: [How to tell mex to link with the libstdc++.so.6 in /usr/lib instead of the one in the MATLAB directory?](http://stackoverflow.com/q/9959306/97160), [error while compiling Matlab mex file on Ubuntu 11.04 with Matlab R2011a](http://stackoverflow.com/q/7639666/97160) – Amro Jul 31 '12 at 16:25

1 Answers1

8

This can occur because Matlab includes its own copy of the library that differs from the one you used to compile it. You can replace the symbolic link to this library so that it points to the system library against with you compiled the mex file. On my machine this would look something like this:

sudo ln -sf /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.16 /usr/local/MATLAB/R2012a/bin/glnxa64/libstdc++.so.6

See also: /usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.15' not found

Community
  • 1
  • 1
  • i had done all of that... and despite matlab having two locations for this file, the link included in my OP and the link in your reply. Not sure whether I had missed changing one of these, but after relinking the both files to libstdc++.so.6.0.17 which supports everything needed, matlab didn't pick up on it. I tried 'rehash' but that didn't even work, but restarting matlab made it pick up on the changes. Thanks. – brneuro Jul 31 '12 at 17:46