Is mcc a cross-compiler?

조회 수: 8 (최근 30일)
Maura Monville
Maura Monville 2021년 2월 1일
댓글: Walter Roberson 2021년 2월 1일
I am developing a Matlab code on my Mac.
I was asked to generape an executable that can be run on Windows.
I have read Kaustubha Govind' s answer dated November 9, 2018.
I understand MatLab comes witha compiler for scripting language "mcc".
I understand I have to install the MATLAB Compiler Runtime (MCR).
What is not clear is where I need the MCR.
Do I need the MCR on my Mac or do I need the MCR on the Windows workstation where the execuable will be run?
Furthermore, if I produce an executable on my Mac, using a MatLab version for Mac, then will such an executable be running on a Windows platform? I fesr that execuables generated on a Mac can only be run n a Mac.
Please, advise.
Thank you
Maura M. (maura.monville@nhs.net)

채택된 답변

Walter Roberson
Walter Roberson 2021년 2월 1일
You need to compile on the same operating system as the program will be executed on.
For example you could install Bootcamp and Windows 10, use your MATLAB license there (same license because it is the same host) and build for execution on Windows.
  댓글 수: 2
Maura Monville
Maura Monville 2021년 2월 1일
Thank you so much.
You have confirmed what I feared. That is "mcc" is not a cross-compiler".
Can you please confirm I have to download the MCR on the target platform (Windows) before compiling my code or just to run it?
Is the MCR included in a standard MatLab installation? I have all the toolboxes even if I only used 30% of them.
Thank you very much
Walter Roberson
Walter Roberson 2021년 2월 1일
MATLAB Compiler and MATLAB Compiler SDK include MCR. Historically you could choose to bundle MCR inside the executable or to not bundle it, in which case you either had to send it to the user separately or else the user had to install it from Mathworks. I am not sure whether the option to bundle it in the executable is still present.
MCR is needed to execute the resulting executable. Technically speaking, I am not sure it is needed to also compile the executable, but as the person doing the compiling would want to test the executable at least once, effectively it becomes mandatory on the host doing the compiling. But it is also a moot point because it is included inside the only two products that you can use to compile with to generate an executable, so it is going to be there anyhow unless you delete it.
MCR is not a development environment: it is the Mathworks Component Runtime, used to execute only.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 C Shared Library Integration에 대해 자세히 알아보기

태그

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by