Matlab compiler generates malformed ctf archive if using a symlinked (junction) folder.
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
When running the Matlab compiler on a folder which is an NTFS junction rather than proper folder, mcc generates a malformed ctf (zip) archive with repeated entries, except that subfolders are missing in the first iteration. This is really a problem for class folders with private subfolders.
E.g. create the following directory structure:
entry_point.m
src
|--@myclass
|--myclass.m
|--private
|--private_method.m
In entry_point.m:
function entry_point(input)
c = myclass(input);
c.invoke_private_method();
end
In myclass.m:
classdef myclass
properties
input;
end
methods
function obj = myclass(input)
obj.input = input;
end
function invoke_private_method(obj)
obj.private_method();
end
end
end
In private_method.m
function private_method(obj)
disp('Success!');
disp(['Input was: ' obj.input]);
end
If this is put in a normal folder and compiled using:
mcc -a src -m entry_point.m
Then everything works ok.
However, if src or the parent folder is an NTFS junction (symlink) in Windows (I've not tested this on Linux yet), then the zip in generated exe (or ctf for a Python module which was what I am actually using) is malformed. E.g. if we make a junction link:
mklink /J src_link src
and recompile with:
mcc -a src_link -m entry_point.m
then the zip archive looks like:
Archive: entry_point.exe
warning [entry_point.exe]: 1118208 extra bytes at beginning or within zipfile
(attempting to process anyway)
Length Date Time Name
--------- ---------- ----- ----
1925 2022-03-14 14:51 fsroot/toolbox/compiler/system_dependent.m
1131 2022-03-14 14:51 fsroot/toolbox/compiler/ctfroot.m
891 2022-03-14 14:51 fsroot/toolbox/compiler/patch/toolbox/local/hgrc.m
1291 2022-03-14 14:51 fsroot/toolbox/local/matlabrc.m
1143 2022-03-14 14:51 fsroot/toolbox/local/printopt.m
55 2022-03-14 14:51 fsroot/toolbox/local/Contents.m
53 2022-03-14 14:51 fsroot/toolbox/compiler/Contents.m
37 2022-03-14 14:51 fsroot/.matlab/VisibleSettings.json
3139 2022-03-14 14:51 fsroot/.matlab/connector.mlsettings
0 2022-03-14 14:51 fsroot/.matlab/creation.timestamp
267 2022-03-14 14:51 fsroot/.matlab/doc_toolbar_documents.cwd_r7.xml
86 2022-03-14 14:51 fsroot/.matlab/graphics.json
119876 2022-03-14 14:51 fsroot/.matlab/matlab.mlsettings
634 2022-03-14 14:51 fsroot/.matlab/matlab.prf
3176 2022-03-14 14:51 fsroot/.matlab/matlabCompiler.mlsettings
1 2022-03-14 14:51 fsroot/.matlab/migratePref.txt
3139 2022-03-14 14:51 fsroot/.matlab/mldrivetripwireaccess.mlsettings
6 2022-03-14 14:51 fsroot/.META/requiredMCRProducts.txt
991 2022-03-14 14:51 fsroot/entry_point/src_link/@myclass/myclass.m
951 2022-03-14 14:51 fsroot/entry_point/entry_point.m
991 2022-03-14 14:51 fsroot/entry_point/src/@myclass/myclass.m
952 2022-03-14 14:51 fsroot/entry_point/src/@myclass/private/private_method.m
10247 2022-03-14 14:51 .META/manifest.xml
337 2022-03-14 14:51 metadata/mwcoreProperties.xml
260 2022-03-14 14:51 metadata/mwcorePropertiesExtension.xml
310 2022-03-14 14:51 metadata/mwcorePropertiesReleaseInfo.xml
445 2022-03-14 14:51 metadata/coreProperties.xml
3946 2022-03-14 14:51 metadata/filesystemManifest.xml
1630 2022-03-14 14:51 [Content_Types].xml
1071 2022-03-14 14:51 _rels/.rels
--------- -------
158981 30 files
Note that there are two @myclass folders - one at fsroot/entry_point/src_link and one at fsroot/entry_point/src - the first takes precedent but does not have the private subfolder, which means when the command is invoked using:
entry_point.exe hello
it gives the following error:
Unrecognized method, property, or field 'private_method' for class 'myclass'.
Error in myclass/invoke_private_method (line 10)
Error in entry_point (line 3)
MATLAB:noSuchMethodOrField
0 comentarios
Respuestas (0)
Ver también
Categorías
Más información sobre C Shared Library Integration en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!