Invalid Matlab Runtime error

I am testing out matlab compiler by trying to install a compiled app on another PC. When I run the app I get a dos style popup with this error message:
MCR:mclmcr:MCLMCR_Invalid_Matlab_Runtime
It appears for less than a second then vanishes. These are the steps I followed:
Compile a dummy app with one line of code. Tick the "Runtime included in package" option. Link to where I have downloaded the appropriate version. Copy the mcr install executable to target PC and run it. This part seems to work fine. I am running R2023a update 3 (9.14.0.2286388) 64-bit (win64). The MCR download version is MATLAB_Runtime_R2023a_Update_3_win64. The target PC is a windows 64 bit ystem.
Then use the mcc command to compile my app. Copy that executable over to the other PC and run it.
Any ideas what the problem is?

1 Commento

CM
CM il 9 Giu 2024
I have got this working now by adding a few lines of code to the dummy app to force it to include all the add-on packages. However it is circuitous trying to figure out what packages are needed and how to force their inclusion. The mcc command produces a file called requiredMCRProducts.txt which lists a bunch of packages by a 5 digit code, which you can then use to get the name of the package, which might (or might not) give you a hint as to which functions you are calling that need it:
It looks like you can use those codes to make a 'bare bones' MCR installer, though I am still trying to wrap my head around that one:
What would be good is if the error generated by matlab said a bit more than invalid runtime - eg the name of the missing package and the function that is calling it.

Accedi per commentare.

Risposte (1)

Gyan Vaibhav
Gyan Vaibhav il 14 Mag 2024

0 voti

Hi CM,
As much I can understand from your explanation above is:
  1. You have a simple matlab script which you make an dummy standalone app, and then install the executable and you are able to run it.
  2. When you do it using the mcc command you are unable to run it.
So, I tried the similar steps, and the first part worked well for me too. However, with the "mcc" command, when the executable ran, it got stuck for me on the command prompt window, and didn't progress ahead.
So, I tried adding the MATLAB Runtime Path for Deployment and it worked fine. However, as mentioned on the following page, we should not be required to do this in Windows environments, however, it fixes the similar issue.
Hope this helps.
Thanks
Gyan

6 Commenti

CM
CM il 14 Mag 2024
Hi Gyan, do you mean I should follow the instructions for using C:\Windows\System32\SystemPropertiesAdvanced.exe to update the path? I was hoping to be able to make a deployable executable using matlab - one that the end user can install like any other app. I can't expect people to go through that. There must be an easier way.
I did not actually try installing the dummy app that I built using the compiler GUI.
So, yes I meant to update the environment variable. (You can search in the start menu for environment variables too, to edit those).
For a deployable executable to run you have to install MATLAB Runtime. Applications generated with MATLAB® Compiler™ or MATLAB Compiler SDK™ use the system library path to locate the MATLAB Runtime libraries. The MATLAB Runtime installer for Windows® automatically sets the library path during installation, but on Linux® or macOS you must add the libraries manually. : https://www.mathworks.com/help/compiler/mcr-path-settings-for-run-time-deployment.html
So, this step shouldn't be needed however, I just want you to add and check if that works, if for some reason it didn't update the Path environment variable. Also, many software installations, need such steps, if they are not automated, so this overhead, shouldn't be part of your program, rather MATLAB runtime's.
Thanks
Gyan
CM
CM il 14 Mag 2024
Modificato: CM il 14 Mag 2024
I gave it a go. No change, exept that Avast picked it up the first time I ran it, then decided it was safe.
CM
CM il 18 Mag 2024
I tried redoing it without using the mc command. That is, doing everything in the compiler GUI with the Runtime included in package option on. That worked (though there are still other issues I ned to sort out). The MCR installer executable was about 3 times as big - 1.3 GB compared to 0.4 GB. Could it be that when I built a dummy app previously it left out the add-on packages I need?
Also, how do I get that windows command shell window to remain open if the program throws an error? It would make debugging a deployed program a lot easier.
Gyan Vaibhav
Gyan Vaibhav il 18 Mag 2024
Modificato: Gyan Vaibhav il 18 Mag 2024
So, no I don't think so. I also tried both and saw the considerable size difference however, I feel the major part of it is due to the installer and all the files that are required for the installer mainly.
As I told you when I added the path manually, it worked fine for me.
I am currently not sure why it's not adding the path automatically and why it's not working for you even after adding the same.
I would suggest reinstalling the MATLAB runtime, as a last resort. If even that doesn't work out, try reaching out to Mathworks Technical Support.
PS: Avast could be a pain sometimes, if you want you can try disabling it and then generating the executable, and running it, just to be sure.
Thanks,
Gyan
CM
CM il 19 Mag 2024
Thanks for the suggestions Gyan.

Accedi per commentare.

Categorie

Prodotti

Release

R2023a

Richiesto:

CM
il 14 Mag 2024

Commentato:

CM
il 9 Giu 2024

Community Treasure Hunt

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

Start Hunting!

Translated by