MATLAB HDL Coder build error: C compiler produced errors

5 views (last 30 days)
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.

Accepted Answer

Ayka
Ayka on 17 Sep 2022
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 Comments
Ayka
Ayka on 25 Sep 2022
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.

Sign in to comment.

More Answers (1)

Kiran Kintali
Kiran Kintali on 25 Sep 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')

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!