3

First of all, I am aware that there is a similar question here, but I read it and it concerns a different problem. Moving on to my problem, every time I am compiling a C file which is used from a function I get the error "MATLAB encountered an internal problem and needs to close". The compiling is done successfully by "Clang" on Mavericks OS X. Here is a screenshot of the error. More details (Matlab report etc.) can be, of course, provided upon request if one needs them to resolve the error. Screenshot

The files can also be provided.

azal
  • 1,210
  • 6
  • 23
  • 43

2 Answers2

9

This is an known issue. Try this:

  1. Identify the location where MATLAB is installed
  2. Navigate to the sys/os/glnxa64 directory within this installation folder
  3. Rename libstdc++.so.6 library to libstdc++.so.6.old

Source: from MATWORK, it works for me

TNg
  • 856
  • 1
  • 9
  • 15
4

That error is not because of the compiler. It is due to a segmentation fault once you run the MEX code. Somewhere in that code, you are accessing memory that you shouldn't be allowed to access.

I suggest you debug your MATLAB code. Check out my post here to figure out how to debug your MEX code depending on your operating system.

Preventing a MEX file from crashing in MATLAB

Community
  • 1
  • 1
rayryeng
  • 102,964
  • 22
  • 184
  • 193
  • thank you for your answer, but the code I am running is provided by Mathworks File Exchange and I have no knowledge on what to edit there :/ – azal Dec 08 '14 at 16:01
  • Can you provide a link to this file? There may be a bug report somewhere that may be specific to the Mac OS platform. – rayryeng Dec 08 '14 at 16:02
  • this is the C file that i compile: http://www.filedropper.com/interpoint and this is the .m file that uses it:http://www.filedropper.com/judd. The file can be found also here ( http://www.mathworks.com/matlabcentral/fileexchange/24089-correlation-dimension/content/dimension/judd.m ) but i don't know if its exactly the same or has been modified to use the interpoint.c file. Thank you in advance for your time and consideration. – azal Dec 08 '14 at 16:15
  • i accepted your answer as it is correct and solves the problem for manually created files. Unfortunately, this file is not mine and is accepted by Mathorks file exchange, so I am still waiting for you expert opinion and answer on this. Thank you again – azal Dec 08 '14 at 16:41
  • @gelazari - Thank you. I'll have a look at will get back to you. I'm afraid that the only thing you can do if I can't figure out the problem is to contact the author of the file on MATLAB FEX directly. – rayryeng Dec 08 '14 at 16:43
  • 1
    @gelazari - I found the original source code for `interpoint.c` here: http://www.mathworks.com/matlabcentral/fileexchange/24089-correlation-dimension - People put code on MATLAB FEX all the time. It actually **working** is another story. You see that this code was created 5 years ago, and has a 2/5 star rating. This probably means that the code doesn't work and the author isn't responsible in fixing it. As such, short of actually debugging the code yourself, you probably should use something else. I'll have a look through the source, but I can't promise anything. – rayryeng Dec 08 '14 at 16:51
  • The problem is that is works perfectly on the Window-based computers located in my University. : / – azal Dec 08 '14 at 18:33
  • @gelazari - Wow... ok, let me have a look and I'll get back to you. – rayryeng Dec 08 '14 at 18:41
  • 1
    Fire-and-forget code sharing sucks. Same thing with R. Lots of stuff everywhere, but nothing fits together, and performance often is really really bad. – Has QUIT--Anony-Mousse Dec 08 '14 at 23:00
  • any news bro? I spent the day yesterday on this but couldn't resolve anything. – azal Dec 09 '14 at 10:46