MATLAB HDL Coder build error: C compiler produced errors

조회 수: 5(최근 30일)
Ayka 2022년 9월 17일
댓글: Ayka 2022년 9월 25일
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: --
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.

채택된 답변

Ayka 2022년 9월 17일
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.
  댓글 수: 2
Ayka 2022년 9월 25일
I don't think so; the output directory is a common documents directory. Yet the right of Visual Studio affects many software: Vivado, Vitis, Vitis HLS, etc.

댓글을 달려면 로그인하십시오.

추가 답변(1개)

Kiran Kintali
Kiran Kintali 2022년 9월 25일
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')




Community Treasure Hunt

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

Start Hunting!

Translated by