Why MATLAB Coder can't build MEX?
4 views (last 30 days)
Show older comments
I have a problem. MATLAB Coder doesn't work properly with one of my projects. At Check For Issues state it generates error "MEX build failed". But it doesn't generate any error. Target Build Log is empty. When I try to do the same on the another PC with the same settings, there is no errors and MEX building is successfull. On the first PC MATLAB R2017a is installed, on the second PC MATLAB R2016b is installed. Why MEX building fails on the first PC and how can I define what error was occured?
5 Comments
Ryan Livingston
on 2 Mar 2018
Edited: Ryan Livingston
on 2 Mar 2018
I second Denis's advice to contact technical support as at least some sort of diagnostic should be given. Some thoughts beyond that:
- Are you able to generate a simple MEX file without Coder by following the "Build C MEX File" steps in the MEX documentation? If that errors out try mex -v yprime.c to get verbose messages.
- Are you able to call codegen on a trivial MATLAB function:
function y = timestwo(x)
y = 2*x;
>> codegen timestwo -args 1
>> timestwo_mex(10)
- You can also try to get insight into any errors that may be occurring by running:
>> dbstop if all error
in MATLAB and then re-running the "check for issues" step again. That will stop in the MATLAB debugger at all errors thrown regardless of whether or not they are caught. If you keep pressing continue in the MATLAB debugger you may eventually encounter an error that gives you a hint as to what is wrong. Note that you'll likely see many innocuous errors using this technique. Every MATLAB exception that is thrown will cause MATLAB to stop in the debugger, even if that exception is caught and handled. So it may take a bit of time to pinpoint the meaningful issue, if one even exists.
Answers (0)
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!