MATLAB Answers

Unable to Build Simulink model with embedded coder

16 views (last 30 days)
Ruhi Phulbandhe
Ruhi Phulbandhe on 14 Aug 2020
Answered: Mark McBroom on 17 Aug 2020
While using Embedded coder to build Simulink model , I am getting this error:
I have MATLAB Supported MinGW-w64 C/C++ Compiler installed and I have set it up using mex- setup command for C language compilation, but still I get this error every time I build Simulink model using embedded coder.
What should I change in order to build my simulink model ?
Error using coder.make.Builder/coder_diagnose
C:\Users\ruhi.phulbandhe\Documents\MATLAB\BatteryModel_ert_rtw>cd .
C:\Users\ruhi.phulbandhe\Documents\MATLAB\BatteryModel_ert_rtw>if "" == "" ("C:\PROGRA~1\MATLAB\R2019b\bin\win64\gmake" -f
BatteryModel.mk all ) else ("C:\PROGRA~1\MATLAB\R2019b\bin\win64\gmake" -f BatteryModel.mk )
"C:\PROGRA~3\MATLAB\SUPPOR~1\R2019b\3P778C~1.INS\MINGW_~1.INS\bin/gcc" -c -fwrapv -m64 -O0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0
-DTERMFCN=1 -DONESTEPFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DTID01EQ=0 -DMODEL=BatteryModel -DNUMST=1
-DNCSTATES=0 -DHAVESTDIO -DMODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0 @BatteryModel_comp.rsp -o "BatteryModel.obj"
"C:/Users/ruhi.phulbandhe/Documents/MATLAB/BatteryModel_ert_rtw/BatteryModel.c"
process_begin: CreateProcess(C:\Users\RUHI~1.PHU\AppData\Local\Temp\make1156-1.bat,
C:\Users\RUHI~1.PHU\AppData\Local\Temp\make1156-1.bat, ...) failed.
make (e=2): The system cannot find the file specified.
gmake: *** [BatteryModel.obj] Error 2
C:\Users\ruhi.phulbandhe\Documents\MATLAB\BatteryModel_ert_rtw>echo The make command returned an error of 2
The make command returned an error of 2
C:\Users\ruhi.phulbandhe\Documents\MATLAB\BatteryModel_ert_rtw>exit 1
Error(s) encountered while building "BatteryModel":
### Failed to generate all binary outputs.
Error in coder.make.Builder/coder_build
Error in coder.make.Builder/run
Error in coder.make.invokeBuilder
Error in RTW/genMakefileAndBuild (line 301)
buildResults = coder.make.invokeBuilder...
Error in coder.internal.compileStage
Error in coder.internal.ModelBuilder/buildProcedure (line 1562)
compileResult = coder.internal.compileStage...
Error in coder.internal.ModelBuilder/make_rtw (line 218)
[buildResult, mainObjFolder] = buildProcedure...
Error in coder.internal.ModelCodegenMgr/make_rtw (line 8)
[buildResult, mainObjFolder] = obj.make_rtw(varargin);
Error in make_rtw (line 20)
[buildResult, mainObjFolder] = h.make_rtw(buildArgs, varargin{:});
Error in build_target
Error in build_target
Error in build_standalone_rtw_target
Error in slbuild_private
Error in slbuild_private
Error in sl (line 15)
[varargout{1:nargout}]=feval(varargin{:});
Error in slbuild (line 98)
sl('slbuild_private', mdl, target, varargin{2:end});
Error in rtwbuild (line 235)
slbuild(sys, 'StandaloneCoderTarget', ...

Answers (1)

Mark McBroom
Mark McBroom on 17 Aug 2020
It looks to me like the minGW make command is having a problem with the directory name "ruhi.phulbandhe". My suggestion would be to move your simulink model to a different location that doesn't ahve a period on one of the directory names and then try to genrate code again.
Thanks.
Mark.

Community Treasure Hunt

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

Start Hunting!