Which folders does mcc look in when compiling code?

using the zip download option. This has an extra file compared with the repo, that I don't think has ever been part of the repo (! ), namely EBSDAnalysis/@grainBoundary/load.m.
I've used this to compile:
bash compile_mtex6.0.0.sh sample_orientations_CTF.m
The compile script and the matlab script are given below:
export MTEX_DIR=/home/mbexegc2/software/matlab/toolboxes/mtex/mtex-6.0.0
for dir in $(find ${MTEX_DIR} -type d | grep -v -e ".git" -e "@" -e "private" -e "data" -e "makeDoc" -e "templates" -e "nfft_openMP" -e "compatibility/")
do
MTEX_INCLUDE="-I ${dir} ${MTEX_INCLUDE}"
done
export MTEX_INCLUDE="${MTEX_INCLUDE} -a ${MTEX_DIR}/data -a ${MTEX_DIR}/plotting/plotting_tools/colors.mat"
mcc -R -singleCompThread -R -softwareopengl -m ${1} ${MTEX_INCLUDE}
function sample_orientations_CTF(inputs_JSON_path, outputs_HDF5_path)
all_args = jsondecode(fileread(inputs_JSON_path));
CTFFilePath = all_args.CTF_file_path;
referenceFrameTransformation = all_args.EBSD_reference_frame_transformation;
specimenSym = all_args.specimen_symmetry;
phase = all_args.EBSD_phase;
rotation = all_args.EBSD_rotation;
numOrientations = all_args.num_orientations;
EBSD_orientations = get_EBSD_orientations_from_CTF_file(CTFFilePath, referenceFrameTransformation, specimenSym, phase, rotation);
orientations = EBSD_orientations(randperm(EBSD_orientations.length, numOrientations));
export_orientations_HDF5(orientations, outputs_HDF5_path);
end
function EBSD_orientations = get_EBSD_orientations_from_CTF_file(CTFFilePath, referenceFrameTransformation, specimenSym, phase, rotation)
if isempty(referenceFrameTransformation)
referenceFrameTransformation = {};
else
referenceFrameTransformation = {referenceFrameTransformation};
end
ebsd = loadEBSD_ctf(CTFFilePath, referenceFrameTransformation{:});
if ~isempty(rotation)
% Note that using rotate appears to remove the non-indexed phase.
rotationEulersRad = num2cell(rotation.euler_angles_deg * degree);
rot = rotation('euler', rotationEulersRad{:});
if isfield(rotation, 'keep_XY')
ebsd = rotate(ebsd, rot, 'keepXY');
elseif isfield(rotation, 'keep_euler')
ebsd = rotate(ebsd, rot, 'keepEuler');
else
ebsd = rotate(ebsd, rot);
end
end
EBSD_orientations = ebsd(phase).orientations;
EBSD_orientations.SS = specimenSymmetry(specimenSym);
end
function alignment = prepare_crystal_alignment(crystalSym)
% as defined in MatFlow `LatticeDirection` enumeration class:
keySet = {'a', 'b', 'c', 'a*', 'b*', 'c*'};
valueSet = [0, 1, 2, 3, 4, 5];
latticeDirs = containers.Map(keySet, valueSet);
alignment = [];
if isempty(crystalSym.alignment)
% Cubic
alignment(end + 1) = 0;
alignment(end + 1) = 1;
alignment(end + 1) = 2;
else
align1 = split(crystalSym.alignment{1}, '||');
align2 = split(crystalSym.alignment{2}, '||');
align3 = split(crystalSym.alignment{3}, '||');
alignment(end + 1) = latticeDirs(align1{2});
alignment(end + 1) = latticeDirs(align2{2});
alignment(end + 1) = latticeDirs(align3{2});
end
end
function export_orientations_HDF5(orientations, fileName)
alignment = prepare_crystal_alignment(orientations.CS);
ori_data = [orientations.a, orientations.b, orientations.c, orientations.d];
% TODO: why?
ori_data(:, 2:end) = ori_data(:, 2:end) * -1;
ori_data = ori_data';
h5create(fileName, '/orientations/data', size(ori_data));
h5write(fileName, '/orientations/data', ori_data);
h5writeatt(fileName, '/orientations', 'representation_type', 0);
h5writeatt(fileName, '/orientations', 'representation_quat_order', 0);
h5writeatt(fileName, '/orientations', 'unit_cell_alignment', alignment);
end
The output from compiling gives this error:
Warning: Colon operands must be real scalars. This warning will become an error
in a future release.
> In matlab.depfun.internal/MatlabSymbol (line 287)
In matlab.depfun.internal/MatlabInspector/resolveType (line 116)
In matlab.depfun.internal/MatlabInspector/determineType (line 38)
In matlab.depfun.internal/Completion/resolveRootSet (line 1273)
In matlab.depfun.internal/Completion/initializeRootSet (line 1773)
In matlab.depfun.internal/Completion (line 2798)
In matlab.depfun.internal.requirements (line 202)
In matlab.depfun.internal.mcc_call_requirements (line 59)
Error while determining required deployable files. Compilation terminated.
Details:
Error using parseFile (line 13)
MATLAB code
'/home/mbexegc2/software/matlab/toolboxes/mtex/mtex-6.0.0/EBSDAnalysis/@grainBoundary/load.m'
contains the following syntax error(s):
Line 23 column 6 : Parse error at <EOL>: usage might be invalid MATLAB syntax.
This is fine, insomuch as there is an error in that file. The question is why is MATLAB (mcc) looking in that directory?
I (thought I'd) explicitly excluded that file in my compile script using
grep -v ... -e "@"
Indeed if I output the value of ${MTEX_INCLUDE} it doesn't include any @ directories.
Any ideas?

Respuestas (1)

Mike Croucher
Mike Croucher hace alrededor de 4 horas
mcc's dependency analyze doesn't discover class methods by scanning include directories, it discovers them by resolving symbols referenced in the code it's analyzing. Once loadEBSD_ctf and the EBSD/grainBoundary machinery are reachable from the entry point, the entire @grainBoundary class is pulled in, including every method file in that folder. load is a method of grainBoundary, so load.m gets parsed regardless of whether its folder is on the -I path.
Since load.m isn't in the repo, I'm guessing its in the .zip file by mistake. I'd delete it and see if everything works OK. Either way, I suggest creating an issue on the mtex repo about this.

Productos

Versión

R2024b

Etiquetas

Preguntada:

hace alrededor de 12 horas

Respondida:

hace alrededor de 4 horas

Community Treasure Hunt

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

Start Hunting!

Translated by