Invalid MEX-file error in Matlab


Running a Matlab script threw this error:

Invalid MEX-file '/home/joe/do_work.mexa64':/usr/local/matlabR2014b/bin/glnxa64/../../sys/os/glnxa64/ version 'GLIBCXX_3.4.19' not found (required by /home/joe/do_work.mexa64).

This error is surprising since do_work.mexa64 was built using Matlab using the same system and same environment settings.


There is a difference in the glib version between the compiled and running environment. When the do_work.mexa64 was built, the from /usr/lib/x86_64-linux-gnu/ was used since it was first in LD_LIBRARY_PATH. However, when the script is run by Matlab, it picks up its own file as explained here!

A simple solution to this problem is to remove or rename the Matlab version of, so that it is not picked up.

Tried with: Ubuntu 14.04

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s