Reputation: 325
I am trying to run a code (sent to me by someone) that uses mex files in MATLAB. I have managed to compile the mex files, but when I run the code that calls these files, I get the error shown below. I am not quite sure what's happening here, so any help will be appreciated.
Segmentation violation detected at Mon Sep 10 16:26:11 2012
------------------------------------------------------------------------
Configuration:
Crash Decoding : Disabled
Current Visual : 0x22 (class 4, depth 24)
Default Encoding: UTF-8
GNU C Library : 2.11.3 stable
MATLAB Root : /cae/apps/data/matlab-2012a
MATLAB Version : 7.14.0.739 (R2012a)
Operating System: Linux 3.2.0-0.bpo.2-amd64 #1 SMP Fri Jun 29 20:42:29 UTC 2012 x86_64
Processor ID : x86 Family 6 Model 42 Stepping 7, GenuineIntel
Virtual Machine : Java 1.6.0_26-b03 with Sun Microsystems Inc. Java HotSpot(TM) 64-Bit Server VM mixed mode
Window System : The X.Org Foundation (11006000), display localhost:10.0
Fault Count: 1
Abnormal termination:
Segmentation violation
Upvotes: 1
Views: 6563
Reputation: 14947
There's definitely a bug in the MEX code. Two possibilities: 1. The error is insufficient error-checking, and you're calling the function with parameters that are not valid (bad types, sizes, order, etc.) 2. If you're using a confirmed set of parameters that work on the author's machine, then perhaps the code is not portable, and makes bad assumptions (32/64 bit, Windows/Linux, etc.)
Step 1: Check your arguments, if possible use a minimal test set that has been verified on the author's computer.
Step 2: Run the same code via the debugger: http://www.mathworks.com/help/matlab/matlab_external/debugging-c-c-language-mex-files.html This will help isolate the location of the crash. Then fix the code :)
Upvotes: 4