rtwdemo_roll Failed Code generation information file does not exist.
0 of 1 models built (0 models already up to date)
Build duration: 0h 0m 19.946s
Index exceeds the number of array elements. Index must not exceed 0.
Error in coder.make.internal.applyMsvcEnvironment>i_runMsvcSetupCommand (line 82)
deltaNames{i} = toks{i}{1};
Error in coder.make.internal.applyMsvcEnvironment (line 24)
i_runMsvcSetupCommand(mexCompDetails);
Error in codebuild>i_setupEnvironment (line 479)
environmentCleanupFcn = coder.make.internal.applyMsvcEnvironment(mexCompDetails);
Error in codebuild (line 142)
environmentCleanupFcn = i_setupEnvironment...
Error in coder.internal.ModelBuilder>i_buildProcedure (line 1523)
compileResult = codebuild(lBuildInfoUpdated, compileBuildOptsUpdated);
Error in coder.internal.ModelBuilder.make_rtw (line 119)
[buildResult, mainObjFolder] = i_buildProcedure...
Error in build_standalone_rtw_target
function [cleanupFcn, useCachedSettings] = applyMsvcEnvironment(mexCompDetails)
persistent cachedEnvironmentKey
[mexCompDetails.CommandLineShell ' ' mexCompDetails.CommandLineShellArg];
useCachedSettings = ~isempty(cachedEnvironmentKey) && ...
strcmp(environmentKey, cachedEnvironmentKey);
[deltaNames, deltaValues, pathPrepend, pathAppend] = ...
i_runMsvcSetupCommand(mexCompDetails);
variablesToRestore = deltaNames;
originalValues = cell(size(variablesToRestore));
for i=1:length(originalValues)
originalValues{i} = getenv(variablesToRestore{i});
variablesToRestore{end+1} = 'PATH';
originalPath = getenv('PATH');
originalValues{end+1} = originalPath;
cleanupFcn = onCleanup(@()i_setEnvVars(variablesToRestore, originalValues));
i_setEnvVars(deltaNames, deltaValues);
setenv('PATH', [pathPrepend originalPath pathAppend]);
cachedEnvironmentKey = environmentKey;
function i_setEnvVars(vars, values)
setenv(vars{i}, values{i});
function [deltaNames, deltaValues, pathPrepend, pathAppend] = ...
i_runMsvcSetupCommand(mexCompDetails)
markerOutput = '===PRINT ENVIRONMENT===';
trailer = ['echo ' markerOutput];
trailer = [newline trailer newline newline 'SET'];
batchFileName = [tempname '.bat'];
coder.make.internal.writeMsvcSetup(batchFileName, mexCompDetails, ...
[~, originalVars] = system('SET');
originalVars = splitlines(string(originalVars));
[~, updatedVars] = system(batchFileName);
updatedVars = regexprep(updatedVars, ['.*\s+' markerOutput '\s+'], '');
updatedVars = splitlines(string(updatedVars));
deltaVars = setdiff(updatedVars, originalVars);
toks = regexp(deltaVars, '(\w+)=(.*)', 'tokens', 'once');
deltaNames = cell(size(toks));
deltaValues = cell(size(toks));
deltaNames{i} = toks{i}{1};
deltaValues{i} = toks{i}{2};
pathIdx = strcmpi(deltaNames, 'PATH');
assert(sum(pathIdx)==1, 'Must be only one match for PATH')
updatedPath = deltaValues{pathIdx};
originalPath = getenv('PATH');
originalPathCleaned = regexprep(originalPath, ';+$', '');
k = strfind(updatedPath, originalPathCleaned);
['After running VCVARSALL.BAT, the updated path, "%s", ' ...
'must contain the original path, "%s"'], ...
updatedPath, originalPathCleaned);
pathPrepend = updatedPath(1:k(end)-1);
pathAppend = updatedPath(k(end)+length(originalPathCleaned):end);
deltaNames = deltaNames(~pathIdx);
deltaValues = deltaValues(~pathIdx);