Main Content

Investigate Deployed Application Failures

After the application is working on the test machine, failures can be isolated in end user deployment. The end users of your application need to install MATLAB® Runtime on their machines. MATLAB Runtime includes a set of shared libraries that provides support for all features of MATLAB.

There are a number of reasons why your application might not deploy to end users, after running successfully in a test environment. For a detailed list of guidelines for writing MATLAB code that can be consumed by end users, see Write Deployable MATLAB Code

Install MATLAB Runtime

All shared libraries required for your standalone executable or shared library are contained in MATLAB Runtime. Installing MATLAB Runtime is required for all deployment targets. For more information, see Download and Install MATLAB Runtime.

Update Dynamic Library Path on Linux or macOS

For information on setting the path on a deployment machine after installing MATLAB Runtime, see Set MATLAB Runtime Path for Deployment.

Error Message for Missing DLL

Error messages indicating missing DLLs such as mclmcrrtX_XX.dll or mclmcrrtX_XX.so are generally caused by an incorrect installation of MATLAB Runtime. For information on installing MATLAB Runtime, see Download and Install MATLAB Runtime.

Occasionally, there is a version mismatch between a DLL included with both MATLAB Runtime and Microsoft® Windows®. You can investigate which DLLs are called by your application using the Process Monitor tool. For information on using Process Monitor with your deployed application, see How can I use Process Monitor to troubleshoot the execution of my program?.

It is also possible that MATLAB Runtime is installed correctly, but the PATH,LD_LIBRARY_PATH, or DYLD_LIBRARY_PATH variable is set incorrectly. For information on setting environment variables, see Set MATLAB Runtime Path for Deployment.

Caution

Do not solve these problems by moving libraries or other files within the MATLAB Runtime folder structure. The MATLAB Runtime system is designed to accommodate different MATLAB Runtime versions operating on the same machine. The folder structure is an important part of this feature.

Obtain Write Access to Install Directory

The first operation attempted by a compiled application is extraction of the deployable archive. If the archive is not extracted, the application cannot access the compiled MATLAB code and the application fails. If the application has write access to the installation folder, a subfolder named application-name_mcr is created the first time the application is run. After this subfolder is created, the application no longer needs write access for subsequent executions.

Deploy Newer Version of Application

When deploying a newer version of an executable, the executable needs to be redeployed, since it also contains the embedded deployable code archive. The deployable archive is keyed to a specific compilation session. Each time an application is recompiled, a new, matched deployable archive is created. Delete the existing application folder and run the new executable to ensure that the application can expand the new deployable archive. As above, write access is required to expand the new deployable archive.