Matlab 2014a EXC_CRASH (SIGSEGV) crash when calling .dylib

1 view (last 30 days)
Issue
Matlab 2014a crashes after using .dylib functions with calllib. After running the attached .m script to completion, Matlab crashes. The amount of time before it crashes varies from being almost instant to taking many (tens of) second.
Happens on Mac OS X 10.7.5 and we've had a report of this happening on MacOS 10.8.5.
.dylib details
The .dylib is libLabJackM.dylib, which statically links to Boost 1.55. It and its dependencies are available from:
This is a .dylib we (LabJack Corp.) are the authors of.
.m script for reproducing the problem
if ~libisloaded('libLabJackM')
[notfound, warning] = loadlibrary('/usr/local/lib/libLabJackM.dylib', '/usr/local/include/LabJackM.h')
end
[err, b, c, d, handle] = calllib('libLabJackM', 'LJM_OpenS', 't7', 'tcp', '192.168.1.125', 0)
if err > 0
error(['LJM error: ' num2str(err)])
end
Attached
- crash report

Accepted Answer

Philip Borghesani
Philip Borghesani on 6 Feb 2015
I suggest contacting support for this type of issue.
Some initial thought that may be way off base do to lack of information and my inexperience with the Mac platform.
  • Linux/mac systems frequently have issues when multiple versions of c++ libraries are used in the same application. Problems can be reduced by configuring the library's build to reduce or control the default visibility of symbols exported. I believe one way to do this on the mac is to use two level namespace symbol exports.
  • MATLAB 2014a is dynamically linked to boost 1.48 is it possible to rebuild using the same version of boost?
  • If the library has a signal handler that is almost guaranteed to cause problems.
Is there a standard MATLAB crash dump created along with the MATLAB has crashed dialog being displayed or not. If it is it would be helpful.
  1 Comment
Rory Olsen
Rory Olsen on 17 Feb 2015
It was a problem with signals. Using sigaction , I was able to determine what signals were being handled and to return control to the old signal handler returned by sigaction. I blocked each signal being passed to sigaction before calling sigaction just in case a signal arrived before being able to return control to the old handler, and unblocked each signal afterwards.
Although this approach seems to work, I'm curious what MATLAB documentation there is regarding signal handling.
Thank you for your answer, Philip.
(As an additional note, the LabJackM library/driver typically handles signals because it maintains connections with external devices, which may become unresponsive if the connection suddenly dies. The solution detailed above is sufficient for MATLAB, however.)

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!