MATLAB HDL Coder build error: C compiler produced errors

5 次查看(过去 30 天)
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.

采纳的回答

Ayka
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 个评论
Walter Roberson
Walter Roberson 2022-9-17
Is this a matter of not having write access to the output directory?
Ayka
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')

产品


版本

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by