Why do I get the run-time error "Failed to find MEX-file on path" when I execute a stand-alone program created using MATLAB Compiler 2.3 on Linux or Solaris?

5 views (last 30 days)
I attempted to compile the following function into a standalone application on a Linux machine:
function simplefcn
cellfun('isreal',{1 2 i 3})
This function works inside the MATLAB workspace as an M-function. I then attempt to compile it into a standalone code using:
mcc -m simplefcn
When I attempt to run the executable file that is produced, I get the following error:
Failed to find MEX-File on path : cellfun.mexglx.
EXITING
I have set the LD_LIBRARY_PATH variable as suggested in the MATLAB C/C++ Math Library Guide:
(From the MATLAB shell)
!printenv LD_LIBRARY_PATH
and receive:
/usr/local/matlab/extern/lib/glnx86:/usr/local/matlab/bin/glnx86:
/usr/local/matlab/sys/opengl/lib/glnx86:/usr/local/matlab/sys/os/glnx86:
/usr/local/matlab/toolbox/matlab/datatypes:/usr/local/sntp
From the UNIX shell from where MATLAB is invoked, I type the following:
printenv LD_LIBRARY_PATH
I receive:
/usr/local/matlab/extern/lib/glnx86:/usr/local/matlab/bin/glnx86:
/usr/local/matlab/sys/opengl/lib/glnx86:/usr/local/matlab/sys/os/glnx86:
/usr/local/matlab/toolbox/matlab/datatypes:/usr/local/sntp
The function CELLFUN is found in the correct path under the MATLAB tree:
which -all cellfun
/usr/local/matlab/toolbox/matlab/datatypes/cellfun.mexglx
/usr/local/matlab/toolbox/matlab/datatypes/cellfun.m % Shadowed
The MATLABROOT variable is also set to the correct value:
matlabroot
ans =
/usr/local/matlab

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 29 Jan 2013
This problem has been fixed in the MATLAB Compiler 3.0 (R13).
For previous versions, the files available for download from the bottom of this page can be used to fix this problem for both Linux and Solaris platforms.
The files you will need to implement this fix are as follows:
$MATLAB\bin\$ARCH\libmatlb.so
$MATLAB\bin\$ARCH\libmatlb.csf
$MATLAB\extern\lib\$ARCH\mglinstaller
(where $MATLAB is your root MATLAB directory and $ARCH is the appropriate architecture for your system)
Please do the following:
1. Save copies of your current files
2. Put the new files in the appropriate directories
3. Recompile your code
4. Redistribute the newly built executable code using the new MGLINSTALLER
Note that the above files have not been fully tested.

More Answers (0)

Categories

Find more on MATLAB Compiler in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!