Testing Failures
After you have successfully compiled your application, the next step is to test it on
a development machine and deploy it on a target machine. Typically, the target machine
does not have a MATLAB® installation and requires MATLAB Runtime to be installed. A distribution includes all of the files that are
required by your application to run, which include the executable, deployable archive,
and MATLAB Runtime.
Test the application on the development machine by running the application against the
MATLAB Runtime shipped with MATLAB
Compiler™. This will verify that library dependencies are correct, that the
deployable archive can be extracted, and that all MATLAB code, MEX—files and support files required by the application have
been included in the archive. If you encounter errors testing your application, the
following questions may help you isolate the problem.
Are you able to execute the application from MATLAB?
On the development machine, you can test your application's execution by issuing
!
application-name
at the MATLAB prompt. If your application executes within MATLAB but not from outside, this can indicate an issue with the system
PATH
variable.
Does the application begin execution and result in MATLAB or other errors?
Ensure that you included all necessary files when compiling your application (see
the readme.txt
file generated with your compilation for more
details).
Functions that are called from your main MATLAB file are automatically included by MATLAB
Compiler; however, functions that are not explicitly called, for example
through EVAL, need to be included at compilation using the -a
switch of the mcc
command. Also, any support files like
.mat
, .txt
, or .html
files need to be added to the archive with the -a
switch. There
is a limitation on the functionality of MATLAB and associated toolboxes that can be compiled. Check the documentation
to see that the functions used in your application's MATLAB files are valid. Check the file
mccExcludedFiles.log
on the development machine. This file
lists all functions called from your application that cannot be compiled.
Do you have multiple MATLAB versions installed?
Executables generated by MATLAB
Compiler are designed to run in an environment where multiple versions of
MATLAB are installed. Some older versions of MATLAB may not be fully compatible with this architecture.
On Windows®, ensure that the
matlabroot
\runtime\win64
of the
version of MATLAB in which you are compiling appears ahead of
matlabroot
\runtime\win64
of
other versions of MATLAB installed on the PATH
environment variable on your
machine.
Similarly, on UNIX®, ensure that the dynamic library paths
(LD_LIBRARY_PATH
on Linux®) match. Do this by comparing the outputs of
!printenv
at the MATLAB prompt and printenv
at the shell prompt. Using this
path allows you to use mcc
from the operating system command
line.
If you are testing a standalone executable or shared library and driver
application, did you 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 any of the deployment targets.
Do you receive an error message about a 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 Install and Configure MATLAB Runtime.
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.
Does your system’s graphics card support the graphics application?
In situations where the existing hardware graphics card does not support the
graphics application, use software OpenGL. OpenGL libraries are visible for an
application by appending
matlabroot
/sys/opengl/lib/arch
to the library path. For example, on Linux, enter the following in a Bash shell:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:matlabroot/sys/opengl/lib/glnxa64
For more information on setting environment variables, see Set MATLAB Runtime Path for Deployment.
Is OpenGL properly installed on your system?
When searching for OpenGL libraries, MATLAB Runtime first looks on the system library path. If OpenGL is not found there,
it uses the LD_LIBRARY_PATH
environment variable to locate the
libraries. If you are getting failures due to the OpenGL libraries not being found,
you can append the location of the OpenGL libraries to the
LD_LIBRARY_PATH
environment variable. For example, on
Linux, enter the following in a Bash shell:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:matlabroot/sys/opengl/lib/glnxa64
For more information on setting environment variables, see Set MATLAB Runtime Path for Deployment.