Problem solved. The reason is that in my computer Visual Studio needs to be ran as administrator. If running MATLAB as administrator, then the build can succeed; otherwise, the error described occured.
MATLAB HDL Coder build error: C compiler produced errors
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Windows 11 version: 21H2 22000.978
MATLAB version: R2022a Update 5
Visual Studio 2022 version: 17.3.4
ninja version: 1.10.2.git.kitware.jobserver-1
I started MATLAB HDL Coder Generation by MATLAB bundled example MATLAB\R2022a\examples\hdlcoder\main\mlhdlc_fir.m and mlhdlc_fir_tb.m. The autodefined types of indatabuf is double(1 × 1). In the Workflow Advisor, I ran Fixed-Point Conversion, but it failed.
The output is
------------------------------------------------------------------------
------------------------------------------------------------------------
??? Build error: C compiler produced errors. See the Build Log for further details.
More information
Code generation failed: View Error Report
The errors are:
Function: mlhdlc_fir
Line: --
Description:
Build error: C compiler produced errors. See the Build Log for further details. <a href="matlab:helpview('coder','msginfo_Coder_FE_TargetBuildError');">More information</a>
In the MEX report mlhdlc_fir\codegen\mlhdlc_fir\fixpt\fxptmp\mlhdlc_fir\html\report.mldatx, the Build Logs tab is empty. I found mlhdlc_fir\codegen\mlhdlc_fir\fixpt\fxptmp\mlhdlc_fir\build\win64\buildLog.log is also empty. However, I tried to manuanlly build the target by ninja in Developer PowerShell for VS 2022 or run mlhdlc_fir\codegen\mlhdlc_fir\fixpt\fxptmp\mlhdlc_fir\SetEnv.bat and buld in the Command Line Prompt. Both can build successfully: mlhdlc_fir_float_mex.exp mlhdlc_fir_float_mex.lib mlhdlc_fir_float_mex.mexw64 mlhdlc_fir_float_mex.mexw64.manifest. The output of ninja is attached as ninja_output.txt.
The content of mlhdlc_fir\codegen\mlhdlc_fir\fixpt\fxptmp\mlhdlc_fir\build\win64\.ninja_log is attached as ninja_log.txt.
However, when I build another bundled example MATLAB\R2022a\examples\hdlcoder\main\mlhdlc_sfir.m and mlhdlc_sfir_tb.m, there is no errors.
Why MATLAB failed to build, and there was not one word of build log shown? Could anyone help me with this? Thanks.
0 comentarios
Respuesta aceptada
Ayka
el 17 de Sept. de 2022
2 comentarios
Walter Roberson
el 17 de Sept. de 2022
Is this a matter of not having write access to the output directory?
Más respuestas (1)
Kiran Kintali
el 25 de Sept. de 2022
You can use this helper command to copy any of the HDL Coder friendly MATLAB demo files matlab\toolbox\hdlcoder\hdlcoderdemos\matlabhdlcoderdemos. It creates a working directory with necessary files based on the tempdir folder setting.
>> mlhdlc_demo_setup('sfir')
0 comentarios
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!