Why MATLAB Coder can't build MEX?

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

Marius Beul
Marius Beul 2018년 2월 2일
I have the same issue. But when "converting to script" in the upper right corner and using this script, it compiles... Strange...
dm b
dm b 2018년 2월 9일
Maybe it uses previously generated mex-file. But it isn't correct if the code was changed.
Denis Gurchenkov
Denis Gurchenkov 2018년 2월 21일
This looks like a bug. Please contact MathWorks technical support. As a quick workaround, try to do
clear mex
and then delete the mex file if it is there, and then try "check for issues" again.
dm b
dm b 2018년 2월 28일
Deleting mex and any other generated files has no effect.
Ryan Livingston
Ryan Livingston 2018년 3월 2일
편집: Ryan Livingston 2018년 3월 2일
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.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 MATLAB Coder에 대해 자세히 알아보기

질문:

2017년 12월 8일

편집:

2018년 3월 2일

Community Treasure Hunt

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

Start Hunting!

Translated by