As was obvious from the error messages and as @Divakar pointed out, this was being caused by addpath() function in the code, which I failed to check for. Fixing that fixed the error.
Matlab compiler (mcc) not including referenced functions
-
15-06-2023 - |
Question
I am trying to compile a matlab source file (.m) into a standalone application (on linux). In my .m file I am calling a function (specifically from a library called MALSAR) which in turn seem to be using some compiled libraries (.mexglx .mexmaci64 .mexw32 .mexw64). When I compiled my source file, I included all the subdirectories under MALSAR package using "-I" option as follows
mcc -mv -I <dir1> -I <dir2> .... myfile.m
The compilation does not give an warnings, but when I execute the standalone executable, I get a MATLAB:fileHasDisappeared error. I am using mcc Version 4.18.
The detailed error out is included below.
The file
'/home/acharuva/Projects/scot/ext/MALSAR/functions/joint_feature_learning/Logistic_L21.m'
is not in the application's expanded CTF archive at
'/home/acharuva/.mcrCache8.1/run_l20'.
This is typically caused by calls to ADDPATH in your startup.m or matlabrc.m files. Please see the compiler documentation and use the ISDEPLOYED function to ensure ADDPATH commands are not executed by deployed applications.
Previously accessible file "/home/acharuva/Projects/scot/ext/MALSAR/functions/joint_feature_learning/Logistic_L21.m" is now inaccessible.
Error in run_l21_cross (line 34)
MATLAB:fileHasDisappeared
Any help will be greatly appreciated. Thank you.
Solution
OTHER TIPS
At Matlab .m file cover ADDPATH with isdeployed flag. Otherwise, when code building from compiler it gives "Previously accessible file" error. For fixing it:
%isdeployed=false means file run from matlab app, if true means run from compiler
if(isdeployed==false)
addpath(...);
end